Skip to content
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

Add bidder level toggle for alternatebiddercodes config #2326

Conversation

pm-nilesh-chate
Copy link
Contributor

@pm-nilesh-chate pm-nilesh-chate commented Jul 26, 2022

This change introduces bidder level toggle in alternatebiddercodes config #2174 (similar to that in PBJS).
The bidder level toggle needs to be explicitly enabled with below config combinations (pfa).

pbs alternatebiddercodes config 2

Old pbs.yaml example:

 account_defaults:
   alternatebiddercodes:
     enabled: true
     bidders:
       pubmatic:
         allowedbiddercodes: [groupm]
       appnexus:
         allowedbiddercodes: [*]

New pbs.yaml example:

 account_defaults:
   alternatebiddercodes:
     enabled: true
     bidders:
       pubmatic:
         enabled: true
         allowedbiddercodes: [groupm]
       appnexus:
         enabled: true
         allowedbiddercodes: [*]

@pm-nilesh-chate
Copy link
Contributor Author

Should we handle whitespaces, case-sensitivity, etc for the allowedbiddercodes values.

@pm-nilesh-chate pm-nilesh-chate marked this pull request as ready for review July 26, 2022 10:36
@bsardo bsardo self-requested a review July 26, 2022 14:20
@bsardo bsardo self-assigned this Jul 26, 2022
@SyntaxNode SyntaxNode self-requested a review July 26, 2022 15:17
@SyntaxNode SyntaxNode self-assigned this Jul 26, 2022
SyntaxNode
SyntaxNode previously approved these changes Jul 28, 2022
@SyntaxNode
Copy link
Contributor

Should we handle whitespaces, case-sensitivity, etc for the allowedbiddercodes values.

I wouldn't worry about whitespace. However, I wouldn't mind chatting about case sensitivity. Right now, we are across the board case sensitive for bidder names/codes. Is this the right behavior? I'm less certain.

return false, fmt.Errorf("alternateBidderCodes disabled for %q, rejecting bids for %q", bidder, alternateBidder)
}

if adapterCfg.AllowedBidderCodes[0] == "*" {
if len(adapterCfg.AllowedBidderCodes) == 0 || adapterCfg.AllowedBidderCodes[0] == "*" {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be if adapterCfg.AllowedBidderCodes == nil || as I would expect an explicitly defined empty array to mean that all bidder codes are not allowed while the absence of the array would mean allow all. I raised the question here: #2174 (comment)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this would defeat the purpose of bidder level alternatebiddercodes.bidders.BIDDER.enabled flag. User can simply set it false to disable and true to enable. Just that empty array would be one of the corner case under bidder level flag enabled. Wonder, why would user set bidder level flag enabled and then define empty array to reject all the bidder codes instead of simply setting the bidder level flag false.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see your point but I think this behavior is counter intuitive. If an array is defined then only the items in it should be allowed. If for some reason the host decides to define the array but they leave it empty it is probably a mistake, in which case I think the restrict all behavior makes sense since we would be erring on the side of caution rather than allowing all alternate bidder codes. I confirmed this behavior with Bret on the corresponding issue.

Copy link
Contributor Author

@pm-nilesh-chate pm-nilesh-chate Aug 1, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated the code. I hope this behaviour is similar in PBJS aswell.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left a comment here prebid/Prebid.js#8760 (comment) to ensure that the behavior is the same for both.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Catching on this thread, I disagree with @bsardo on this point. I prefer the original implementation where an empty list is treated the same as a nil list. Otherwise, I believe we're leaning too much on the config system for how to represent the two concepts. I could easily forsee one account fetcher returning nil and another returning empty for the same concept.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pm-nilesh-chate please hold while we figure out what to do here 🙂

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, I'll wait until this discussion is concluded. Whatever the outcome is, I would prefer to have similar behaviour in both the PBS and PBJS (fyi, PBJS change has been merged prebid/Prebid.js#8760 (comment)).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll leave it as is, especially since PBJS already made the same change.

config/accounts.go Outdated Show resolved Hide resolved
config/accounts_test.go Outdated Show resolved Hide resolved
config/accounts.go Outdated Show resolved Hide resolved
return false, fmt.Errorf("alternateBidderCodes disabled for %q, rejecting bids for %q", bidder, alternateBidder)
}

if adapterCfg.AllowedBidderCodes[0] == "*" {
if len(adapterCfg.AllowedBidderCodes) == 0 || adapterCfg.AllowedBidderCodes[0] == "*" {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left a comment here prebid/Prebid.js#8760 (comment) to ensure that the behavior is the same for both.

Copy link
Collaborator

@bsardo bsardo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

fields: fields{
Enabled: true,
Bidders: map[string]AdapterAlternateBidderCodes{
"pubmatic": {Enabled: true},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick: I recommend using the following declaration to make it clear to the reader this is the case for a nil AllowedBidderCodes:

"pubmatic": {
    Enabled:            true,
    AllowedBidderCodes: nil
},

return false, fmt.Errorf("alternateBidderCodes disabled for %q, rejecting bids for %q", bidder, alternateBidder)
}

if adapterCfg.AllowedBidderCodes[0] == "*" {
if len(adapterCfg.AllowedBidderCodes) == 0 || adapterCfg.AllowedBidderCodes[0] == "*" {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Catching on this thread, I disagree with @bsardo on this point. I prefer the original implementation where an empty list is treated the same as a nil list. Otherwise, I believe we're leaning too much on the config system for how to represent the two concepts. I could easily forsee one account fetcher returning nil and another returning empty for the same concept.

@SyntaxNode SyntaxNode merged commit cdbd8be into prebid:master Aug 8, 2022
pm-aadit-patil pushed a commit to PubMatic-OpenWrap/prebid-server that referenced this pull request Sep 22, 2022
pm-aadit-patil pushed a commit to PubMatic-OpenWrap/prebid-server that referenced this pull request Sep 22, 2022
pm-aadit-patil pushed a commit to PubMatic-OpenWrap/prebid-server that referenced this pull request Sep 22, 2022
jorgeluisrocha pushed a commit to jwplayer/prebid-server that referenced this pull request Sep 28, 2022
@pm-nilesh-chate pm-nilesh-chate deleted the feature-2174-update-alternatebiddercodes-config branch October 8, 2022 04:04
shunj-nb pushed a commit to ParticleMedia/prebid-server that referenced this pull request Nov 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants