fix(openfeature): improve FFE eval metrics cross-tracer consistency#4590
fix(openfeature): improve FFE eval metrics cross-tracer consistency#4590
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files
🚀 New features to boost your workflow:
|
|
✅ Tests 🎉 All green!❄️ No new flaky tests detected 🎯 Code Coverage (details) 🔗 Commit SHA: 7712585 | Docs | Datadog PR Page | Was this helpful? React with 👍/👎 or give us feedback! |
BenchmarksBenchmark execution time: 2026-03-28 03:21:46 Comparing candidate commit 7712585 in PR branch Found 0 performance improvements and 0 performance regressions! Performance is the same for 217 metrics, 7 unstable metrics.
|
| // NUMERIC and INTEGER are distinct types; reject float-to-int conversion | ||
| // to align with libdatadog FFE which treats them as incompatible types. | ||
| conversionErr = fmt.Errorf("%w: flag %q is NUMERIC but INTEGER was requested", errTypeMismatch, flagKey) |
There was a problem hiding this comment.
This should normally never happen. The fact that it does, means we've ignored the type field and now trying to cast arbitrary values to integer. numeric -> integer is one conversion you just fixed but there's also json, which may contain arbitrary values including integers (probably worth adding to test cases).
Return TYPE_MISMATCH for NUMERIC→INTEGER conversion
- Previously returned parse_error when evaluating a NUMERIC flag as INTEGER
- Now returns type_mismatch to align with libdatadog FFE behavior
We should return parse_error when configuration's value does not match the type declared in configuration (e.g. when variant type is set to integer but the value is string). Do we still handle this case?
This commit fixes three consistency issues in FFE flag evaluation metrics to align with the OpenFeature telemetry conventions and other SDK implementations: 1. Map errNoConfiguration to PROVIDER_NOT_READY error code Previously returned GENERAL, now returns provider_not_ready to match Python, Ruby, Java, .NET, and JS implementations. 2. Add "unknown" fallback for empty reason values Matches the OpenFeature SDK telemetry convention for missing reasons. 3. Use raw lowercase error codes directly Remove errorCodeToTag() helper function since OpenFeature ErrorCode values are already snake_case (e.g., FLAG_NOT_FOUND). Just lowercase them directly for the metric tag. FFL-1972 #close
NUMERIC and INTEGER are distinct flag types. Attempting to evaluate a NUMERIC flag as INTEGER should return TypeMismatch (not ParseError) to align with libdatadog FFE which treats them as incompatible types.
6ebda74 to
7712585
Compare
What does this PR do?
Fixes consistency issues in FFE flag evaluation metrics to align with OpenFeature telemetry conventions and other SDK implementations:
Map
errNoConfigurationtoPROVIDER_NOT_READYerror codeGENERAL, now returnsprovider_not_readyTest_FFE_Eval_No_Config_Loadedin system-testsReturn
TYPE_MISMATCHfor NUMERIC→INTEGER conversionparse_errorwhen evaluating a NUMERIC flag as INTEGERtype_mismatchto align with libdatadog FFE behaviorAdd "unknown" fallback for empty reason values
Use raw lowercase error codes directly
errorCodeToTag()helper functionFLAG_NOT_FOUND)Motivation
FFL-1972 - Cross-tracer consistency for FFE eval metrics
Changes in dd-trace-py that deviated from dd-trace-go and resulted in needing to make this consistent: DataDog/dd-trace-py#17029
System-tests PR that enforces that
result.reasonanderror.typeare consistent: DataDog/system-tests#6545Reviewer's Checklist