-
Notifications
You must be signed in to change notification settings - Fork 758
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
engagebdr adapter #966
engagebdr adapter #966
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.
Can you please address the issues with the Travis build?
yes. we are working on it.
…On Wed, Jul 17, 2019 at 3:24 PM guscarreon ***@***.***> wrote:
***@***.**** requested changes on this pull request.
Can you please address the issues with the Travis build?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#966?email_source=notifications&email_token=ACLJ7J7MQKIWWCFH7EYPBC3P76LYHA5CNFSM4IEUNCOKYY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOB6ZF6NA#pullrequestreview-263348020>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ACLJ7J2OBNTZ4VWUCZZKVX3P76LYHANCNFSM4IEUNCOA>
.
|
adapters/engagebdr/engagebdr.go
Outdated
"encoding/json" | ||
"github.com/prebid/prebid-server/openrtb_ext" | ||
"net/http" | ||
//"regexp" |
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.
Can you please remove this?
config/config.go
Outdated
@@ -613,6 +613,7 @@ func SetupViper(v *viper.Viper, filename string) { | |||
v.SetDefault("adapters.mgid.endpoint", "https://prebid.mgid.com/prebid/") | |||
v.SetDefault("adapters.visx.endpoint", "https://t.visx.net/s2s_bid?wrapperType=s2s_prebid_standard") | |||
v.SetDefault("adapters.tappx.endpoint", "https://{{.Host}}") | |||
v.SetDefault("adapters.engagebdr.endpoint", "http://dsp.bnmla.com/hb") |
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 should also set a default usersync endpoint in the setDerivedDefaults
function on L419
} | ||
sspidImps[impExt.Sspid] = append(sspidImps[impExt.Sspid], 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.
Just a suggestion: Since you're adapter only supports banner and video ads, might be a good idea to add a check somewhere here in this function to discard imps of any other type. I am sure this must be something that you'd be already handling on your end but it's always better to check and fail early.
@yannaingkyaw1986 pinging to see if you have had the chance to address the above comments |
yes. we will commit the update today.
…On Wed, Jul 24, 2019 at 7:11 AM Mansi Nahar ***@***.***> wrote:
@yannaingkyaw1986 <https://github.com/yannaingkyaw1986> pinging to see if
you have had the chance to address the above comments
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#966?email_source=notifications&email_token=ACLJ7J7ZCVQR3WZ6I5I2X6LQBBPIPA5CNFSM4IEUNCOKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD2WOVIY#issuecomment-514648739>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ACLJ7J55OCCWHMKVUZ6QYRLQBBPIPANCNFSM4IEUNCOA>
.
|
Cool. Thank you @yannaingkyaw1986! |
adapters/engagebdr/engagebdr.go
Outdated
// EngageBDR uses different sspid parameters for banner and video. | ||
sspidImps := make(map[string][]openrtb.Imp) | ||
for _, imp := range request.Imp { | ||
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.
Should this if condition be probably changed to if imp.Native != nil && imp.Site == nil && imp.App == nil
in case of possible multiformat requests?
LGTM other than the minor comment mentioned above |
exchange/adapter_map.go
Outdated
@@ -6,7 +6,7 @@ import ( | |||
"strings" | |||
|
|||
"github.com/prebid/prebid-server/adapters" | |||
ttx "github.com/prebid/prebid-server/adapters/33across" | |||
"github.com/prebid/prebid-server/adapters/33across" |
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.
Need to keep the ttx
part or you will break the line below that access the adapter by this alias
usersync/usersyncers/syncer.go
Outdated
@@ -5,7 +5,7 @@ import ( | |||
"text/template" | |||
|
|||
"github.com/golang/glog" | |||
ttx "github.com/prebid/prebid-server/adapters/33across" |
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.
again please don't blindly remove these aliases.
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.
Reviewed the source code and left a few comments. Also, we probably should include more test cases in the adapters/engagebdr/engagebdrtest/exemplary/
, adapters/engagebdr/engagebdrtest/supplemental/
, and adapters/engagebdr/engagebdrtest/params/race/
directories to make percent of code coverage.
╰─➤ go test -coverprofile=c.out
PASS
coverage: 64.3% of statements
╰─➤ go tool cover -func=c.out
github.com/prebid/prebid-server/adapters/engagebdr/engagebdr.go:20: MakeRequests 75.0%
github.com/prebid/prebid-server/adapters/engagebdr/engagebdr.go:85: MakeBids 64.3%
github.com/prebid/prebid-server/adapters/engagebdr/engagebdr.go:120: getMediaTypeForImp 0.0%
github.com/prebid/prebid-server/adapters/engagebdr/engagebdr.go:133: NewEngageBDRBidder 100.0%
github.com/prebid/prebid-server/adapters/engagebdr/usersync.go:9: NewEngageBDRSyncer 100.0%
total: (statements) 64.3%
if err := json.Unmarshal(imp.Ext, &bidderExt); err != nil { | ||
errors = append(errors, &errortypes.BadInput{ | ||
Message: fmt.Sprintf("Ignoring imp id=%s, error while decoding extImpBidder, err: %s", imp.ID, err), | ||
}) |
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.
Would a continue
statement make sense after this line? If we have an error for some reason, I believe the following if
statement found in line 39 will most likely also print an error (if not an NULL pointer de-reference in line 38) and we'll end up with a stack of errors that have one common source.
Breakpoint 1 set at 0x1626558 for github.com/prebid/prebid-server/adapters/engagebdr.(*EngageBDRAdapter).MakeRequests() ./engagebdr.go:32
(dlv) c
> github.com/prebid/prebid-server/adapters/engagebdr.(*EngageBDRAdapter).MakeRequests() ./engagebdr.go:32 (hits goroutine(21):1 total:1) (PC: 0x1626558)
27: if imp.Native != nil {
28: // filter native imps from bid request
29: continue
30: }
31: var bidderExt adapters.ExtImpBidder
=> 32: if err := json.Unmarshal(imp.Ext, &bidderExt); err != nil {
33: errors = append(errors, &errortypes.BadInput{
34: Message: fmt.Sprintf("Ignoring imp id=%s, error while decoding extImpBidder, err: %s", imp.ID, err),
35: })
36: }
37: impExt := openrtb_ext.ExtImpEngageBDR{}
38: err := json.Unmarshal(bidderExt.Bidder, &impExt)
39: if err != nil {
(dlv) p bidderExt.Bidder
encoding/json.RawMessage len: 0, cap: 0, nil
if err != nil { | ||
errors = append(errors, &errortypes.BadInput{ | ||
Message: fmt.Sprintf("Ignoring imp id=%s, error while decoding impExt, err: %s", imp.ID, err), | ||
}) |
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 as line 35 above. Seems like a continue
statement would be useful because we'll de-reference impExt
in line 44 and there's a possibility that the Unmarshal
didn't go well by then.
if impExt.Sspid == "" { | ||
errors = append(errors, &errortypes.BadInput{ | ||
Message: fmt.Sprintf("Ignoring imp id=%s, no sspid present", imp.ID), | ||
}) |
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.
If we don't put a continue
statement here, we'd be mapping an empty impExt.Sspid
value into sspidImps
adapters/engagebdr/engagebdr.go
Outdated
} | ||
|
||
if len(adapterRequests) == 0 { | ||
errors = append(errors, &errortypes.BadInput{Message: fmt.Sprintf("No imps present")}) |
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.
Isn't this error message a little bit misleading? There's a possibility that Imp
objects were actually present in the request.Imp
array but all of them were invalid
adapters/engagebdr/engagebdr.go
Outdated
mediaType := openrtb_ext.BidTypeBanner | ||
for _, imp := range imps { | ||
if imp.ID == impId { | ||
if imp.Banner == nil && imp.Video != 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.
The Imp
object also has an Audio
and Native
fields which are the other two data types supported by prebid-server but this particular adapter, according to static/bidder-info/engagebdr.yaml
does not support them. Therefore, the following scenarios might set the mediaType
to openrtb_ext.BidTypeBanner
. Is the behavior we want? Maybe we want to modify the if statement
Imp[i].Banner | Imp[i].Video | Imp[i].Audio | Imp[i].Native | mediaType
--------------|--------------|--------------|----------------|-------------
nil | nil | not nil | nil |openrtb_ext.BidTypeBanner
nil | nil | nil | nil |openrtb_ext.BidTypeBanner
Meant to request changes, not approve. M bad
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.
Sorry, meant to request changes. All the requests are listed in the comments above.
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'd suggest adding some additional tests with multiple imps and adding an example too, if possible.
adapters/engagebdr/engagebdrtest/supplemental/multi-banner-video.json
Outdated
Show resolved
Hide resolved
@yannaingkyaw1986 LGTM in general but there are couple minor comments from the last review that are still unaddressed. If you can please address them when you have a chance, we can get this merged. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
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
No description provided.