Skip to content

optable-targeting: Review follow-ups (stored-request leak, plan resolution, api-timeout) - #6

Open
justadreamer wants to merge 7 commits into
optable-targeting-featuresfrom
fix/optable-targeting-review-followups
Open

justadreamer wants to merge 7 commits into
optable-targeting-featuresfrom
fix/optable-targeting-review-followups

Conversation

@justadreamer

Copy link
Copy Markdown
Collaborator

Follow-up fixes for the optable-targeting review, one commit per issue.

Why / what changed

  • Deferred requests leaked user.ext.optable. When the raw hook deferred the call, it returned no_action, so email/phone/zip/vid reached every bidder unless the processed hook was in the plan. The raw hook now always cleans the request and keeps user.ext.optable in the module context for the deferred call.
  • Mixed inline and stored imps. The raw hook now defers whenever the request or any imp references a stored request, so bidders from stored imps are sampled too.
  • The processed hook is required. The README now lists all four hooks and explains what the processed hook does, instead of calling it legacy.
  • Hook exceptions skipped the cleaner. The raw and processed hooks catch the exception and still clean the request.
  • An account without module config threw an NPE in ConfigResolver. It now falls back to the host config.
  • Old-style bidders were read from imp.ext.bidder. They are now read from imp.ext.<bidder> using core's reserved-field rule, per imp.
  • Null enrichment-percentage or bidder-enrichment-percentages threw an NPE.
  • CompositeHookExecutionPlan:
    • It now checks the host plan plus the account plan, falling back to the default account plan, for the request's endpoint, with no cache.
    • The call awaited by the bidder-request hook is limited by a new api-timeout parameter, or by the remaining auction time when it is not set, instead of the first group's timeout.
  • AMP and video. The raw stage never runs on those endpoints. When the bidder-request hook is configured, the processed hook now starts the call there.
  • The legacy processed-only setup now respects enrich-web/enrich-app and sampling.

Testing

  • Module tests pass.
  • OptableStoredRequestFlowTest runs a request through the raw, processed and bidder-request hooks, covering:
    • stored imps
    • app that comes from a stored request
    • mixed inline and stored imps
    • cleaning at the raw stage
    • sampling that runs only once

An account can have the module hooks in its execution plan without a
module config of its own. ConfigResolver passed the null config to the
JSON merger, which threw and failed every hook of the module.
The fallback looked for imp.ext.bidder, which is not a format the core
knows. Old-style params sit directly under imp.ext and the core moves
them to imp.ext.prebid.bidder for every imp that has no bidders there,
so the sampler now applies the same rule per imp instead of falling back
only when no imp at all has imp.ext.prebid.bidder.
An account config with "enrichment-percentage": null or
"bidder-enrichment-percentages": null overrides the defaults of the
properties class, and the sampler then failed on unboxing.
… mixed stored imps

When the raw hook deferred the call to the processed hook it returned
no_action, so user.ext.optable reached every bidder unless the processed
hook was in the plan. The raw hook now always cleans and keeps
user.ext.optable in the module context for the deferred call.

The raw hook also defers whenever the request or any imp references a
stored request, since bidders from stored imps were otherwise never
sampled. Sampling now runs only once, at the stage that makes the call.

The README now lists the processed hook as required.
An exception in the raw or processed auction request hook failed the hook
without applying the cleaner, so user.ext.optable reached the bidders.
Both hooks now catch it, log it and still return the cleaner update.

The call and the bidders to enrich are set together, so the bidder
request hook never sees bidders without a call to await.
…pi-timeout

CompositeHookExecutionPlan ignored hooks.default-account-execution-plan,
only looked at /openrtb2/auction, took the timeout of the first group of
the bidder request stage and cached the per-account result forever.

It now only tells whether the bidder request hook is configured for the
request, combining the host plan with the account plan (or the default
account plan) for the request's endpoint, without caching. Whether the
raw hook has run comes from the module context.

The call awaited by the bidder request hook is bound by the new
api-timeout parameter, or by the time remaining for the auction.

The raw stage never runs for amp and video requests, so when the bidder
request hook is configured the processed hook now starts the call there
instead of passing through without one. When the raw hook has run and the
bidder request hook is absent, the processed hook awaits the early call
and enriches the request, as before.
…gacy setup

Without the raw and bidder request hooks the processed hook called the
API and enriched every request, whatever enrich-web, enrich-app and the
enrichment percentages said. It now skips disabled traffic sources and
only calls the API when sampling selects at least one bidder.
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.

1 participant