-
Notifications
You must be signed in to change notification settings - Fork 731
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
Initial RhythmOne Prebid Server Adapter #704
Conversation
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.
Looks really solid overall.
Only one serious issue... the JSON schema should be more strict to validate incoming params better. All my other comments are just pointing out extra logic which you don't need because the Prebid Server core logic already handles it for you elsewhere.
adapters/rhythmone/rhythmone.go
Outdated
) | ||
|
||
type RhythmoneAdapter struct { | ||
http *adapters.HTTPAdapter |
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.
This field is unused... it can be deleted.
adapters/rhythmone/rhythmone.go
Outdated
return "rhythmone" | ||
} | ||
|
||
func (a *RhythmoneAdapter) SkipNoCookies() bool { |
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.
Name() and SkipNoCookies() are legacy things... you don't need them.
adapters/rhythmone/rhythmone.go
Outdated
|
||
validImpDataExists := false | ||
|
||
for _, imp := range request.Imp { |
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.
You can delete this block. The adapters.EnforceBidderInfo()
call in adapter_map
makes sure your Imps have valid formats, according to your static/bidder-info/rhythmone.yaml
definitions.
adapters/rhythmone/rhythmone.go
Outdated
} | ||
} | ||
|
||
if !validImpDataExists { |
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.
Same here. This is guaranteed by the EnforceBidderInfo()
stuff.
adapters/rhythmone/rhythmone.go
Outdated
if imp.Audio != nil { | ||
continue | ||
} | ||
if imp.Native != nil { |
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.
These two blocks can go away... audio/native aren't possible.
adapters/rhythmone/rhythmone.go
Outdated
return mediaType | ||
} | ||
|
||
func NewRhythmoneAdapter(config *adapters.HTTPAdapterConfig, endpoint string) *RhythmoneAdapter { |
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.
This function is unused, and can be deleted.
exchange/adapter_map.go
Outdated
@@ -61,5 +62,6 @@ func newAdapterMap(client *http.Client, cfg *config.Configuration, infos adapter | |||
infos[string(openrtb_ext.BidderRubicon)]), client), | |||
openrtb_ext.BidderSomoaudience: adaptBidder(adapters.EnforceBidderInfo(somoaudience.NewSomoaudienceBidder(cfg.Adapters[string(openrtb_ext.BidderSomoaudience)].Endpoint), infos[string(openrtb_ext.BidderSomoaudience)]), client), | |||
openrtb_ext.BidderSovrn: adaptBidder(adapters.EnforceBidderInfo(sovrn.NewSovrnBidder(client, cfg.Adapters[string(openrtb_ext.BidderSovrn)].Endpoint), infos[string(openrtb_ext.BidderSovrn)]), client), | |||
openrtb_ext.BidderRhythmone: adaptBidder(adapters.EnforceBidderInfo(rhythmone.NewRhythmoneBidder(client, cfg.Adapters[string(openrtb_ext.BidderRhythmone)].Endpoint), infos[string(openrtb_ext.BidderRhythmone)]), client), |
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.
Alphabetize by key please.
openrtb_ext/bidders.go
Outdated
@@ -37,6 +37,7 @@ const ( | |||
BidderRubicon BidderName = "rubicon" | |||
BidderSomoaudience BidderName = "somoaudience" | |||
BidderSovrn BidderName = "sovrn" | |||
BidderRhythmone BidderName = "rhythmone" |
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.
alphabetize by key please
an := NewRhythmoneSyncer("https://sync.1rx.io/usersync2/rmphb?redir=", "localhost") | ||
syncInfo := an.GetUsersyncInfo("1", "BOPVK28OVJoTBABABAENBs-AAAAhuAKAANAAoACwAGgAPAAxAB0AHgAQAAiABOADkA") | ||
url := "https://sync.1rx.io/usersync2/rmphb?redir=localhost%2Fsetuid%3Fbidder%3Drhythmone%26gdpr%3D1%26gdpr_consent%3DBOPVK28OVJoTBABABAENBs-AAAAhuAKAANAAoACwAGgAPAAxAB0AHgAQAAiABOADkA%26uid%3D%5BRX_UUID%5D" | ||
assertStringsMatch(t, url, syncInfo.URL) |
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.
Use testify
for cleaner assertions: https://godoc.org/github.com/stretchr/testify/assert
assert.Equal()
should do the trick here.
Updated code review comments as per dbemiller. |
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.
One last unused param you should remove... otherwise LGTM
adapters/rhythmone/rhythmone.go
Outdated
return mediaType | ||
} | ||
|
||
func NewRhythmoneBidder(client *http.Client, endpoint string) *RhythmoneAdapter { |
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.
client
is unused... please remove it.
…er in NewRhythmoneBidder method
Review comments incorporated, please review. |
adapters/rhythmone/rhythmone.go
Outdated
func (a *RhythmoneAdapter) preProcess(req *openrtb.BidRequest, errors []error) (*openrtb.BidRequest, string, []error) { | ||
numRequests := len(req.Imp) | ||
|
||
requestImpCopy := req.Imp |
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.
Since req.Imp
is a slice, and a slice is essentially a pointer to an existing array structure, requestImpCopy := req.Imp
will end up referencing the same underlying array as req.Imp
So it is not a true copy.
You only seem to use reqestImpCopy
for imp := requestImpCopy[i]
, which will make imp
a copy shallow of the original imp
. So there does not seem to be a reason to define reqestImpCopy
.
@hhhjort - Review comments incorporated, please review. |
We have merge conflicts now |
35beb9e
DISREGARD Ack, looks like an older PR that just merged is what actually caused the conflicts, and the change shouldn't have merged. Not sure why git merged it that way, but we should be keeping |
Never mind the last comment, that change was a valid part of that PR, so it is needed. I just got a little confused. |
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 once merge conflicts are resolved.
* Initial RhythmOne Prebid Server Adapter * Updated UserSync URL * Fixed gofmt issue * Code review comments updated, UserSync URL updated * Updated code based on review comments - Removed unused client parameter in NewRhythmoneBidder method * Incorporated review comments * Updated adapter with resolved conflict
* Initial RhythmOne Prebid Server Adapter * Updated UserSync URL * Fixed gofmt issue * Code review comments updated, UserSync URL updated * Updated code based on review comments - Removed unused client parameter in NewRhythmoneBidder method * Incorporated review comments * Updated adapter with resolved conflict
* Initial RhythmOne Prebid Server Adapter * Updated UserSync URL * Fixed gofmt issue * Code review comments updated, UserSync URL updated * Updated code based on review comments - Removed unused client parameter in NewRhythmoneBidder method * Incorporated review comments * Updated adapter with resolved conflict
Initial RhythmOne Prebid Server Adapter support