Skip to content

Commit

Permalink
Spec various P.Agg. storage usage base values. (#1349)
Browse files Browse the repository at this point in the history
* Reserved.once specification.

* Some metrics stuff, but it's a bit off for re-run, so need to think some
more.

Actually implement the get.

* Fix handwaveyness of fetch metrics.

* Fix the re-run thing, and a bit of prep for later.

* Fix formatting.

* Fix bug + misc found in feedback.

* Typo fix.

* Wire timeout from most script helpers.

* Start on actual computation.

* k-anon only. The impl gets it wrong.

* generateBid computation.

* report*

* And add the base value itself.

* Fix participating IG count computation.

* Back to always.

* Fix the reportAdditionalWin case.

* Improve report-win enum at suggestion.

* Fix edit mishap

* Spec various P.Agg. storage usage base values.

* Woops, forgot some descriptions.

* Apply feedback

* Apply feedback

* + PA contributions type

* More feedback

* More phrasing tweaks.

* More add -> increment

* Some feedback

* Fix the error case Qingxin pointed out.

* Explain 110%

* Fix the parse error case Qingxin pointed out, lack of timeout on
top-level run is orthogonal.

* Fix the lack of timeout on ScriptExecution.

* More feedback

* Switchify

* FIx weird wrap.

---------

Co-authored-by: Maks Orlovich <[email protected]>
  • Loading branch information
morlovich and Maks Orlovich authored Dec 2, 2024
1 parent 4a5cbfb commit 64a99ce
Showing 1 changed file with 121 additions and 55 deletions.
176 changes: 121 additions & 55 deletions spec.bs
Original file line number Diff line number Diff line change
Expand Up @@ -1985,6 +1985,10 @@ and a [=real time reporting contributions map=] |realTimeContributionsMap|:
1. [=map/For each=] slotSizeQueryParam → |perSignalsUrlGenerator| of |perSlotSizeQueryParam|:
1. [=map/For each=] joiningOrigin → |groups| of |perSignalsUrlGenerator|:
1. [=list/Extend=] |igs| with |groups|.
1. [=Update storage metrics=] given |metrics| and |igs|.

Note: This is done before any filtering, since it represents storage resource usage.

1. [=list/Sort in descending order=] |igs|, with |a| being less than |b| if |a|'s
[=interest group/priority=] is less than |b|'s [=interest group/priority=].
1. [=list/Remove=] the first |buyerGroupLimit| items from |igs|.
Expand Down Expand Up @@ -4208,6 +4212,21 @@ A signal base value is one of the following:
: "<dfn><code>percent-scripts-timeout</code></dfn>"
:: The numeric value is percentage of executions of this script that hit their individual timeout,
out of all executions that were expected to happen.
: "<dfn><code>regular-igs-count</code></dfn>"
:: Number of [=regular interest groups=] for the given buyer. (0 if this is used by a seller).
: "<dfn><code>percent-regular-ig-count-quota-used</code></dfn>"
:: Ratio of number of [=regular interest groups=] for the given buyer and [=Max regular interest
groups per owner=] expressed as a percentage, capped to 110.
: "<dfn><code>negative-igs-count</code></dfn>"
:: Number of [=negative interest groups=] for the given buyer. (0 if this is used by a seller).
: "<dfn><code>percent-negative-ig-count-quota-used</code></dfn>"
:: Ratio of number of [=negative interest groups=] for the given buyer and [=Max negative interest
groups per owner=] expressed as a percentage, capped to 110.
: "<dfn><code>ig-storage-used</code></dfn>"
:: Bytes of storage used by the given buyer. (0 if this is used by a seller).
: "<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.

</dl>

Expand Down Expand Up @@ -4312,6 +4331,12 @@ representing metrics aggregated over a particular participant (e.g. bidder or se
:: A {{long}}, initially 0.
: <dfn>script executions attempted</dfn>
:: A {{long}}, initially 0.
: <dfn>regular interest group count</dfn>
:: A {{long}}, initially 0.
: <dfn>negative interest group count</dfn>
:: A {{long}}, initially 0.
: <dfn>storage quota used</dfn>
:: A {{long}}, initially 0.
</dl>

<h4 dfn-type=dfn>Private Aggregation contributions</h4>
Expand Down Expand Up @@ -4606,19 +4631,20 @@ They return a {{double}}.
|reportingContext|, |onEventEntry|'s [=on event contribution entry/origin=], and the result of
[=find corresponding bid and score phase function=] given [=on event contribution entry/worklet
function=].
1. If |signalBaseValue| is "<code>[=signal base value/winning-bid=]</code>":
1. If |leadingBidInfo|'s [=leading bid info/leading bid=] is null, return 0.
1. Otherwise, return |leadingBidInfo|'s [=leading bid info/leading bid=]'s [=generated bid/bid=].
1. If |signalBaseValue| is
"<code>[=signal base value/highest-scoring-other-bid=]</code>":
1. If |leadingBidInfo|'s [=leading bid info/highest scoring other bid=] is null, return 0.
1. Otherwise, return |leadingBidInfo|'s [=leading bid info/highest scoring other bid=]'s
[=generated bid/bid=].
1. If |signalBaseValue| is "<code>[=signal base value/script-run-time=]</code>":
1. Return the number of milliseconds of CPU time that the calling function
1. If |signalBaseValue| is:
<dl class="switch">
: "<code>[=signal base value/winning-bid=]</code>"
:: 1. If |leadingBidInfo|'s [=leading bid info/leading bid=] is null, return 0.
1. Otherwise, return |leadingBidInfo|'s [=leading bid info/leading bid=]'s [=generated bid/bid=].
: "<code>[=signal base value/highest-scoring-other-bid=]</code>":
:: 1. If |leadingBidInfo|'s [=leading bid info/highest scoring other bid=] is null, return 0.
1. Otherwise, return |leadingBidInfo|'s [=leading bid info/highest scoring other bid=]'s
[=generated bid/bid=].
: "<code>[=signal base value/script-run-time=]</code>"
:: Return the number of milliseconds of CPU time that the calling function
(e.g. `generateBid()`) took to run.
1. If |signalBaseValue| is "<code>[=signal base value/signals-fetch-time=]</code>":
Switch on the associated [=worklet function=]:
: "<code>[=signal base value/signals-fetch-time=]</code>"
:: Switch on the associated [=worklet function=]:
<dl class="switch">
: <code>[=worklet function/generate-bid=]</code>
:: Return the number of milliseconds it took for the trusted bidding signals
Expand All @@ -4631,53 +4657,80 @@ They return a {{double}}.
:: Return 0.

</dl>
1. If |signalBaseValue| is "<code>[=signal base value/bid-reject-reason=]</code>":
1. If the bid did not succeed purely because it didn't meet the required
<a spec="turtledove">k-anonymity threshold</a>, return 8.
1. Let |bidRejectReason| be "`not-available`".
1. If the seller provided a reject reason, set |bidRejectReason| to that
value.
1. If |bidRejectReason| is:
<dl class="switch">
: "`not-available`"
:: Return 0.
: "`invalid-bid`"
:: Return 1.
: "`bid-below-auction-floor`"
:: Return 2.
: "`pending-approval-by-exchange`"
:: Return 3.
: "`disapproved-by-exchange`"
:: Return 4.
: "`blocked-by-publisher`"
:: Return 5.
: "`language-exclusions`"
:: Return 6.
: "`category-exclusions`"
:: Return 7.
: None of the above values
:: [=Assert=]: false

Note: this enum value is validated in `scoreAd()`.

Issue: Verify this once
<a href="https://github.com/WICG/turtledove/issues/627">WICG/turtledove#627</a> is resolved.

Issue: There are some automatically generated values that are not described here.

Issue: Verify handling when the bid was not rejected.

</dl>
1. If |signalBaseValue| is "<code>[=signal base value/average-code-fetch-time=]</code>":
1. Return the result of [=getting the value to report from an averager=] given |metrics|'s [=per
: "<code>[=signal base value/bid-reject-reason=]</code>"
:: 1. If the bid did not succeed purely because it didn't meet the required
<a spec="turtledove">k-anonymity threshold</a>, return 8.
1. Let |bidRejectReason| be "`not-available`".
1. If the seller provided a reject reason, set |bidRejectReason| to that
value.
1. If |bidRejectReason| is:
<dl class="switch">
: "`not-available`"
:: Return 0.
: "`invalid-bid`"
:: Return 1.
: "`bid-below-auction-floor`"
:: Return 2.
: "`pending-approval-by-exchange`"
:: Return 3.
: "`disapproved-by-exchange`"
:: Return 4.
: "`blocked-by-publisher`"
:: Return 5.
: "`language-exclusions`"
:: Return 6.
: "`category-exclusions`"
:: Return 7.
: None of the above values
:: [=Assert=]: false

Note: this enum value is validated in `scoreAd()`.

Issue: Verify this once
<a href="https://github.com/WICG/turtledove/issues/627">WICG/turtledove#627</a> is resolved.

Issue: There are some automatically generated values that are not described here.

Issue: Verify handling when the bid was not rejected.

</dl>
: "<code>[=signal base value/average-code-fetch-time=]</code>"
:: Return the result of [=getting the value to report from an averager=] given |metrics|'s [=per
participant metrics/code fetch time averager=].
1. If |signalBaseValue| is "<code>[=signal base value/participating-ig-count=]</code>":
1. Return |bidAndScoreMetrics|'s [=per participant metrics/participating interest group count=].
1. If |signalBaseValue| is "<code>[=signal base value/percent-scripts-timeout=]</code>":
1. Return the result of [=computing a percentage metric=] given |metrics|'s [=per participant

: "<code>[=signal base value/participating-ig-count=]</code>"
:: Return |bidAndScoreMetrics|'s [=per participant metrics/participating interest group count=].

: "<code>[=signal base value/percent-scripts-timeout=]</code>"
:: Return the result of [=computing a percentage metric=] given |metrics|'s [=per participant
metrics/script timeouts occurred=] and |metrics|'s [=per participant metrics/script executions
attempted=].

: "<code>[=signal base value/regular-igs-count=]</code>"
:: Return |bidAndScoreMetrics|'s [=per participant metrics/regular interest group count=].

: "<code>[=signal base value/percent-regular-ig-count-quota-used=]</code>"
:: Return the result of [=computing a percentage metric=] given |bidAndScoreMetrics|'s [=per
participant metrics/regular interest group count=] and [=max regular interest groups per
owner=].

: "<code>[=signal base value/negative-igs-count=]</code>"
:: Return |bidAndScoreMetrics|'s [=per participant metrics/negative interest group count=].

: "<code>[=signal base value/percent-negative-ig-count-quota-used=]</code>":
:: Return the result of [=computing a percentage metric=] given |bidAndScoreMetrics|'s [=per
participant metrics/negative interest group count=] and [=max negative interest groups per
owner=].

: "<code>[=signal base value/ig-storage-used=]</code>":
:: Return |bidAndScoreMetrics|'s [=per participant metrics/storage quota used=].

: "<code>[=signal base value/percent-ig-storage-quota-used=]</code>":
:: 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=].

</dl>

</div>

<div algorithm>
Expand All @@ -4696,6 +4749,19 @@ To <dfn>compute a percentage metric</dfn> given {{long}}s |numerator| and |denom

</div>

<div algorithm>
To <dfn>update storage metrics</dfn> given [=per participant metrics=] |metrics| and a [=list=] of
[=interest groups=] |igs|:
1. [=list/For each=] |ig| of |igs|:
1. If [=interest group/additional bid key=] is null, increment |metrics|'s [=per participant
metrics/regular interest group count=] by 1.
1. Otherwise, increment |metrics|'s [=per participant metrics/negative interest group count=]
by 1.
1. Increment |metrics|'s [=per participant metrics/storage quota used=] by |ig|'s [=interest
group/estimated size=]

</div>

## Get storage interest groups for owner ## {#get-storage-interest-groups-for-owner-header}

*This first introductory paragraph is non-normative.*
Expand Down

0 comments on commit 64a99ce

Please sign in to comment.