prebid / prebid-server-java

Java version of Prebid Server
Apache License 2.0
66 stars 173 forks source link

Support for logging Outbound Bidder Request #3157

Open ghost opened 4 months ago

ghost commented 4 months ago

Problem: Http interaction Logger supports logging of bidder request before the changes are made by the corresponding request hooks and when the request is sent to the bidder. This creates the gap for logging the final bid request after if any changes are made by any adapter.

Proposed Solution: Expose a function from from the http interaction logger class that logs the final request object (similar to HttpInteractionLogger.java maybeLogBidderRequest: https://github.com/prebid/prebid-server-java/blob/42c5b41d5d9d075ecb793936680b2c4f4be305f5/src/main/java/org/prebid/server/log/HttpInteractionLogger.java#L82C17-L82C38).

The client to call this function can be placed in HttpBidderRequester.java (https://github.com/prebid/prebid-server-java/blob/42c5b41d5d9d075ecb793936680b2c4f4be305f5/src/main/java/org/prebid/server/bidder/HttpBidderRequester.java#L108). Stream over each http request and log the body of the final request that has been created by the adapter.

ghost commented 4 months ago

@bretg if the proposed solution seems acceptable, shall I pick up the implementation?

bretg commented 4 months ago

@b-chinmay - we don't fully understand what you're proposing. Is it that you essentially want to kick the system into debug mode when the http-interaction condition is met?

e.g. add a new flag to

https://prebid-server.example.com/logging/httpinteraction?limit=100&endpoint=auction&account=1111&debug=true

When debug=true is on the query string, the system could treat matched requests as if they had specified ext.prebid.debug:true, at least in the logs. This way we'd get not only the outbound requests but also the resolved request.

Ideally, this wouldn't affect the actual bid response.

ghost commented 4 months ago

@bretg that sounds about right.

bretg commented 4 months ago

Cool. Then we'd be happy to accept a pull request. Thanks.