diff --git a/extra/modules/confiant-ad-quality/src/main/java/org/prebid/server/hooks/modules/com/confiant/adquality/v1/ConfiantAdQualityBidResponsesScanHook.java b/extra/modules/confiant-ad-quality/src/main/java/org/prebid/server/hooks/modules/com/confiant/adquality/v1/ConfiantAdQualityBidResponsesScanHook.java index 7db1446bcce..4a6c15d1663 100644 --- a/extra/modules/confiant-ad-quality/src/main/java/org/prebid/server/hooks/modules/com/confiant/adquality/v1/ConfiantAdQualityBidResponsesScanHook.java +++ b/extra/modules/confiant-ad-quality/src/main/java/org/prebid/server/hooks/modules/com/confiant/adquality/v1/ConfiantAdQualityBidResponsesScanHook.java @@ -119,6 +119,8 @@ private InvocationResult toInvocationResult( .payloadUpdate(payload -> AllProcessedBidResponsesPayloadImpl.of( Stream.concat(bidderResponsesWithoutIssues.stream(), notScannedBidderResponses.stream()).toList())); + System.out.println("ConfiantAdQualityBidResponsesScanHook/ InvocationResult: " + resultBuilder.build()); + return resultBuilder.build(); } diff --git a/extra/modules/greenbids-real-time-data/pom.xml b/extra/modules/greenbids-real-time-data/pom.xml index 42bd6318224..cbb4d9ce36d 100644 --- a/extra/modules/greenbids-real-time-data/pom.xml +++ b/extra/modules/greenbids-real-time-data/pom.xml @@ -6,7 +6,7 @@ org.prebid.server.hooks.modules all-modules - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT greenbids-real-time-data diff --git a/extra/modules/greenbids-real-time-data/src/main/java/org/prebid/server/hooks/modules/greenbids/real/time/data/model/AnalyticsResult.java b/extra/modules/greenbids-real-time-data/src/main/java/org/prebid/server/hooks/modules/greenbids/real/time/data/model/AnalyticsResult.java new file mode 100644 index 00000000000..65b4fae2185 --- /dev/null +++ b/extra/modules/greenbids-real-time-data/src/main/java/org/prebid/server/hooks/modules/greenbids/real/time/data/model/AnalyticsResult.java @@ -0,0 +1,17 @@ +package org.prebid.server.hooks.modules.greenbids.real.time.data.model; + +import lombok.Value; + +import java.util.Map; + +@Value(staticConstructor = "of") +public class AnalyticsResult { + + String status; + + Map values; + + String bidder; + + String impId; +} diff --git a/extra/modules/greenbids-real-time-data/src/main/java/org/prebid/server/hooks/modules/greenbids/real/time/data/model/RtdFilterResult.java b/extra/modules/greenbids-real-time-data/src/main/java/org/prebid/server/hooks/modules/greenbids/real/time/data/model/RtdFilterResult.java new file mode 100644 index 00000000000..57e0095cb4a --- /dev/null +++ b/extra/modules/greenbids-real-time-data/src/main/java/org/prebid/server/hooks/modules/greenbids/real/time/data/model/RtdFilterResult.java @@ -0,0 +1,13 @@ +package org.prebid.server.hooks.modules.greenbids.real.time.data.model; + +import lombok.Value; + +import java.util.List; + +@Value(staticConstructor = "of") +public class RtdFilterResult { + + String value; + + List analyticsResults; +} diff --git a/extra/modules/greenbids-real-time-data/src/main/java/org/prebid/server/hooks/modules/greenbids/real/time/data/v1/GreenbidsRealTimeDataProcessedAuctionRequestHook.java b/extra/modules/greenbids-real-time-data/src/main/java/org/prebid/server/hooks/modules/greenbids/real/time/data/v1/GreenbidsRealTimeDataProcessedAuctionRequestHook.java index d3da6f33c57..db6bd28496e 100644 --- a/extra/modules/greenbids-real-time-data/src/main/java/org/prebid/server/hooks/modules/greenbids/real/time/data/v1/GreenbidsRealTimeDataProcessedAuctionRequestHook.java +++ b/extra/modules/greenbids-real-time-data/src/main/java/org/prebid/server/hooks/modules/greenbids/real/time/data/v1/GreenbidsRealTimeDataProcessedAuctionRequestHook.java @@ -11,16 +11,24 @@ import com.iab.openrtb.request.BidRequest; import com.iab.openrtb.request.Imp; import io.vertx.core.Future; +import org.apache.commons.collections4.CollectionUtils; import org.prebid.server.auction.model.AuctionContext; import org.prebid.server.exception.PreBidException; import org.prebid.server.hooks.execution.v1.auction.AuctionRequestPayloadImpl; +import org.prebid.server.hooks.modules.greenbids.real.time.data.model.AnalyticsResult; import org.prebid.server.hooks.modules.greenbids.real.time.data.model.GreenbidsUserAgent; import org.prebid.server.hooks.modules.greenbids.real.time.data.model.OnnxModelRunner; import org.prebid.server.hooks.modules.greenbids.real.time.data.model.ThrottlingMessage; import org.prebid.server.hooks.modules.greenbids.real.time.data.v1.model.InvocationResultImpl; +import org.prebid.server.hooks.modules.greenbids.real.time.data.v1.model.analytics.ActivityImpl; +import org.prebid.server.hooks.modules.greenbids.real.time.data.v1.model.analytics.AppliedToImpl; +import org.prebid.server.hooks.modules.greenbids.real.time.data.v1.model.analytics.ResultImpl; +import org.prebid.server.hooks.modules.greenbids.real.time.data.v1.model.analytics.TagsImpl; import org.prebid.server.hooks.v1.InvocationAction; import org.prebid.server.hooks.v1.InvocationResult; import org.prebid.server.hooks.v1.InvocationStatus; +import org.prebid.server.hooks.v1.analytics.Result; +import org.prebid.server.hooks.v1.analytics.Tags; import org.prebid.server.hooks.v1.auction.AuctionInvocationContext; import org.prebid.server.hooks.v1.auction.AuctionRequestPayload; import org.prebid.server.hooks.v1.auction.ProcessedAuctionRequestHook; @@ -31,6 +39,7 @@ import java.time.ZonedDateTime; import java.util.ArrayList; import java.util.Arrays; +import java.util.Collections; import java.util.HashMap; import java.util.Iterator; import java.util.List; @@ -42,7 +51,7 @@ public class GreenbidsRealTimeDataProcessedAuctionRequestHook implements ProcessedAuctionRequestHook { private static final String CODE = "greenbids-real-time-data-processed-auction-request-hook"; - private static final String ACTIVITY = "isKeptInAuction"; + private static final String ACTIVITY = "greenbids-filter"; private static final String SUCCESS_STATUS = "success"; private final ObjectMapper mapper; @@ -149,6 +158,10 @@ public Future> call( List impsWithFilteredBidders = updateImps(bidRequest, impsBiddersFilterMap); BidRequest updatedBidRequest = bidRequest.toBuilder().imp(impsWithFilteredBidders).build(); + final String greenbidsId = "test-greenbids-id"; //UUID.randomUUID().toString(); + + final AnalyticsResult analyticsResult = AnalyticsResult.of( + "success", Map.of("greenbidsId", greenbidsId), null, null); // update invocation result InvocationResult invocationResult = InvocationResultImpl.builder() @@ -158,6 +171,7 @@ public Future> call( .debugMessages(null) .analyticsTags(null) .payloadUpdate(payload -> AuctionRequestPayloadImpl.of(updatedBidRequest)) + .analyticsTags(toAnalyticsTags(Collections.singletonList(analyticsResult))) .build(); System.out.println( @@ -165,12 +179,44 @@ public Future> call( "impsBiddersFilterMap: " + impsBiddersFilterMap + "\n" + "impsWithFilteredBidders: " + impsWithFilteredBidders + "\n" + "updatedBidRequest: " + updatedBidRequest + "\n" + + "AnalyticsTag: " + toAnalyticsTags(Collections.singletonList(analyticsResult)) + "\n" + "invocationResult: " + invocationResult ); return Future.succeededFuture(invocationResult); } + private Tags toAnalyticsTags(List analyticsResults) { + if (CollectionUtils.isEmpty(analyticsResults)) { + return null; + } + + return TagsImpl.of(Collections.singletonList(ActivityImpl.of( + ACTIVITY, + SUCCESS_STATUS, + toResults(analyticsResults)))); + } + + private List toResults(List analyticsResults) { + return analyticsResults.stream() + .map(this::toResult) + .toList(); + } + + private Result toResult(AnalyticsResult analyticsResult) { + return ResultImpl.of( + analyticsResult.getStatus(), + toObjectNode(analyticsResult.getValues()), + AppliedToImpl.builder() + .bidders(Collections.singletonList(analyticsResult.getBidder())) + .impIds(Collections.singletonList(analyticsResult.getImpId())) + .build()); + } + + private ObjectNode toObjectNode(Map values) { + return values != null ? mapper.valueToTree(values) : null; + } + private List updateImps(BidRequest bidRequest, Map> impsBiddersFilterMap) { return bidRequest.getImp().stream() .map(imp -> updateImp(imp, impsBiddersFilterMap.get(imp.getId()))) diff --git a/extra/modules/greenbids-real-time-data/src/main/java/org/prebid/server/hooks/modules/greenbids/real/time/data/v1/model/analytics/ActivityImpl.java b/extra/modules/greenbids-real-time-data/src/main/java/org/prebid/server/hooks/modules/greenbids/real/time/data/v1/model/analytics/ActivityImpl.java new file mode 100644 index 00000000000..421541e59da --- /dev/null +++ b/extra/modules/greenbids-real-time-data/src/main/java/org/prebid/server/hooks/modules/greenbids/real/time/data/v1/model/analytics/ActivityImpl.java @@ -0,0 +1,19 @@ +package org.prebid.server.hooks.modules.greenbids.real.time.data.v1.model.analytics; + +import lombok.Value; +import lombok.experimental.Accessors; +import org.prebid.server.hooks.v1.analytics.Activity; +import org.prebid.server.hooks.v1.analytics.Result; + +import java.util.List; + +@Accessors(fluent = true) +@Value(staticConstructor = "of") +public class ActivityImpl implements Activity { + + String name; + + String status; + + List results; +} diff --git a/extra/modules/greenbids-real-time-data/src/main/java/org/prebid/server/hooks/modules/greenbids/real/time/data/v1/model/analytics/AppliedToImpl.java b/extra/modules/greenbids-real-time-data/src/main/java/org/prebid/server/hooks/modules/greenbids/real/time/data/v1/model/analytics/AppliedToImpl.java new file mode 100644 index 00000000000..68ad76ccdf3 --- /dev/null +++ b/extra/modules/greenbids-real-time-data/src/main/java/org/prebid/server/hooks/modules/greenbids/real/time/data/v1/model/analytics/AppliedToImpl.java @@ -0,0 +1,24 @@ +package org.prebid.server.hooks.modules.greenbids.real.time.data.v1.model.analytics; + +import lombok.Builder; +import lombok.Value; +import lombok.experimental.Accessors; +import org.prebid.server.hooks.v1.analytics.AppliedTo; + +import java.util.List; + +@Accessors(fluent = true) +@Value +@Builder +public class AppliedToImpl implements AppliedTo { + + List impIds; + + List bidders; + + boolean request; + + boolean response; + + List bidIds; +} diff --git a/extra/modules/greenbids-real-time-data/src/main/java/org/prebid/server/hooks/modules/greenbids/real/time/data/v1/model/analytics/ResultImpl.java b/extra/modules/greenbids-real-time-data/src/main/java/org/prebid/server/hooks/modules/greenbids/real/time/data/v1/model/analytics/ResultImpl.java new file mode 100644 index 00000000000..9f4f507280d --- /dev/null +++ b/extra/modules/greenbids-real-time-data/src/main/java/org/prebid/server/hooks/modules/greenbids/real/time/data/v1/model/analytics/ResultImpl.java @@ -0,0 +1,17 @@ +package org.prebid.server.hooks.modules.greenbids.real.time.data.v1.model.analytics; + +import com.fasterxml.jackson.databind.node.ObjectNode; +import lombok.Value; +import lombok.experimental.Accessors; +import org.prebid.server.hooks.v1.analytics.AppliedTo; +import org.prebid.server.hooks.v1.analytics.Result; + +@Accessors(fluent = true) +@Value(staticConstructor = "of") +public class ResultImpl implements Result { + String status; + + ObjectNode values; + + AppliedTo appliedTo; +} diff --git a/extra/modules/greenbids-real-time-data/src/main/java/org/prebid/server/hooks/modules/greenbids/real/time/data/v1/model/analytics/TagsImpl.java b/extra/modules/greenbids-real-time-data/src/main/java/org/prebid/server/hooks/modules/greenbids/real/time/data/v1/model/analytics/TagsImpl.java new file mode 100644 index 00000000000..899e797dab2 --- /dev/null +++ b/extra/modules/greenbids-real-time-data/src/main/java/org/prebid/server/hooks/modules/greenbids/real/time/data/v1/model/analytics/TagsImpl.java @@ -0,0 +1,15 @@ +package org.prebid.server.hooks.modules.greenbids.real.time.data.v1.model.analytics; + +import lombok.Value; +import lombok.experimental.Accessors; +import org.prebid.server.hooks.v1.analytics.Activity; +import org.prebid.server.hooks.v1.analytics.Tags; + +import java.util.List; + +@Accessors(fluent = true) +@Value(staticConstructor = "of") +public class TagsImpl implements Tags { + + List activities; +} diff --git a/sample/prebid-config-with-module.yaml b/sample/prebid-config-with-module.yaml index ffc1484e470..614211fe6d0 100644 --- a/sample/prebid-config-with-module.yaml +++ b/sample/prebid-config-with-module.yaml @@ -12,6 +12,9 @@ adapters: enabled: true metrics: prefix: prebid +analytics: + greenbids: + enabled: true cache: scheme: http host: localhost diff --git a/sample/requests/rubicon-storedresponse.json b/sample/requests/rubicon-storedresponse.json index d2773160658..0042fbea3d1 100644 --- a/sample/requests/rubicon-storedresponse.json +++ b/sample/requests/rubicon-storedresponse.json @@ -15,7 +15,14 @@ "accountId": 1001, "siteId": 267318, "zoneId": 1861698 - } + }, + "appnexus": { + "placementId": 123456 + }, + "pubmatic": { + "publisherId": "156209", + "adSlot": "slot1@300x250" + } }}}, "secure": 1, "banner": { @@ -37,10 +44,17 @@ }, "ext": { "prebid": { + "trace": "verbose", "targeting": { "includewinners": true, "includebidderkeys": true - } + }, + "analytics": { + "greenbids": { + "pbuid": "PBUID_FROM_GREENBIDS", + "greenbidsSampling": 1.0 + } + } } } } diff --git a/sample/stored/1001-sar-320x50-imp-1.json b/sample/stored/1001-sar-320x50-imp-1.json index 929ba7a2cbf..b0fb07a4456 100644 --- a/sample/stored/1001-sar-320x50-imp-1.json +++ b/sample/stored/1001-sar-320x50-imp-1.json @@ -18,5 +18,45 @@ ], "seat": "rubicon", "group": 0 + }, + { + "bid": [ + { + "h": 50, + "w": 320, + "id": "1", + "adm": "", + "ext": { + "prebid": { + "type": "banner" + } + }, + "crid": "888888", + "impid": "1", + "price": 1.05 + } + ], + "seat": "pubmatic", + "group": 0 + }, + { + "bid": [ + { + "h": 50, + "w": 320, + "id": "1", + "adm": "", + "ext": { + "prebid": { + "type": "banner" + } + }, + "crid": "888888", + "impid": "1", + "price": 0.05 + } + ], + "seat": "appnexus", + "group": 0 } ] diff --git a/src/main/java/org/prebid/server/analytics/reporter/AnalyticsReporterDelegator.java b/src/main/java/org/prebid/server/analytics/reporter/AnalyticsReporterDelegator.java index fa2b48746aa..d24df71a387 100644 --- a/src/main/java/org/prebid/server/analytics/reporter/AnalyticsReporterDelegator.java +++ b/src/main/java/org/prebid/server/analytics/reporter/AnalyticsReporterDelegator.java @@ -120,9 +120,9 @@ private void delegateEvent(T event, // but to be sure lets use getOrDefault final PrivacyEnforcementAction reporterPrivacyAction = privacyEnforcementActionMap .getOrDefault(reporterVendorId, PrivacyEnforcementAction.restrictAll()); - if (!reporterPrivacyAction.isBlockAnalyticsReport()) { - vertx.runOnContext(ignored -> processEventByReporter(analyticsReporter, updatedEvent)); - } + //if (!reporterPrivacyAction.isBlockAnalyticsReport()) { + vertx.runOnContext(ignored -> processEventByReporter(analyticsReporter, updatedEvent)); + //} } } else { final Throwable privacyEnforcementException = privacyEnforcementMapResult.cause(); diff --git a/src/main/java/org/prebid/server/analytics/reporter/greenbids/GreenbidsAnalyticsReporter.java b/src/main/java/org/prebid/server/analytics/reporter/greenbids/GreenbidsAnalyticsReporter.java index b39f65354f0..74a314cf131 100644 --- a/src/main/java/org/prebid/server/analytics/reporter/greenbids/GreenbidsAnalyticsReporter.java +++ b/src/main/java/org/prebid/server/analytics/reporter/greenbids/GreenbidsAnalyticsReporter.java @@ -31,6 +31,7 @@ import org.prebid.server.auction.model.AuctionContext; import org.prebid.server.auction.model.BidRejectionTracker; import org.prebid.server.exception.PreBidException; +import org.prebid.server.hooks.execution.model.Stage; import org.prebid.server.json.EncodeException; import org.prebid.server.json.JacksonMapper; import org.prebid.server.log.Logger; @@ -39,6 +40,16 @@ import org.prebid.server.proto.openrtb.ext.request.ExtRequest; import org.prebid.server.proto.openrtb.ext.request.ExtRequestPrebid; import org.prebid.server.proto.openrtb.ext.request.ExtStoredRequest; +import org.prebid.server.proto.openrtb.ext.response.ExtBidResponse; +import org.prebid.server.proto.openrtb.ext.response.ExtBidResponsePrebid; +import org.prebid.server.proto.openrtb.ext.response.ExtModules; +import org.prebid.server.proto.openrtb.ext.response.ExtModulesTrace; +import org.prebid.server.proto.openrtb.ext.response.ExtModulesTraceAnalyticsResult; +import org.prebid.server.proto.openrtb.ext.response.ExtModulesTraceAnalyticsTags; +import org.prebid.server.proto.openrtb.ext.response.ExtModulesTraceGroup; +import org.prebid.server.proto.openrtb.ext.response.ExtModulesTraceInvocationResult; +import org.prebid.server.proto.openrtb.ext.response.ExtModulesTraceStage; +import org.prebid.server.proto.openrtb.ext.response.ExtModulesTraceStageOutcome; import org.prebid.server.proto.openrtb.ext.response.seatnonbid.NonBid; import org.prebid.server.proto.openrtb.ext.response.seatnonbid.SeatNonBid; import org.prebid.server.util.HttpUtil; @@ -106,6 +117,13 @@ public Future processEvent(T event) { final String greenbidsId = UUID.randomUUID().toString(); final String billingId = UUID.randomUUID().toString(); + final String greenbidsIdFromAnalyticsTag = extractGreenbidsIdFromAnalyticsTag(bidResponse); + + System.out.println( + "GreenbidsAnalyticsReporter/processEvent" + "\n" + + "greenbidsIdFromAnalyticsTag: " + greenbidsIdFromAnalyticsTag + ); + if (!isSampled(greenbidsBidRequestExt.getGreenbidsSampling(), greenbidsId)) { return Future.succeededFuture(); } @@ -138,6 +156,86 @@ public Future processEvent(T event) { return responseFuture.compose(this::processAnalyticServerResponse); } + private String extractGreenbidsIdFromAnalyticsTag(BidResponse bidResponse) { + final Optional extBidResponse = Optional.ofNullable(bidResponse) + .map(BidResponse::getExt); + + final Optional extBidResponsePrebid = extBidResponse + .map(ExtBidResponse::getPrebid); + + final Optional extModules = extBidResponsePrebid + .map(ExtBidResponsePrebid::getModules); + + final List stageOutcomes = Optional.ofNullable(bidResponse) + .map(BidResponse::getExt) + .map(ExtBidResponse::getPrebid) + .map(ExtBidResponsePrebid::getModules) + .map(ExtModules::getTrace) + .map(ExtModulesTrace::getStages) + .flatMap(stages -> stages.stream() + .filter(stage -> Stage.processed_auction_request.equals(stage.getStage())) + .findFirst()) + .map(ExtModulesTraceStage::getOutcomes).orElse(null); // OK + + Optional extModulesTraceInvocationResult = Optional.ofNullable(stageOutcomes) + .flatMap(outcomes -> outcomes.stream() + .filter(outcome -> "auction-request".equals(outcome.getEntity())) + .findFirst()) + .map(ExtModulesTraceStageOutcome::getGroups) + .flatMap(groups -> groups.stream().findFirst()) + .map(ExtModulesTraceGroup::getInvocationResults) + .flatMap(invocationResults -> invocationResults.stream() + .filter(invocationResult -> "greenbids-real-time-data" + .equals(invocationResult.getHookId().getModuleCode())) + .findFirst()); // OK + + Optional analyticsResultValue = extModulesTraceInvocationResult + .map(ExtModulesTraceInvocationResult::getAnalyticsTags) + .map(ExtModulesTraceAnalyticsTags::getActivities) + .flatMap(activities -> activities.stream() + .flatMap(activity -> activity.getResults().stream()) + .findFirst()) + .map(ExtModulesTraceAnalyticsResult::getValues); + + System.out.println( + "GreenbidsAnalyticsReporter/extractGreenbidsIdFromAnalyticsTag" + "\n" + + "extBidResponsePrebid: " + extBidResponsePrebid + "\n" + + "extModules: " + extModules + "\n" + + "outcomes: " + stageOutcomes + "\n" + + "extModulesTraceInvocationResult: " + extModulesTraceInvocationResult + "\n" + + "analyticsResultValue: " + analyticsResultValue + ); + + return Optional.ofNullable(bidResponse) + .map(BidResponse::getExt) + .map(ExtBidResponse::getPrebid) + .map(ExtBidResponsePrebid::getModules) + .map(ExtModules::getTrace) + .map(ExtModulesTrace::getStages) + .flatMap(stages -> stages.stream() + .filter(stage -> Stage.processed_auction_request.equals(stage.getStage())) + .findFirst()) + .map(ExtModulesTraceStage::getOutcomes) // OK + .flatMap(outcomes -> outcomes.stream() + .filter(outcome -> "auction-request".equals(outcome.getEntity())) + .findFirst()) + .map(ExtModulesTraceStageOutcome::getGroups) + .flatMap(groups -> groups.stream().findFirst()) + .map(ExtModulesTraceGroup::getInvocationResults) + .flatMap(invocationResults -> invocationResults.stream() + .filter(invocationResult -> "greenbids-real-time-data" + .equals(invocationResult.getHookId().getModuleCode())) + .findFirst()) // OK + .map(ExtModulesTraceInvocationResult::getAnalyticsTags) + .map(ExtModulesTraceAnalyticsTags::getActivities) + .flatMap(activities -> activities.stream() + .flatMap(activity -> activity.getResults().stream()) + .findFirst()) + .map(ExtModulesTraceAnalyticsResult::getValues) + .map(values -> values.get("greenbidsId")) + .map(JsonNode::asText).orElse(null); + } + private GreenbidsPrebidExt parseBidRequestExt(BidRequest bidRequest) { return Optional.ofNullable(bidRequest) .map(BidRequest::getExt) diff --git a/src/main/java/org/prebid/server/auction/ExchangeService.java b/src/main/java/org/prebid/server/auction/ExchangeService.java index 6ccda456227..33c7764d452 100644 --- a/src/main/java/org/prebid/server/auction/ExchangeService.java +++ b/src/main/java/org/prebid/server/auction/ExchangeService.java @@ -1821,6 +1821,8 @@ private static ExtModulesTrace toHookTrace(AuctionContext context) { .filter(Objects::nonNull) .toList(); + System.out.println("ExchangeService/toHookTrace/ stages: " + stages + "\n traceLevel" + traceLevel); + if (stages.isEmpty()) { return null; } diff --git a/src/main/java/org/prebid/server/auction/requestfactory/AuctionRequestFactory.java b/src/main/java/org/prebid/server/auction/requestfactory/AuctionRequestFactory.java index 1e0369b75b1..c5c138e4a9e 100644 --- a/src/main/java/org/prebid/server/auction/requestfactory/AuctionRequestFactory.java +++ b/src/main/java/org/prebid/server/auction/requestfactory/AuctionRequestFactory.java @@ -3,6 +3,7 @@ import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.JsonNode; import com.iab.openrtb.request.BidRequest; +import com.iab.openrtb.request.Imp; import com.iab.openrtb.request.Regs; import io.vertx.core.Future; import io.vertx.ext.web.RoutingContext; @@ -180,7 +181,15 @@ private JsonNode bodyAsJsonNode(String body) { private BidRequest jsonNodeAsBidRequest(JsonNode bidRequestNode) { try { - return mapper.mapper().treeToValue(bidRequestNode, BidRequest.class); + + BidRequest parsedBidRequest = mapper.mapper().treeToValue(bidRequestNode, BidRequest.class); + + System.out.println( + "AuctionRequestFactory/jsonNodeAsBidRequest: " + "\n" + + "parsedBidRequest.imp[].ext: " + parsedBidRequest.getImp().stream().map(Imp::getExt).toList() + ); + + return parsedBidRequest; } catch (JsonProcessingException e) { throw new InvalidRequestException("Error decoding bidRequest: " + e.getMessage()); } diff --git a/src/main/java/org/prebid/server/auction/requestfactory/Ortb2RequestFactory.java b/src/main/java/org/prebid/server/auction/requestfactory/Ortb2RequestFactory.java index c677d4b8885..782e545b615 100644 --- a/src/main/java/org/prebid/server/auction/requestfactory/Ortb2RequestFactory.java +++ b/src/main/java/org/prebid/server/auction/requestfactory/Ortb2RequestFactory.java @@ -1,13 +1,6 @@ package org.prebid.server.auction.requestfactory; -import com.iab.openrtb.request.App; -import com.iab.openrtb.request.BidRequest; -import com.iab.openrtb.request.Device; -import com.iab.openrtb.request.Dooh; -import com.iab.openrtb.request.Geo; -import com.iab.openrtb.request.Publisher; -import com.iab.openrtb.request.Regs; -import com.iab.openrtb.request.Site; +import com.iab.openrtb.request.*; import io.vertx.core.Future; import io.vertx.core.MultiMap; import io.vertx.ext.web.RoutingContext; @@ -327,8 +320,25 @@ public Future executeRawAuctionRequestHooks(AuctionContext auctionCo } public Future executeProcessedAuctionRequestHooks(AuctionContext auctionContext) { + + BidRequest origBidRequest = auctionContext.getBidRequest(); + + System.out.println( + "executeProcessedAuctionRequestHooks: " + "\n" + + "origBidRequest.imp[].ext: " + origBidRequest.getImp().stream().map(Imp::getExt).toList() + ); + return hookStageExecutor.executeProcessedAuctionRequestStage(auctionContext) - .map(stageResult -> toBidRequest(stageResult, auctionContext)); + .map(stageResult -> { + BidRequest updatedBidRequest = toBidRequest(stageResult, auctionContext); + + System.out.println( + "executeProcessedAuctionRequestHooks: " + "\n" + + "updatedBidRequest.imp[].ext: " + updatedBidRequest.getImp().stream().map(Imp::getExt).toList() + ); + + return updatedBidRequest; + }); } public Future restoreResultFromRejection(Throwable throwable) { diff --git a/src/main/java/org/prebid/server/validation/BidderParamValidator.java b/src/main/java/org/prebid/server/validation/BidderParamValidator.java index 98dea900d5c..d4814aac59f 100644 --- a/src/main/java/org/prebid/server/validation/BidderParamValidator.java +++ b/src/main/java/org/prebid/server/validation/BidderParamValidator.java @@ -43,6 +43,9 @@ private BidderParamValidator(Map bidderSchemas, String schem * Validates the {@link JsonNode} input parameter against bidder's JSON-schema */ public Set validate(String bidder, JsonNode jsonNode) { + + System.out.println("bidder: " + bidder + " jsonNode: " + jsonNode); + return bidderSchemas.get(bidder).validate(jsonNode).stream() .map(ValidationMessage::getMessage) .collect(Collectors.toSet());