@@ -99,6 +99,7 @@ public class UIDOperatorVerticle extends AbstractVerticle {
9999 private final Map <Tuple .Tuple2 <String , Boolean >, DistributionSummary > _refreshDurationMetricSummaries = new HashMap <>();
100100 private final Map <Tuple .Tuple3 <String , Boolean , Boolean >, Counter > _advertisingTokenExpiryStatus = new HashMap <>();
101101 private final Map <Tuple .Tuple3 <String , OptoutCheckPolicy , String >, Counter > _tokenGeneratePolicyCounters = new HashMap <>();
102+ private final Map <String , Counter > _tokenGenerateTCFUsage = new HashMap <>();
102103 private final Map <String , Tuple .Tuple2 <Counter , Counter >> _identityMapUnmappedIdentifiers = new HashMap <>();
103104 private final Map <String , Counter > _identityMapRequestWithUnmapped = new HashMap <>();
104105
@@ -962,7 +963,7 @@ private void handleTokenGenerateV2(RoutingContext rc) {
962963 if (isTokenInputValid (input , rc )) {
963964 final String apiContact = getApiContact (rc );
964965
965- switch (validateUserConsent (req )) {
966+ switch (validateUserConsent (req , apiContact )) {
966967 case INVALID : {
967968 SendClientErrorResponseAndRecordStats (ResponseStatus .ClientError , 400 , rc , "User consent is invalid" , siteId , TokenResponseStatsCollector .Endpoint .GenerateV2 , TokenResponseStatsCollector .ResponseStatus .InvalidUserConsentString , siteProvider , platformType );
968969 return ;
@@ -1891,9 +1892,10 @@ private InputUtil.InputVal[] createInputListV1(JsonArray a, IdentityType identit
18911892 return resp ;
18921893 }
18931894
1894- private UserConsentStatus validateUserConsent (JsonObject req ) {
1895- // TCF string is an optional parameter and we should only check tcf if in EUID and the string is present
1895+ private UserConsentStatus validateUserConsent (JsonObject req , String apiContact ) {
1896+ // TCF string is an optional parameter, and we should only check tcf if in EUID and the string is present
18961897 if (identityScope .equals (IdentityScope .EUID ) && req .containsKey ("tcf_consent_string" )) {
1898+ recordTokenGenerateTCFUsage (apiContact );
18971899 TransparentConsentParseResult tcResult = this .getUserConsentV2 (req );
18981900 if (!tcResult .isSuccess ()) {
18991901 return UserConsentStatus .INVALID ;
@@ -1960,6 +1962,13 @@ private void recordTokenGeneratePolicy(String apiContact, OptoutCheckPolicy poli
19601962 .register (Metrics .globalRegistry )).increment ();
19611963 }
19621964
1965+ private void recordTokenGenerateTCFUsage (String apiContact ) {
1966+ _tokenGenerateTCFUsage .computeIfAbsent (apiContact , contact -> Counter
1967+ .builder ("uid2.token_generate_tcf_usage" )
1968+ .description ("Counter for token generate tcf usage" )
1969+ .tags ("api_contact" , contact )
1970+ .register (Metrics .globalRegistry )).increment ();
1971+ }
19631972
19641973 private TransparentConsentParseResult getUserConsentV2 (JsonObject req ) {
19651974 final String rawTcString = req .getString ("tcf_consent_string" );
0 commit comments