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

New Adapter: ResetDigital #3766

Open
wants to merge 87 commits into
base: master
Choose a base branch
from
Open

Conversation

bruno-siira
Copy link

This PR adds a new adapter for Reset Digital to the Prebid Server (Go version). The adapter enables Prebid Server to communicate with Reset Digital for real-time advertising auctions.

Changes:

Added the Reset Digital adapter in adapters/resetdigital/.
Implemented necessary methods for the adapter.
Added unit tests for the adapter in adapters/resetdigital/resetdigital_test.go.
Updated the documentation to include the configuration for the Reset Digital adapter.
Testing:

Unit tests have been written and verified to ensure the adapter works correctly.
Manual testing has been performed to verify the integration with Reset Digital.

Notes:

This system is based on single bid, so it's based on that premise.

Related Issues:

}

func getBidType(imp openrtb2.Imp) (openrtb_ext.BidType, error) {
if imp.Banner != nil {

Choose a reason for hiding this comment

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

Consider this as a suggestion. The current implementation follows an anti-pattern, assumes that if there is a multi-format request, the media type defaults to openrtb_ext.BidTypeBanner, nil. Prebid server expects the media type to be explicitly set in the adapter response. Therefore, we strongly recommend implementing a pattern where the adapter server sets the MType field in the response to accurately determine the media type for the impression.

Copy link
Author

Choose a reason for hiding this comment

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

Implemented as suggested

Copy link
Contributor

Choose a reason for hiding this comment

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

Implemented as suggested

could you point out or link where MType changes are implemented?

Copy link
Author

Choose a reason for hiding this comment

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

Sorry, it was addressed on the point that we support only single format bids, so we could assume the anti pattern. Anyway, it would be more advisable to change to the normal pattern?

Copy link
Contributor

Choose a reason for hiding this comment

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

Anyway, it would be more advisable to change to the normal pattern?

Prebid team recommends using MType field. But if it's not doable then current change suffices single format bid. @bruno-siira should mention in Bidder docs that adapter expects only single format bids in the incoming request

Copy link
Author

Choose a reason for hiding this comment

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

When we're talking about the Bidder Docs what is this file exacly @onkarvhanumante

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link

Code coverage summary

Note:

  • Prebid team doesn't anticipate tests covering code paths that might result in marshal and unmarshal errors
  • Coverage summary encompasses all commits leading up to the latest one, 3762676

resetdigital

Refer here for heat map coverage report

github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:57:	Builder			0.0%
github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:69:	getHeaders		100.0%
github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:86:	addNonEmptyHeaders	100.0%
github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:94:	getReferer		66.7%
github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:102:	getCurrency		66.7%
github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:110:	MakeRequests		72.2%
github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:151:	processDataFromRequest	94.4%
github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:186:	MakeBids		72.2%
github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:222:	getBidFromResponse	93.3%
github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:257:	getBidPrice		66.7%
github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:264:	getBidType		28.6%
total:										(statements)		74.2%

Implementation of suggestions
Copy link

github-actions bot commented Jul 3, 2024

Code coverage summary

Note:

  • Prebid team doesn't anticipate tests covering code paths that might result in marshal and unmarshal errors
  • Coverage summary encompasses all commits leading up to the latest one, 989c565

resetdigital

Refer here for heat map coverage report

github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:57:	Builder			0.0%
github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:69:	getHeaders		100.0%
github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:86:	addNonEmptyHeaders	100.0%
github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:94:	getReferer		66.7%
github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:102:	getCurrency		66.7%
github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:110:	MakeRequests		72.2%
github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:151:	processDataFromRequest	94.4%
github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:186:	MakeBids		78.9%
github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:222:	getBidFromResponse	92.3%
github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:255:	getBidPrice		66.7%
github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:262:	getBidType		28.6%
github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:274:	getBidTypes		70.0%
total:										(statements)		74.5%

Copy link
Author

@bruno-siira bruno-siira left a comment

Choose a reason for hiding this comment

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

We have now a Builder

Copy link
Author

@bruno-siira bruno-siira left a comment

Choose a reason for hiding this comment

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

There is a schema now

Copy link

github-actions bot commented Jul 5, 2024

Code coverage summary

Note:

  • Prebid team doesn't anticipate tests covering code paths that might result in marshal and unmarshal errors
  • Coverage summary encompasses all commits leading up to the latest one, 4482bc9

resetdigital

Refer here for heat map coverage report

github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:55:	Builder			0.0%
github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:67:	getHeaders		100.0%
github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:84:	addNonEmptyHeaders	100.0%
github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:92:	getReferer		66.7%
github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:100:	getCurrency		66.7%
github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:108:	MakeRequests		72.2%
github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:149:	processDataFromRequest	94.4%
github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:184:	MakeBids		78.9%
github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:220:	getBidFromResponse	92.3%
github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:253:	getBidPrice		66.7%
github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:260:	getBidType		28.6%
github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:272:	getBidTypes		70.0%
total:										(statements)		74.5%

@onkarvhanumante onkarvhanumante self-assigned this Jul 9, 2024
Copy link

github-actions bot commented Dec 2, 2024

Code coverage summary

Note:

  • Prebid team doesn't anticipate tests covering code paths that might result in marshal and unmarshal errors
  • Coverage summary encompasses all commits leading up to the latest one, ef65f7b

resetdigital

Refer here for heat map coverage report

github.com/prebid/prebid-server/v3/adapters/resetdigital/resetdigital.go:67:	Builder			80.0%
github.com/prebid/prebid-server/v3/adapters/resetdigital/resetdigital.go:78:	getHeaders		100.0%
github.com/prebid/prebid-server/v3/adapters/resetdigital/resetdigital.go:103:	addNonEmptyHeaders	100.0%
github.com/prebid/prebid-server/v3/adapters/resetdigital/resetdigital.go:111:	MakeRequests		87.5%
github.com/prebid/prebid-server/v3/adapters/resetdigital/resetdigital.go:148:	processDataFromRequest	97.0%
github.com/prebid/prebid-server/v3/adapters/resetdigital/resetdigital.go:219:	MakeBids		81.5%
github.com/prebid/prebid-server/v3/adapters/resetdigital/resetdigital.go:273:	getBidFromResponse	80.0%
github.com/prebid/prebid-server/v3/adapters/resetdigital/resetdigital.go:298:	getBidType		100.0%
github.com/prebid/prebid-server/v3/adapters/resetdigital/resetdigital.go:310:	GetMediaTypeForImp	87.5%
total:										(statements)		89.7%


func GetMediaTypeForImp(reqImp openrtb2.Imp) (openrtb_ext.BidType, error) {

if reqImp.Video != nil {
Copy link

Choose a reason for hiding this comment

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

Consider this as a suggestion. The current implementation follows an anti-pattern, assumes that if there is a multi-format request, the media type defaults to openrtb_ext.BidTypeVideo, nil. Prebid server expects the media type to be explicitly set in the adapter response. Therefore, we strongly recommend implementing a pattern where the adapter server sets the MType field in the response to accurately determine the media type for the impression.

Copy link

github-actions bot commented Dec 4, 2024

Code coverage summary

Note:

  • Prebid team doesn't anticipate tests covering code paths that might result in marshal and unmarshal errors
  • Coverage summary encompasses all commits leading up to the latest one, 6bac6cd

resetdigital

Refer here for heat map coverage report

github.com/prebid/prebid-server/v3/adapters/resetdigital/resetdigital.go:67:	Builder			80.0%
github.com/prebid/prebid-server/v3/adapters/resetdigital/resetdigital.go:78:	getHeaders		100.0%
github.com/prebid/prebid-server/v3/adapters/resetdigital/resetdigital.go:103:	addNonEmptyHeaders	100.0%
github.com/prebid/prebid-server/v3/adapters/resetdigital/resetdigital.go:111:	MakeRequests		87.5%
github.com/prebid/prebid-server/v3/adapters/resetdigital/resetdigital.go:149:	processDataFromRequest	97.1%
github.com/prebid/prebid-server/v3/adapters/resetdigital/resetdigital.go:209:	MakeBids		88.9%
github.com/prebid/prebid-server/v3/adapters/resetdigital/resetdigital.go:261:	getBidFromResponse	100.0%
github.com/prebid/prebid-server/v3/adapters/resetdigital/resetdigital.go:286:	getBidType		100.0%
github.com/prebid/prebid-server/v3/adapters/resetdigital/resetdigital.go:298:	GetMediaTypeForImp	100.0%
total:										(statements)		93.9%

if reqImp.Video != nil {
return openrtb_ext.BidTypeVideo, nil
}
if reqImp.Audio != nil {
Copy link

Choose a reason for hiding this comment

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

Consider this as a suggestion. The current implementation follows an anti-pattern, assumes that if there is a multi-format request, the media type defaults to openrtb_ext.BidTypeAudio, nil. Prebid server expects the media type to be explicitly set in the adapter response. Therefore, we strongly recommend implementing a pattern where the adapter server sets the MType field in the response to accurately determine the media type for the impression.

@dirk-rd
Copy link

dirk-rd commented Dec 7, 2024

@BrunoJacinto, I think this PR is ready for another review, please.

@bruno-siira
Copy link
Author

@BrunoJacinto, I think this PR is ready for another review, please.

Ok Dirk, I'll review it from my part.

@dirk-rd
Copy link

dirk-rd commented Dec 10, 2024

Ugh, I tagged Bruno instead of Brian. I meant to let @bsardo know that the PR is ready for another review.

@bsardo bsardo assigned hhhjort and unassigned onkarvhanumante Dec 16, 2024
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.

@dirk-rd I think we're close. Please see my latest comments.

@@ -399,6 +400,7 @@ func newAdapterBuilders() map[openrtb_ext.BidderName]adapters.Builder {
openrtb_ext.BidderReadpeak: readpeak.Builder,
openrtb_ext.BidderRelevantDigital: relevantdigital.Builder,
openrtb_ext.BidderRevcontent: revcontent.Builder,
openrtb_ext.BidderResetDigital: resetdigital.Builder,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nitpick: move this line up one so it is just before RevContent to keep the builders in alphabetical order.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Please add a new file params_test.go in your adapter directory to verify your bidder parameters. You can copy this file from another adapter and modify accordingly.

return "", fmt.Errorf("failed to find matching imp for bid %s", imp.ID)
}

func GetMediaTypeForImp(reqImp openrtb2.Imp) (openrtb_ext.BidType, error) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please remove the second return value of type error because this function never returns an error after recent changes.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Please remove this file.

return nil, []error{err}
}

bidResponse := adapters.NewBidderResponseWithBidsCapacity(len(request.Imp))
Copy link
Collaborator

Choose a reason for hiding this comment

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

It looks like above you are only sending one imp per request ... so this seems incorrect. This function is being passed the response to one of your above generated requests, so will likely have just one bid. More if you often send more than one bid per imp of course. PBS core then merges all the bids gotten by calling this function for each request/response that was generated for the incoming request.

Copy link

Choose a reason for hiding this comment

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

You are right, but at the same time, doesn't the code still work fine?


if reqImp.Video != nil {
return openrtb_ext.BidTypeVideo
}

Choose a reason for hiding this comment

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

Consider this as a suggestion. The current implementation follows an anti-pattern, assumes that if there is a multi-format request, the media type defaults to openrtb_ext.BidTypeVideo. Prebid server expects the media type to be explicitly set in the adapter response. Therefore, we strongly recommend implementing a pattern where the adapter server sets the MType field in the response to accurately determine the media type for the impression.

}
if reqImp.Audio != nil {
return openrtb_ext.BidTypeAudio
}

Choose a reason for hiding this comment

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

Consider this as a suggestion. The current implementation follows an anti-pattern, assumes that if there is a multi-format request, the media type defaults to openrtb_ext.BidTypeAudio. Prebid server expects the media type to be explicitly set in the adapter response. Therefore, we strongly recommend implementing a pattern where the adapter server sets the MType field in the response to accurately determine the media type for the impression.

Copy link

Code coverage summary

Note:

  • Prebid team doesn't anticipate tests covering code paths that might result in marshal and unmarshal errors
  • Coverage summary encompasses all commits leading up to the latest one, 0623316

resetdigital

Refer here for heat map coverage report

github.com/prebid/prebid-server/v3/adapters/resetdigital/resetdigital.go:67:	Builder			80.0%
github.com/prebid/prebid-server/v3/adapters/resetdigital/resetdigital.go:78:	getHeaders		100.0%
github.com/prebid/prebid-server/v3/adapters/resetdigital/resetdigital.go:103:	addNonEmptyHeaders	100.0%
github.com/prebid/prebid-server/v3/adapters/resetdigital/resetdigital.go:111:	MakeRequests		87.5%
github.com/prebid/prebid-server/v3/adapters/resetdigital/resetdigital.go:149:	processDataFromRequest	97.1%
github.com/prebid/prebid-server/v3/adapters/resetdigital/resetdigital.go:209:	MakeBids		95.8%
github.com/prebid/prebid-server/v3/adapters/resetdigital/resetdigital.go:257:	getBidFromResponse	100.0%
github.com/prebid/prebid-server/v3/adapters/resetdigital/resetdigital.go:282:	getBidType		100.0%
github.com/prebid/prebid-server/v3/adapters/resetdigital/resetdigital.go:294:	GetMediaTypeForImp	100.0%
total:										(statements)		95.5%

@dirk-rd
Copy link

dirk-rd commented Dec 22, 2024

@bsardo, this PR is once again ready for review.

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.

8 participants