Skip to content

Fix missing error tracking in resolve() API#3187

Merged
gh-worker-dd-mergequeue-cf854d[bot] merged 3 commits into
developfrom
typo/error-eval-trackoing
Feb 20, 2026
Merged

Fix missing error tracking in resolve() API#3187
gh-worker-dd-mergequeue-cf854d[bot] merged 3 commits into
developfrom
typo/error-eval-trackoing

Conversation

@typotter

Copy link
Copy Markdown
Contributor

What does this PR do?

Adds missing trackErrorResolution() call in the resolve(flagKey, defaultValue) method's error branch, ensuring error evaluations are properly tracked in telemetry.

Motivation

The resolve() method that returns ResolutionDetails<T> was not calling trackErrorResolution() for error cases (FLAG_NOT_FOUND, TYPE_MISMATCH, PARSE_ERROR, PROVIDER_NOT_READY). This caused:

  • Missing/type-mismatched flags to be excluded from evaluation telemetry
  • Underreported error rates
  • Skewed aggregated evaluation metrics

The convenience methods (resolveBooleanValue, resolveStringValue, etc.) correctly track errors via resolveTracked(), but the detailed resolve() API took a different code path that bypassed error tracking.

Additional Notes

This is a one-line fix that adds the trackErrorResolution(resolution) call to match the behavior of the convenience methods. All existing tests pass.

Review checklist (to be filled by reviewers)

  • Feature or bugfix MUST have appropriate tests (unit, integration, e2e)
  • Make sure you discussed the feature or bugfix with the maintaining team in an Issue
  • Make sure each commit and the PR mention the Issue number (cf the CONTRIBUTING doc)

The resolve(flagKey, defaultValue) method that returns ResolutionDetails
was not calling trackErrorResolution() for error cases, causing
missing/type-mismatched flags to be excluded from evaluation telemetry.
This underreported error rates and skewed aggregated evaluation metrics.

Added trackErrorResolution() call in the error branch to match the
behavior of convenience methods (resolveBooleanValue, etc.) that
properly track errors via resolveTracked().
@typotter
typotter requested a review from a team as a code owner February 18, 2026 13:00
createSuccessResolution(resolution.flag, resolution.value)
}
is InternalResolution.Error -> {
trackErrorResolution(resolution)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is worth to add a test for this

Added two test cases to verify that trackErrorResolution() is called
when the resolve() method encounters errors:
- FLAG_NOT_FOUND: verifies error is tracked when flag doesn't exist
- TYPE_MISMATCH: verifies error is tracked when flag type doesn't match
@typotter
typotter requested a review from 0xnm February 18, 2026 13:11
@typotter

Copy link
Copy Markdown
Contributor Author

added tests. ptal

}

@Test
fun `M track error evaluation W resolve() { type mismatch and trackEvaluations enabled }`(forge: Forge) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems we don't need this test, the branch covered for the assertion is the same as above (the only difference is that for ErrorCode.TYPE_MISMATCH we log a warning as well, but it is not checked in this test).

Instead we need to have a test for the evaluation tracking in case of InternalResolution.Success, it seems such test is missing if I'm not wrong.

@datadog-datadog-prod-us1

This comment has been minimized.

@codecov-commenter

codecov-commenter commented Feb 18, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 71.46%. Comparing base (9970e2d) to head (7c47c85).
⚠️ Report is 252 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #3187      +/-   ##
===========================================
+ Coverage    71.35%   71.46%   +0.11%     
===========================================
  Files          929      929              
  Lines        34442    34451       +9     
  Branches      5813     5813              
===========================================
+ Hits         24573    24618      +45     
+ Misses        8242     8224      -18     
+ Partials      1627     1609      -18     
Files with missing lines Coverage Δ
...tadog/android/flags/internal/DatadogFlagsClient.kt 92.59% <100.00%> (+3.76%) ⬆️

... and 39 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@gh-worker-dd-mergequeue-cf854d
gh-worker-dd-mergequeue-cf854d Bot merged commit 6a821cb into develop Feb 20, 2026
27 checks passed
@gh-worker-dd-mergequeue-cf854d
gh-worker-dd-mergequeue-cf854d Bot deleted the typo/error-eval-trackoing branch February 20, 2026 17:55
@ncreated
ncreated restored the typo/error-eval-trackoing branch April 9, 2026 09:51
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