Skip to content

Commit

Permalink
Proper last execution stuff, percent-igs-cumulative-timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
Maks Orlovich committed Nov 7, 2024
1 parent acd7c1e commit b175075
Showing 1 changed file with 43 additions and 11 deletions.
54 changes: 43 additions & 11 deletions spec.bs
Original file line number Diff line number Diff line change
Expand Up @@ -1967,9 +1967,9 @@ and a [=real time reporting contributions map=] |realTimeContributionsMap|:
[=auction config/per buyer experiment group ids=].
1. If |perBuyerExperimentGroupIds| is not null and |perBuyerExperimentGroupIds|[|buyer|]
[=map/exists=], then set |buyerExperimentGroupId| to |perBuyerExperimentGroupIds|[|buyer|].
1. Let |metrics| be the result of [=accessing per-participant metrics=] for |reportingContext|,
|buyer|, [=worklet function/generate-bid=].
1. <dfn>Apply interest groups limits to prioritized list</dfn>:
1. Let |metrics| be the result of [=accessing per-participant metrics=] for |reportingContext|,
|buyer|, [=worklet function/generate-bid=].
1. Let |buyerGroupLimit| be |allBuyersGroupLimit|.
1. Let |perBuyerGroupLimits| be |auctionConfig|'s
[=auction config/per buyer group limits=].
Expand Down Expand Up @@ -2033,11 +2033,11 @@ and a [=real time reporting contributions map=] |realTimeContributionsMap|:
1. [=map/For each=] joiningOrigin → |groups| of |perSignalsUrlGenerator|:
1. [=list/For each=] |ig| of |groups|:
1. If |cumulativeTimeoutTracker| [=cumulative timeout tracker/is expired=] then:
1. TODO Increment the metric.
1. Increment |metrics|'s [=per participant metrics/cumulative timeouts occurred=] by 1.
1. [=iteration/continue=].
1. If |ig|'s [=interest group/bidding url=] is null, [=iteration/continue=].
1. If |perBuyerCumulativeTimeout| is not null and is less than |perBuyerTimeout|, then set
|perBuyerTimeout| to |perBuyerCumulativeTimeout|.
1. Let |effectiveBuyerTimeout| be the result of [=computing effective timeout=] given
|cumulativeTimeoutTracker| and |perBuyerTimeout|.
1. Let |generateBidStartTime| be |settings|'s
[=environment settings object/current monotonic time=].
1. Let |directFromSellerSignalsForBuyer| be the result of running
Expand Down Expand Up @@ -2066,7 +2066,7 @@ and a [=real time reporting contributions map=] |realTimeContributionsMap|:
1. Let |generateBidResult| be the result of [=generate potentially multiple bids=] given
|allTrustedBiddingSignals|, |crossOriginTrustedBiddingSignalsOrigin|, |auctionSignals|,
a [=map/clone=] of |browserSignals|, |perBuyerSignals|,
|directFromSellerSignalsForBuyer|, |perBuyerTimeout|, |expectedCurrency|,
|directFromSellerSignalsForBuyer|, |effectiveBuyerTimeout|, |expectedCurrency|,
|multiBidLimit|, |ig|, |reportingContext|, |auctionStartTime|, and |settings|.
1. If |generateBidResult| is failure, then:
1. If |optedInForRealTimeReporting| is true, then [=add a platform contribution=] with
Expand All @@ -2078,6 +2078,9 @@ and a [=real time reporting contributions map=] |realTimeContributionsMap|:
[=environment settings object/current monotonic time=], in milliseconds.
1. [=Expend cumulative timeout time=] given |cumulativeTimeoutTracker| and
|generateBidDuration|.
1. If |cumulativeTimeoutTracker| [=cumulative timeout tracker/is expired=] then:
1. Increment |metrics|'s [=per participant metrics/cumulative timeouts occurred=] by 1.
1. [=iteration/continue=].
1. Let |bidsToScore| be the result of applying [=adjust bid list based on k-anonymity=] to |bidsBatch|.
1. Let |foundKAnonBids| be false.
1. [=list/For each=] |generatedBid| of |bidsToScore|:
Expand All @@ -2093,20 +2096,24 @@ and a [=real time reporting contributions map=] |realTimeContributionsMap|:
[=query k-anonymity count=].
1. Let |kAnonRestrictedIG| be the result of running [=create a k-anon restricted deep copy of the interest group=]
given |ig|.
1. If |perBuyerCumulativeTimeout| is not null and is &lt; |perBuyerTimeout|, then set
|perBuyerTimeout| to |perBuyerCumulativeTimeout|.
1. Let |effectiveBuyerTimeout| be the result of [=computing effective timeout=] given
|cumulativeTimeoutTracker| and |perBuyerTimeout|.
1. Let |generateBidStartTime| be |settings|'s
[=environment settings object/current monotonic time=].
1. Set (|generatedBids|, |bidDebugReportInfo|, |realTimeContributions|,
|paContributions|, |executionMetrics|) to the result of running [=generate potentially
multiple bids=] with |allTrustedBiddingSignals|,
|crossOriginTrustedBiddingSignalsOrigin|, |auctionSignals|, a [=map/clone=] of |browserSignals|,
|perBuyerSignals|, |directFromSellerSignalsForBuyer|, |perBuyerTimeout|, |expectedCurrency|,
1 (for multiBidLimit), |kAnonRestrictedIG|, |reportingContext|, |auctionStartTime|,
and |settings|.
|perBuyerSignals|, |directFromSellerSignalsForBuyer|, |effectiveBuyerTimeout|,
|expectedCurrency|, 1 (for multiBidLimit), |kAnonRestrictedIG|, |reportingContext|,
|auctionStartTime|, and |settings|.

Note: passing 1 for multiBidLimit limits the rerun to producing at most a single bid.

1. If |cumulativeTimeoutTracker| [=cumulative timeout tracker/is expired=] then:
1. Increment |metrics|'s [=per participant metrics/cumulative timeouts occurred=]
by 1.
1. [=iteration/continue=].
1. Let |generateBidDuration| be the [=duration from=] |generateBidStartTime| to
|settings|'s [=environment settings object/current monotonic time=], in milliseconds.
1. [=Expend cumulative timeout time=] given |cumulativeTimeoutTracker| and
Expand Down Expand Up @@ -4161,6 +4168,11 @@ A signal base value is one of the following:
: "<dfn><code>percent-ig-storage-quota-used</code></dfn>"
:: Percentage of [=max interest groups total size per owner=] used by the given buyer, capped to
110.
: "<dfn><code>cumulative-buyer-time</code></dfn>"
:: TODO
: "<dfn><code>percent-igs-cumulative-timeout</code></dfn>"
:: Percentage of participating interest groups that did not get to participate due to a cumulative
buyer timeout occurring.

</dl>

Expand Down Expand Up @@ -4260,6 +4272,9 @@ A <dfn>per participant metrics</dfn> is a [=struct=] with the following [=struct
:: An [=averager=].
: <dfn>script timeouts occurred</dfn>
:: A {{long}}, initially 0.
: <dfn>cumulative timeouts occurred</dfn>
:: A {{long}}, initially 0. Number of interest groups affected by the cumulative timeout
happening.
: <dfn>script executions attempted</dfn>
:: A {{long}}, initially 0.
: <dfn>regular interest group count</dfn>
Expand Down Expand Up @@ -4649,6 +4664,12 @@ They return a {{double}}.
1. If |signalBaseValue| is "<code>[=signal base value/percent-ig-storage-quota-used=]</code>":
1. Return the result of [=computing a percentage metric=] given |bidAndScoreMetrics|'s [=per
participant metrics/storage quota used=] and [=Max interest groups total size per owner=].
1. If |signalBaseValue| is "<code>[=signal base value/cumulative-buyer-time=]</code>":
1. TODO
1. If |signalBaseValue| is "<code>[=signal base value/percent-igs-cumulative-timeout=]</code>":
1. Return the result of [=computing a percentage metric=] given |metrics|'s [=per participant
metrics/cumulative timeouts occurred=] and |metrics|'s [=per participant metrics/script executions
attempted=].

</div>

Expand Down Expand Up @@ -9143,6 +9164,17 @@ To <dfn>expend cumulative timeout time</dfn> given a [=cumulative timeout tracke

</div>


<div algorithm>
To <dfn>compute effective timeout</dfn> given a [=cumulative timeout tracker=] |tracker| and a
[=duration=] in milliseconds |perBuyerTimeout|:
1. If |tracker|'s [=cumulative timeout tracker/remaining=] is null, return |perBuyerTimeout|.
1. If |perBuyerTimeout| &lt; |tracker|'s [=cumulative timeout tracker/remaining=], return
|perBuyerTimeout|.
1. Return |tracker|'s [=cumulative timeout tracker/remaining=].

</div>

<div algorithm>
The <dfn for="cumulative timeout tracker">is expired</dfn> of a [=cumulative timeout tracker=]
|tracker| is:
Expand Down

0 comments on commit b175075

Please sign in to comment.