Add feature flag span enrichment system tests#6828
Draft
sameerank wants to merge 5 commits into
Draft
Conversation
Contributor
|
|
dfe6168 to
537d098
Compare
sameerank
commented
Apr 29, 2026
Contributor
Author
There was a problem hiding this comment.
File name enforced by CI rule
Comment on lines
+6
to
+7
| 3. Max serial ID limit (128) | ||
| 4. Max subjects limit (25) |
Contributor
Author
There was a problem hiding this comment.
I just picked these numbers randomly, provisionally so I could write tests. What limits should we actually use?
537d098 to
7370a3b
Compare
|
✨ Fix all issues with BitsAI or with Cursor
|
e63833a to
12da3a9
Compare
Add parametric tests for feature flag APM span enrichment: - Test_Span_Enrichment_Serial_IDs: verify multiple flag evaluations combine serial IDs correctly in feature_flags_encoded using delta varint encoding - Test_Span_Enrichment_Child_Span_Propagation: verify flag evaluations in child spans propagate to root span - Test_Span_Enrichment_Max_Serial_IDs: verify 128 serial ID limit enforcement - Test_Span_Enrichment_Max_Subjects: verify 25 subject limit enforcement - Test_Span_Enrichment_Default_Fallback: verify feature_flags tag with coded-default prefix when flag not found in UFC, including 64 char truncation - Test_Span_Enrichment_Subjects: verify feature_flag_subjects_encoded behavior based on doLog flag, including SHA256 hashing of targeting keys - Test_Span_Enrichment_Delta_Varint: unit tests for encoding utilities Add utilities for delta varint encoding/decoding and SHA256 targeting key hashing. Mark tests as missing_feature in all library manifests.
12da3a9 to
2fa1e11
Compare
- Add span_id parameter to ffe_evaluate endpoint to activate span during flag evaluation so SpanEnrichmentHook can find root span - Update test_span_enrichment.py to pass span_id from dd_start_span - Enable span enrichment tests for nodejs 6.0.0 in manifest
- Remove trailing space from coded-default prefix ("coded-default:" not "coded-default: ")
- Update max subjects limit from 25 to 10 per RFC
- Add test for multiple subjects tracked separately with SHA256 hashed keys
- Add test for single subject with multiple flags combining serial IDs
- Update module docstring with comprehensive test coverage list
Update span enrichment tests to use the renamed tag name and remove the coded-default: prefix logic to match the RFC specification changes. Changes: - Rename ffe_defaults -> ffe_runtime_defaults throughout - Remove CODED_DEFAULT_PREFIX constant and related assertions - Update docstrings and comments to reflect new terminology - Values are now stored directly without prefix
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Add system tests for feature flag event enrichment (Feature ID 551) that validates APM span chunk tags:
ffe_flags_enc: base64(delta varint encoded serial IDs) for all evaluated flagsffe_subjects_enc: subject hash → serial IDs mapping (when doLog=true)ffe_runtime_defaults: flag name → default value mapping (when flag not found in UFC)Example span tags:
{ "ffe_runtime_defaults": { "flag-not-found": "my-default-value" }, "ffe_flags_enc": "ZAgUAg==", "ffe_subjects_enc": { "4208f8d8017ce252df51f51e8c5b558a": "ZA==", "8e526f09f0531278f8bd60f224adf60a": "bAg=" } }In this example:
"ZAgUAg=="decodes to serial IDs [100, 108, 128, 130]JIRA: https://datadoghq.atlassian.net/browse/FFL-2201
Changes
New test files:
tests/parametric/test_ffe/test_span_enrichment.py- Span enrichment tests (17 tests)tests/parametric/test_ffe/span-enrichment-flags.json- UFC fixture with serialId in splitstests/parametric/test_ffe/utils.py- Delta varint encoding/decoding utilities + SHA256 hashingManifest updates:
missing_featureentries to language manifests (tests written before tracer implementation)Why parametric only (no E2E)?
The
ffe/evaluateendpoint now accepts an optionalspan_idparameter.This is required for span enrichment tests because:
/trace/span/startcreates spans but does NOT activate them in the tracer scope/ffe/evaluateruns as a separate HTTP request,tracer.scope().active()returns nullspan_idparameter tells the server to activate the specified span during flag evaluationUsage pattern:
🧪 Local Testing
Related PRs
Reviewer checklist
tests/ormanifests/is modified ? I have the approval from R&P teambuild-XXX-imagelabel is present