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

before validation hook placeholder #2898

Closed
wants to merge 3 commits into from

Conversation

pm-nilesh-chate
Copy link
Contributor

No description provided.

@@ -502,6 +502,14 @@ func (deps *endpointDeps) parseRequest(httpRequest *http.Request, labels *metric
return
}

// When certain modules require updating the request before validation, they currently have to use either the ExecuteEntrypointStage or ExecuteRawAuctionStage hook. Both of these hooks receive the raw byte stream of the request body, which requires each module to redundantly unmarshal and marshal the data, negatively impacting performance.
// To address this issue, a proposed solution is to introduce a new hook that allows passing an OpenRTB (ORTB) object directly. This approach would enhance performance and provide greater flexibility for writing code within the hook."
rejectErr = hookExecutor.ExecuteBeforeRequestValidationStage(req.BidRequest)
Copy link
Contributor

Choose a reason for hiding this comment

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

The "entrypoint" stage is expressed as raw bytes to allow modules to inspect the request and possibly transform it into a valid javascript OpenRTB object. There is no promise that a json unmarshal would be successful at this stage, so module authors will need to proceed with caution in their programming.

The "raw auction" stage is also expressed in bytes because it occurs before stored request resolution to allow for scenarios such as A/B stored request testing. In PBS-Go, stored request resolution is performed at the byte level. The json structure is validated at this point and a marsal would succeed, although there is no promise of conformity to the OpenRTB model.

After this stage, the request is parsed as an OpenRTB model, modified / cleaned, and then validated.

What is your use case? Exactly what are you trying to accomplish with the module and at which point would you like it to run? After cleaning but before validation?

Copy link
Contributor

Choose a reason for hiding this comment

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

Friendly ping.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In addition to the above operations, we also need to fetch some account data and merge it in the request without which request validation would fail. Ex. update bidder params based on the request. Like, impression width and height, tagid value, etc. This data would be dynamic data and cannot be populated via stored request. Hence, we do these operations in "raw auction" stage but would be optimal if there was a before validation hook that would eliminate need to unmarshal and marshal every request in "raw action" stage

@bsardo bsardo self-assigned this Dec 19, 2023
@bsardo
Copy link
Collaborator

bsardo commented Aug 15, 2024

Closing. This has been open for a year without any traction.

@bsardo bsardo closed this Aug 15, 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.

3 participants