prebid / prebid-server

Open-source solution for running real-time advertising auctions in the cloud.
https://prebid.org/product-suite/prebid-server/
Apache License 2.0
436 stars 744 forks source link

Implementation Plan For Seat Non Bid Status Codes #2852

Open ShriprasadM opened 1 year ago

ShriprasadM commented 1 year ago

Following is the list of some seat non-bid error codes as per IAB community extension. I am working on mapping of other remaining error codes. But, by that time @SyntaxNode , @bretg , @bsardo please review following table and confirm if locations mentioned under PBS Source Code column are correct for capturing seat non bid scenarios.

SEAT NON BID ERROR CODE PBS Source Code
100 (Error - General)per bidder https://github.com/prebid/prebid-server/blob/79422a7542634b356f9c13d7774117f2b818e996/exchange/bidder.go#L137 https://github.com/prebid/prebid-server/blob/79422a7542634b356f9c13d7774117f2b818e996/exchange/bidder.go#L534 The adapter failed to generate any bid requests, but also failed to generate an error explaining why.
101(Error - Timeout)per bidder https://github.com/prebid/prebid-server/blob/79422a7542634b356f9c13d7774117f2b818e996/exchange/bidder.go#L137 https://github.com/prebid/prebid-server/blob/79422a7542634b356f9c13d7774117f2b818e996/exchange/bidder.go#L534 bidder.doRequestImpl
102 (Error - Invalid Bid Response)per bidder https://github.com/prebid/prebid-server/blob/79422a7542634b356f9c13d7774117f2b818e996/exchange/bidder.go#L565 bidder.doRequestImpl  if httpStatusCode >= 500 and httpStatusCode != 503(Current implementation is Bad Server Response Error if httpResp.StatusCode < 200 || httpResp.StatusCode >= 400.  )
103 (Error - Bidder Unreachable)per bidder https://github.com/prebid/prebid-server/blob/79422a7542634b356f9c13d7774117f2b818e996/exchange/bidder.go#L565bidder.doRequestImpl  if httpStatusCode = 503
201 (Request Blocked - Unsupported Channel (app/site/dooh))per bidder https://github.com/prebid/prebid-server/blob/79422a7542634b356f9c13d7774117f2b818e996/adapters/infoawarebidder.go#L40 https://github.com/prebid/prebid-server/blob/79422a7542634b356f9c13d7774117f2b818e996/adapters/infoawarebidder.go#L46
202 (Request Blocked - Unsupported Media Type (banner/video/native/audio)) https://github.com/prebid/prebid-server/blob/79422a7542634b356f9c13d7774117f2b818e996/adapters/infoawarebidder.go#L60
203 (Request Blocked - Optimized)  
204 (Request Blocked - Privacy) https://github.com/prebid/prebid-server/blob/79422a7542634b356f9c13d7774117f2b818e996/exchange/utils.go#L170GDPR request blocked
301 (Response Rejected - Below Floor) https://github.com/prebid/prebid-server/blob/79422a7542634b356f9c13d7774117f2b818e996/exchange/exchange.go#L388
304 (Response Rejected - Below Deal Floor) TBD
hhhjort commented 1 year ago

In exchange/bidder.go, I would say line 137 maps best to 100 (General) and line 534 to 101 (Timeout). Line 565 is correct as 102 (Invalid response).

The infoawarebidder.go errors all look correct.

The exchange/utils.go line looks correct, but will be refactored for the upcoming privacy framework.

The exchange/exchange.go is correct.

I have not had time to go through the code to verify if there are any other areas where bids may be rejected.

ShriprasadM commented 1 year ago

Thanks @hhhjort for an update. Can you review 103 (Error - Bidder Unreachable)per bidder

hhhjort commented 1 year ago

Oh, sorry, missed that one. 103 seems reasonable for a 503 error code.

bretg commented 1 year ago

Are we good here @ShriprasadM ?

ShriprasadM commented 1 year ago

@bretg : I have started on some error codes. I am facing few challenges while implementing. How to obtain impId in bidder.go.

reqData, errs = bidder.Bidder.MakeRequests(bidderRequest.BidRequest, reqInfo)

how can we determine if array of reqData contains separate req per impression or on single request contains multi impression objects?

bretg commented 1 year ago

Closing this issue as covered by the new issue https://github.com/prebid/prebid-server/issues/2973

ShriprasadM commented 1 year ago

@bretg : Can we reopen this issue ? I had created this issue to add all seat non bid error codes mentioned here - https://github.com/InteractiveAdvertisingBureau/openrtb/blob/master/extensions/community_extensions/seat-non-bid.md#list-non-bid-status-codes The current PR only addressing timeout related error code

SyntaxNode commented 1 year ago

Re-opening. This issue is a discussion on how to implement non bid status codes in PBS-Go. This is separate and disinct from https://github.com/prebid/prebid-server/issues/2973 which solves a specific problem of attributing network failures to impression ids.

ashishshinde-pubm commented 1 year ago
Sr No SEAT NON BID ERROR CODE PBS Source Code
1 351: Response Rejected - Invalid Creative (Size Not Allowed) https://github.com/prebid/prebid-server/blob/79422a7542634b356f9c13d7774117f2b818e996/exchange/exchange.go#L1226
2 352: Response Rejected - Invalid Creative (Not Secure) https://github.com/prebid/prebid-server/blob/79422a7542634b356f9c13d7774117f2b818e996/exchange/exchange.go#L1234
3 350: Response Rejected - Invalid Creative https://github.com/prebid/prebid-server/blob/79422a7542634b356f9c13d7774117f2b818e996/modules/prebid/ortb2blocking/hook_raw_bidder_response.go#L72
4 300- Response Rejected - General https://github.com/prebid/prebid-server/blob/79422a7542634b356f9c13d7774117f2b818e996/exchange/bidder_validate_bids.go#L63
5 300: Response Rejected - General https://github.com/prebid/prebid-server/blob/79422a7542634b356f9c13d7774117f2b818e996/exchange/bidder.go#L329
6 100-Error - General https://github.com/prebid/prebid-server/blob/79422a7542634b356f9c13d7774117f2b818e996/exchange/bidder.go#L373
ashishshinde-pubm commented 1 year ago

@SyntaxNode , @bretg , @bsardo please review above table and confirm if locations mentioned under PBS Source Code column are correct for capturing seat non bid scenarios.

For point (3) in above table, we have few queries regarding ortb2blocking module.

  1. What if one creative gets rejected with multiple reasons (example - if same bid is rejected due to both bcat and badv) then should we log multiple reasons in seat-non-bid ? if we have to log single record then which one to prioritise? Do you think adding errmessage in non-bid structure would be helpful and can handle such use-cases by providing granular information ?

  2. Implementation approach - How module should report non-bids rejected in module to PBS source code ? 2.1 Introduce seatNonBids under HookOutcome ? 2.2 Use hookanalytics.Analytics present in HookOutcome ? --> we might need to ask module developer to return rejected bids using specific Activity.Name 2.3 How to handle the case, where same bid can get rejected in multiple modules due to different reasons ? Should we add multiple records in seat-non-bid ? if not then which one to prioritise ?

bretg commented 1 year ago

Should we add multiple records in seat-non-bid ? if not then which one to prioritise ?

If there are multiple reasons, pick one -- any one. The idea is that someone will fix one of the issues and then the next one will appear.

If you're looking for an algorithm to pick, then we would suggest choosing the lowest numbered seatnonbid code.

bsardo commented 1 year ago

Hi @ashishshinde-pubm, I agree with all of the locations for capturing the specified non bid error codes except for (3) where you’re proposing we return 350 when the ortb2blocking module detects an error in the raw bidder response hook. Instead, I think we may want to return 356 (Response Rejected - Invalid Creative - Advertiser Blocked) if the ortb2blocking module config was loaded from the account config and 350 (Response Rejected - Invalid Creative) if the config was loaded from the host config. Thoughts?

ashishshinde-pubm commented 1 year ago

Hi @bsardo , For point (3) the bid may get rejected due to any reason (badv/bcat/cattax/battr) that's why I was thinking to provide the generic NBR (350 (Response Rejected - Invalid Creative)). Do you see any difference between config loaded from account-config vs config loaded from host-config ?

ashishshinde-pubm commented 11 months ago

As discussed in the bi-weekly meeting, we should return code 356 (Response Rejected - Invalid Creative - Advertiser Blocked) if bid gets rejected due to "badv" field. For other rejection due to bcat/cattax/battr, we can return generic code 350 (Response Rejected - Invalid Creative).

bsardo commented 11 months ago

As discussed, we also should not care whether the config was loaded from the host or the account as I had originally mentioned. The behavior should be same in both cases.

bretg commented 3 months ago

@ShriprasadM , @bsardo - is the "plan" part of this done? I thought we were well into implementation at this point?