Skip to content

reporter: ship per-assertion metrics to Datadog staging - #147

Draft
r1viollet wants to merge 1 commit into
mainfrom
r1viollet/datadog-reporter
Draft

reporter: ship per-assertion metrics to Datadog staging#147
r1viollet wants to merge 1 commit into
mainfrom
r1viollet/datadog-reporter

Conversation

@r1viollet

Copy link
Copy Markdown
Collaborator

What

Adds a new `reporter/` package and wires it into the analysis pipeline so each scenario run can emit metrics to Datadog staging (`datad0g.com`):

metric type purpose
`prof_correctness.assertion.error_pct` distribution per-assertion error %; P50/P95 dashboards
`prof_correctness.assertion.passed` / `.total` count per-tag pass rate
`prof_correctness.scenario.failed` / `.total` count per-scenario pass rate
`prof_correctness.scenario.duration_seconds` gauge catch slowdowns

Tags (low-cardinality on purpose): `scenario`, `language`, `profile_type`, `assertion_kind`, `runner_label`, `git_repo`, `git_branch`. No `git_sha` / no `stack_regex` / no `ci_run_id` — that context lives in CI Visibility. Putting it on metric tags would blow up the custom-metric budget.

How

  • New package `reporter/` with `DatadogRecorder` (HTTP submission to `api.datad0g.com/api/v1/{series,distribution_points}`) and `NoopRecorder`. Unit-tested against an `httptest` server.
  • New `analysis.AnalyzeResultsWithOpts` plumbs an optional `MetricsSink` + `scenario`/`language` tags through the assertion path. Existing `analysis.AnalyzeResults` is preserved as a backwards-compatible wrapper (the GitHub Action in `analyze/` keeps working unchanged).
  • `correctness_test.go` builds the recorder from env in `testScenarios`, flushes once via `t.Cleanup`.
  • `.github/workflows/test.yml` enables reporting only on `push@main` and the nightly schedule. PR runs stay silent.

Activation

The recorder is default-off. It only emits when `DD_PROF_CORRECTNESS_REPORT=1` AND `DD_API_KEY_STAGING` is set. Local `go test` runs and PR CI runs send nothing.

Pre-requisite

`DD_API_KEY_STAGING` repo secret must be provisioned (in progress at PR open time).

Tests

```
ok github.com/DataDog/prof-correctness/analysis 0.5s
ok github.com/DataDog/prof-correctness/reporter 0.7s
ok github.com/DataDog/prof-correctness/cmd/... 1.2s
```

New test `TestPublicAPI_MetricsSink_EmitsPerAssertion` confirms the sink is called once per assertion with the right scenario/language/profile_type/kind/passed values. New `reporter` tests cover HTTP submission shape, tag grouping, and the no-op path.

Adds a new `reporter/` package and wires it into the analysis pipeline
so each scenario run can emit:

- prof_correctness.assertion.error_pct (distribution)
- prof_correctness.assertion.passed / .total (count)
- prof_correctness.scenario.failed / .total (count)
- prof_correctness.scenario.duration_seconds (gauge)

Tags are intentionally low-cardinality (scenario, language, profile_type,
assertion_kind, runner_label, git_repo, git_branch). High-cardinality
context (git_sha, ci_run_id, individual stack regexes) is left to CI
Visibility — putting it on metric tags would blow up the custom-metric
billing budget.

The existing AnalyzeResults signature is preserved (the GitHub Action
in analyze/ keeps working as-is); a new AnalyzeResultsWithOpts takes a
MetricsSink + scenario/language tags.

Default behaviour is unchanged: the recorder is only activated when
DD_PROF_CORRECTNESS_REPORT is set, which the workflow gates to
push@main and the nightly schedule. PR runs and local runs stay silent.

Submits to datad0g.com (staging) so CI metrics don't pollute the prod
Datadog account.
@datadog-prod-us1-3

datadog-prod-us1-3 Bot commented Jun 2, 2026

Copy link
Copy Markdown

Pipelines

Fix all issues with BitsAI

⚠️ Warnings

🚦 1 Pipeline job failed

prof-correctness | ddprof / scenarios 2/2   View in Datadog   GitHub Actions

🔧 Fix in code (Fix with Cursor). 2 failed assertions in scenario ddprof_julia: expected 31% +/- 10% but got 0% and expected 63% +/- 10% but got 0%.

Useful? React with 👍 / 👎

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 120fcc3 | Docs | Datadog PR Page | Give us feedback!

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