Skip to content

feat: Add allocation key tag to flag evaluation metrics#4515

Merged
gh-worker-dd-mergequeue-cf854d[bot] merged 3 commits into
mainfrom
leo/ffe-eval-metric-allocation-key
Mar 9, 2026
Merged

feat: Add allocation key tag to flag evaluation metrics#4515
gh-worker-dd-mergequeue-cf854d[bot] merged 3 commits into
mainfrom
leo/ffe-eval-metric-allocation-key

Conversation

@leoromanovsky

Copy link
Copy Markdown
Contributor

Motivation

Flag evaluation metrics (feature_flag.evaluations) emit 4 tags but are missing the allocation key. The allocation key is already captured for exposure events. Adding it to eval metrics enables slicing by allocation.

Changes

  • Add feature_flag.result.allocation_key attribute to eval metrics, emitted only when an allocation matched (omitted for disabled/default/error with no allocation)
  • Add unit test for the new tag (present when metadata has allocation key, absent otherwise)
  • Add integration test assertions verifying the tag on targeting_match and absent on flag_not_found

Decisions

  • Tag name: feature_flag.result.allocation_key (consistent with existing feature_flag.result.* naming)
  • Only emit when allocation key is present and non-empty — avoids empty-string tags on error/default paths
  • Reuse existing metadataAllocationKey constant from exposure_hook.go

Companion system-tests change: DataDog/system-tests branch leo.romanovsky/ffe-eval-metrics

Emit feature_flag.result.allocation_key tag on feature_flag.evaluations
metrics when an allocation matched. The tag is omitted for error/default
evaluations where no allocation is present.
@pr-commenter

pr-commenter Bot commented Mar 9, 2026

Copy link
Copy Markdown

Benchmarks

Benchmark execution time: 2026-03-09 15:57:03

Comparing candidate commit c008ceb in PR branch leo/ffe-eval-metric-allocation-key with baseline commit cf61946 in branch main.

Found 0 performance improvements and 0 performance regressions! Performance is the same for 156 metrics, 8 unstable metrics.

Explanation

This is an A/B test comparing a candidate commit's performance against that of a baseline commit. Performance changes are noted in the tables below as:

  • 🟩 = significantly better candidate vs. baseline
  • 🟥 = significantly worse candidate vs. baseline

We compute a confidence interval (CI) over the relative difference of means between metrics from the candidate and baseline commits, considering the baseline as the reference.

If the CI is entirely outside the configured SIGNIFICANT_IMPACT_THRESHOLD (or the deprecated UNCONFIDENCE_THRESHOLD), the change is considered significant.

Feel free to reach out to #apm-benchmarking-platform on Slack if you have any questions.

More details about the CI and significant changes

You can imagine this CI as a range of values that is likely to contain the true difference of means between the candidate and baseline commits.

CIs of the difference of means are often centered around 0%, because often changes are not that big:

---------------------------------(------|---^--------)-------------------------------->
                              -0.6%    0%  0.3%     +1.2%
                                 |          |        |
         lower bound of the CI --'          |        |
sample mean (center of the CI) -------------'        |
         upper bound of the CI ----------------------'

As described above, a change is considered significant if the CI is entirely outside the configured SIGNIFICANT_IMPACT_THRESHOLD (or the deprecated UNCONFIDENCE_THRESHOLD).

For instance, for an execution time metric, this confidence interval indicates a significantly worse performance:

----------------------------------------|---------|---(---------^---------)---------->
                                       0%        1%  1.3%      2.2%      3.1%
                                                  |   |         |         |
       significant impact threshold --------------'   |         |         |
                      lower bound of CI --------------'         |         |
       sample mean (center of the CI) --------------------------'         |
                      upper bound of CI ----------------------------------'

@datadog-official

datadog-official Bot commented Mar 9, 2026

Copy link
Copy Markdown
Contributor

✅ Tests

🎉 All green!

❄️ No new flaky tests detected
🧪 All tests passed

🎯 Code Coverage (details)
Patch Coverage: 100.00%
Overall Coverage: 59.15% (+3.41%)

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: c008ceb | Docs | Datadog PR Page | Was this helpful? React with 👍/👎 or give us feedback!

@leoromanovsky leoromanovsky changed the title Add allocation key tag to flag evaluation metrics feat : Add allocation key tag to flag evaluation metrics Mar 9, 2026
@leoromanovsky leoromanovsky changed the title feat : Add allocation key tag to flag evaluation metrics feat: Add allocation key tag to flag evaluation metrics Mar 9, 2026
@codecov

codecov Bot commented Mar 9, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 60.08%. Comparing base (0fb2232) to head (f564d04).
⚠️ Report is 6 commits behind head on main.

Additional details and impacted files
Files with missing lines Coverage Δ
openfeature/flageval_metrics.go 86.95% <100.00%> (-6.23%) ⬇️

... and 262 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@leoromanovsky
leoromanovsky marked this pull request as ready for review March 9, 2026 15:29
@leoromanovsky
leoromanovsky requested review from a team as code owners March 9, 2026 15:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants