-
Notifications
You must be signed in to change notification settings - Fork 181
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PBJ: Improve CookieSync and Setuid logging and metrics #1253
Changes from 4 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -115,6 +115,8 @@ Following metrics are collected and submitted if account is configured with `det | |
- `usersync.bad_requests` - number of requests received with bidder not specified | ||
- `usersync.<bidder-name>.sets` - number of requests received resulted in `uid` cookie update for `<bidder-name>` | ||
- `usersync.<bidder-name>.tcf.blocked` - number of requests received that didn't result in `uid` cookie update for `<bidder-name>` because of lack of user consent for this action according to TCF | ||
- `usersync.<bidder-name>.tcf.invalid` - number of requests received that are lacking of a valid consent string for `<bidder-name>` | ||
- `usersync.all.tcf.invalid` - number of requests received that are lacking of a valid consent string for all requested bidders | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Pls do mention |
||
|
||
## Privacy metrics | ||
- `privacy.tcf.(missing|invalid)` - number of requests lacking a valid consent string | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,6 +21,8 @@ | |
*/ | ||
public class Metrics extends UpdatableMetrics { | ||
|
||
private static final String ALL_REQUEST_BIDDERS = "all"; | ||
|
||
private final AccountMetricsVerbosity accountMetricsVerbosity; | ||
|
||
private final Function<MetricName, RequestStatusMetrics> requestMetricsCreator; | ||
|
@@ -285,6 +287,14 @@ public void updateUserSyncTcfBlockedMetric(String bidder) { | |
userSync().forBidder(bidder).tcf().incCounter(MetricName.blocked); | ||
} | ||
|
||
public void updateUserSyncTcfInvalidMetric(String bidder) { | ||
userSync().forBidder(bidder).tcf().incCounter(MetricName.invalid); | ||
} | ||
|
||
public void updateUserSyncTcfInvalidMetricForAllBidders() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This method can overloaded from |
||
userSync().forBidder(ALL_REQUEST_BIDDERS).tcf().incCounter(MetricName.invalid); | ||
} | ||
|
||
public void updateCookieSyncRequestMetric() { | ||
incCounter(MetricName.cookie_sync_requests); | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,6 +49,7 @@ | |
import java.time.Instant; | ||
import java.time.ZoneId; | ||
import java.util.Collection; | ||
import java.util.Collections; | ||
import java.util.HashMap; | ||
import java.util.HashSet; | ||
import java.util.List; | ||
|
@@ -245,7 +246,7 @@ public void shouldRespondWithBadRequestStatusIfGdprConsentIsInvalid() { | |
// given | ||
given(routingContext.getBody()) | ||
.willReturn(givenRequestBody(CookieSyncRequest.builder() | ||
.bidders(emptyList()) | ||
.bidders(Collections.singletonList(RUBICON)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In tests we'd rather prefer to use static method imports to rid off |
||
.gdpr(1) | ||
.gdprConsent("invalid") | ||
.build())); | ||
|
@@ -258,6 +259,7 @@ public void shouldRespondWithBadRequestStatusIfGdprConsentIsInvalid() { | |
cookieSyncHandler.handle(routingContext); | ||
|
||
// then | ||
verify(metrics).updateUserSyncTcfInvalidMetricForAllBidders(); | ||
verify(httpResponse).setStatusCode(eq(400)); | ||
verify(httpResponse).end(eq("Invalid request format: Consent string is invalid")); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pls do mention
/setuid
here.