-
Notifications
You must be signed in to change notification settings - Fork 769
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
Add bidder level toggle for alternatebiddercodes config #2326
Conversation
Should we handle whitespaces, case-sensitivity, etc for the |
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. |
config/accounts.go
Outdated
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] == "*" { |
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 🙂
There was a problem hiding this comment.
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)).
There was a problem hiding this comment.
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
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] == "*" { |
There was a problem hiding this comment.
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.
There was a problem hiding this 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}, |
There was a problem hiding this comment.
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
},
config/accounts.go
Outdated
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] == "*" { |
There was a problem hiding this comment.
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.
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).
Old pbs.yaml example:
New pbs.yaml example: