Skip to content

feat(reporting): support per-constituent, per-metric source availability #1170

Description

@bokelley

Summary

InlineFetchResult can describe coverage only per constituent. InlineReportingSource._seal_manifest() then assigns that constituent status to every requested metric cell.

Real ad-server adapters often have uneven metric support. A GAM result may provide impressions, spend, and clicks while video-completion or viewability metrics are unsupported, delayed, or unmeasured for the same media buy. The current interface forces the adapter to overclaim all metrics, underclaim all metrics, or drop useful measurements.

Proposed surface

Add a typed per-constituent/per-metric evidence map to InlineFetchResult, with helpers that keep the common all-covered case concise. One possible shape:

InlineFetchResult(
    rows=rows,
    metric_availability={
        (media_buy_id, "impressions"): MetricEvidence.present(data_through=watermark),
        (media_buy_id, "completed_views"): MetricEvidence.unavailable("not_video_inventory"),
    },
)

Omitted cells can retain today's derived constituent behavior for backward compatibility. Explicit cell evidence should override that default and should be validated against the frozen requested constituent/metric matrix.

Acceptance criteria

  • An inline source can independently mark every requested constituent/metric cell as present, explicit zero, missing, delayed, or unavailable with the required evidence/reason.
  • Only requested constituent/metric keys are accepted; duplicates, unknown metrics, and unknown constituents fail clearly.
  • The SDK still supplies semantic-contract identity from the selected offering rather than asking adapters to duplicate it.
  • Rows may honestly omit unavailable/missing metrics, and control totals are emitted only where complete and valid.
  • Helper constructors cover common patterns such as “all metrics present,” “one metric unsupported everywhere,” and “metric delayed through watermark.”
  • Bare row lists and existing InlineFetchResult callers retain current behavior.
  • Conformance tests prove a single constituent can have impressions present, clicks explicit-zero, viewability delayed, and completed views unavailable in one sealed manifest.

Adopter impact

Embedded Sales Agent is adding GAM delivery metrics beyond impressions/spend. This evidence is necessary to expose all available adapter metrics without pretending every metric is measurable on every inventory type. The same interface should work for FreeWheel and future adapters.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions