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

Adding OpenRTB support #196

Merged
merged 110 commits into from
Nov 21, 2017
Merged

Adding OpenRTB support #196

merged 110 commits into from
Nov 21, 2017

Conversation

dbemiller
Copy link
Contributor

This PR defines an /openrtb2/auction endpoint which serves OpenRTB requests.

At a high level, the packages are:

  • openrtb_ext: contract classes for the prebid-server extensions
  • exchange: OpenRTB auction logic
  • endpoints: HTTP-serving code & request input validation

I updated the Appnexus adapter to serve from this endpoint, as a proof of concept. It's mostly copy & paste now, to be cleaned up later (see the last part of this description)


There are many TODOs before OpenRTB is truly production-ready. I plan to open issues about them once it looks like the reviews are winding down.

In parallel, we can:

  1. Implement the Bidder interface on all other adapters.
  2. Add Targeting key support
  3. Add Influx Metrics
  4. Support Configs
  5. Respect User syncs

Once those are done, we should:

  1. Rewrite the /auction endpoint implementation to use the Exchange
  2. Delete the Adapter interface (now in adapters/legacy.go) and all the code which implements it.

dbemiller and others added 30 commits October 30, 2017 12:14
sandraleon
sandraleon previously approved these changes Nov 21, 2017
Copy link
Contributor

@sandraleon sandraleon left a comment

Choose a reason for hiding this comment

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

Suggested a couple of small improvements in tests but overall looks good.

if bids != nil {
t.Errorf("There should be no seatbid if no http requests are returned.")
}
if len(errs) != 1 {
Copy link
Contributor

Choose a reason for hiding this comment

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

Could also check the contents of the error received to make sure it's what is expected.

t.Fatalf("Failed to unmarshal outgoing request: %v", err)
}

if len(apnRequest.Imp) != 2 {
Copy link
Contributor

Choose a reason for hiding this comment

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

Could also check that the 2 imps are the correct ones.

return e
}

func (e *exchange) HoldAuction(ctx context.Context, bidRequest *openrtb.BidRequest) (*openrtb.BidResponse, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

+1

MaxLength int `json:"lengthmax"`
}

// PriceGranularity defines the allowed values for bidrequest.ext.targeting.pricegranularity
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't it be bidrequest.ext.prebid.targeting.pricegranularity?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes! good catch... I'll fix it.

e.adapters = make([]openrtb_ext.BidderName, 0, len(e.adapterMap))
for a, _ := range e.adapterMap {
e.adapters = append(e.adapters, a)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I know it's late, but I believe it is slightly better to not use append when we know the size already.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

nods, I think that's a good point... it probably is more efficient to index into it directly. Will try to remember it in the future.

katsuo5 pushed a commit to flux-dev-team/prebid-server-1 that referenced this pull request Dec 1, 2020
* Added openrtb contract classes.

* Normalized the documentation.

* Ran gofmt.

* fixed some more comments.

* Added CacheURL to the openrtb types.

* Bidder interface.

* First pass at appnexus adapter implementation.

* Limited the Appnexus adapter to only handle banner and video requests.

* Made a first pass at Bidder interfaces.

* Removed an unused class.

* First pass at openrtb BidRequest cleaning

* Added a return so that the code builds.

* Renamed adapter.go to bidder.go

* Changed appnexus adapter to implement the SingleHttpBidder.

* Changed the Bidder type signature slightly.

* Pass 2 of BidRequest cleaner

* Updated API contract classes, and refactored the singleBidderAdapter so that it compiles again.

* Wrote an http bidder which should work for everyone.

* Replaced the old base bidder with one which works for both bidding strategies.

* Updated the appnexus adapter so that it still implements the interface.

* Updated documentation.

* Added tests to http_bidder.go, and fixed some bugs.

* Exchange probably compiles, but is not done

* Swapped the order of the HoldAuction arguments.

* Added an openrtb endpoint. Made an interface for Exchange.

* End of the week commit. Should be in a relatively sane state

* Fixed some build errors.

* Fixed a bug in NewExchange.

* Fixed some more bugs in the exchange.

* Added an openrtb2/auction endpoint for end-to-end tests.

* First exchange that can (theoretically) produce a bid response

* Fixes for <adapter>.Bid() returning a null pointer

* Fixes for <adapter>.Bid() null fix: keep existing debug info

* Added input validation for incoming openrtb requests.

* Fixes for <adapter>.Bid() : actually save debugging info now

* Some input validation cleanup.

* Added a test for a successful bid.

* Fixed some more bugs. The auction with the appnexus adapter now works from end-to-end.

* Made a BidderName enum type, and ported some method signatures to use it.

* Removed silly newlines.

* Removed some more dead code.

* Starting to add exchange tests

* Added lots of unit tests for input validation.

* Renamed ServerCalls to HttpCalls everywhere.

* pre-merge commit

* Tests and fixes

* Connected bidder param request  validation to the json schemas

* Fixed some bugs.

* Undid some changes to the facebook json schema.

* Updated glide.lock. Removed more unexpected changes.

* Cleaned up the endpoint_test file.

* Added more tests. Improved the endpoint class role to avoid glog.Fatals.

* Added some tests for the bidder json-schema validation.

* Improved handling of GetAllBids go routine and more tests

* Added a benchmark for the openrtb endpoint.

* Renamed the openrtb_auction package to openrtb2.

* Added a markdown file describing the openrtb2 endpoint.

* More tests in, including a null response from an adapter as their bid response.

* Add proper error handling of the json Marshal errors to the exchange code.

* Implemented the timeout.

* Return a 500 if the exchange fails with an error.

* Added lots of tests. More to come soon.

* More appnexus tests.

* Removed some of the TODOs.

* Added tests for appnexus param validation

* Added another test where unit coverage was spotty.

* Deleted some unused code, including the Cache stuff.

* Removed some dead comments.

* Removed some more TODOs

* Added a doc.go to the openrtb_ext package.

* Refactoring and cleanup based on suggestions from Nicole.

* Moved the appnexus imp.ext into its own file.

* Renamed exchange.bidder to exchange.adaptedBidder.

* Fixed more docs, and made more things private.

* Replaced the response.seatbid.ext map with the contract class.

* Added support for Targeting. Adding tests to CleanOpenRTBRequests, work needed here still.

* Revert "Added support for Targeting. Adding tests to CleanOpenRTBRequests, work needed here still."

This reverts commit f2efcca.

* Adding tests to insure proper extensions get passed to adapters during the request cleaning stage.

* Fixed docs based on the documentation writer's feedback

* Fixed some spaces => tabs formatting.

* Fixed go vet errors.

* Added docs for adding a new bidder.

* Linked the README to the adding a new bidder doc.

* Relocated utils.go into exchange, and made the functions private.

* Privitized internal exchange functions.

* Code review improvements.

* A few small fixes from PR comments

* Optimizations in cleanOpenRTBRequests

* Fixed a bug which resulted in empty seatbid.ext objects.

* Fixed some bugs in the contract classes.

* Improved two of the unit tests.
pm-nilesh-chate pushed a commit to pm-nilesh-chate/prebid-server that referenced this pull request Feb 25, 2023
allar15 pushed a commit to allar15/prebid-server that referenced this pull request Nov 24, 2023
* Support redis client

* change redis params

* Read redis conf from env
StarWindMoonCloud pushed a commit to ParticleMedia/prebid-server that referenced this pull request Jun 5, 2024
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.

6 participants