Enable Ruby FFE APM span-enrichment parametric tests#7151
Draft
leoromanovsky wants to merge 1 commit into
Draft
Conversation
Activate the test span-enrichment suite for the Ruby tracer by: - Re-activating the caller-supplied span's live trace around each /ffe/evaluate in the parametric app (server.rb), so the SpanEnrichmentHook accumulates flag metadata onto the test's real root span. This mirrors the Node reference's tracer.scope().activate(span, fn). The prior continue_from: approach forked a fresh TraceOperation per eval, so multi-flag / multi-subject / child-span aggregation never landed on the test's root span. - Flipping tests/parametric/test_ffe/test_span_enrichment.py in manifests/ruby.yml from missing_feature to v2.36.0-dev.
Contributor
|
|
|
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
The FFE APM feature-flag span-enrichment contract (frozen against
dd-trace-js#8343)is now implemented in the Ruby tracer (
DataDog/dd-trace-rb#5910). This PR enables theexisting frozen parametric suite
tests/parametric/test_ffe/test_span_enrichment.pyfor Ruby so the harness asserts Ruby's
ffe_*tags (ffe_flags_enc,ffe_subjects_enc,ffe_runtime_defaults) stay in parity with the backend/Trinodecode and the Node.js reference.
Changes
Two language-scoped changes, no cross-language drift:
utils/build/docker/ruby/parametric/server.rb— the/ffe/evaluatehandler nowre-activates the caller-supplied span's live
TraceOperationaround theevaluation (the in-process equivalent of the Node reference's
tracer.scope().activate(span, fn)inutils/build/docker/nodejs/parametric/server.js).OpenFeatureArgsnow readsspan_id(cast to Integer — the test client sends it asa string,
DD_SPANSis keyed by integer span id).call_context.activate!(trace_op) { ... }so the SDK'sSpanEnrichmentHook— which keys its accumulator and itsspan_before_finishsubscription by the active
TraceOperation— aggregates every flag onto thetest's real root span.
span_idfalls through to a plain eval; never raises.manifests/ruby.yml— fliptests/parametric/test_ffe/test_span_enrichment.pyfrom
missing_featuretov2.36.0-dev.Decisions
Why
call_context.activate!and notcontinue_from:— acontinue_from:digeststarts a new
TraceOperationper call (Tracer#continue_trace!→start_trace(continue_from:)). Each/ffe/evaluatewould then land on a throwawayforked root span, so multi-flag / multi-subject / child-span tests would aggregate
nothing onto the test's actual root. Activating the stored live trace keeps all evals
on the one trace the test created — matching the Node reference behavior exactly. This
was a parametric-app harness fix; no
dd-trace-rbsource change was needed.Limit-test parity — serial IDs (200), subjects (10), experiments/subject (20),
runtime defaults (5), 64-char value truncation all pass against the frozen assertions.
Validation results
Run locally against the
dd-trace-rb#5910gem (datadog-2.36.0.dev,libdatadog-33.0.0.1.0):All 18 cases green: delta-varint codec (5), serial-ID/subject aggregation, multiple
subjects tracked separately, child-span→root propagation, SHA256 subject hashing,
__dd_do_loggating, runtime-default detection + 64-char truncation, and all frozenlimits.