prebid-server icon indicating copy to clipboard operation
prebid-server copied to clipboard

New module stage: exitpoint

Open bretg opened this issue 1 year ago • 2 comments

We need a new hook stage executed right before the final Prebid Server response. This allows for the last-chance changes to the response itself. The primary intent behind this stage is to allow the modification of the response format and headers.

The document is https://docs.google.com/document/d/1Fkwym4EREfOdaTD8SHUODKwlj-vWpZWQa0eGUToyzPU/edit?tab=t.0#heading=h.iaqb0q3s18nj

Prebid Server doesn’t allow short-circuiting a hook execution group. This effectively means that multiple modules might modify the response. In this case the last hook that modified the response will take precedence.

Prebid Server gives no guarantee which module final response will be used when there are multiple configured exitpoint modules. This effectively means that the host company will need to make sure that there is only one module which does response serialization and that this module is executed last.

As part of this mechanism, Prebid Server will extend AuctionContext with the field indicating HTTP request method, so that it can be used by module creators.

Exit stage modules should still be able to add aTag objects that are seen by analytics adapters.

PBS-Core updates:

  • allow the module to change the Content-Type header
  • allow the module to set headers in general
  • allow the module to set the response body
  • ideally, detect the situations of multiple modules providing response output (indicating a configuration error) and emit a alert.general metric so that issues will not be unnoticed.
  • update documentation

bretg avatar Nov 08 '24 16:11 bretg

Adding clarifications:

  • exitpoint modules are not called if PBS is going to respond with a 4xx or 5xx error. i.e. there's no output to format.
  • the ext.prebid.modules trace output will not contain the status of the exitpoint module invocation
  • analytics adapters are not expected to be able to read the output created by an exitpoint module. The response sent to analytics adapters should be the ORTB that was present at the start of the exitpoint stage.

bretg avatar Nov 15 '24 16:11 bretg

Done with PBS-Java 3.16

bretg avatar Dec 11 '24 19:12 bretg

Done in PBS-Go 3.24

bsardo avatar Sep 19 '25 13:09 bsardo