enhancement(core): unify trace event model with Datadog Agent#1693
enhancement(core): unify trace event model with Datadog Agent#1693ajgajg1134 wants to merge 11 commits into
Conversation
This comment has been minimized.
This comment has been minimized.
…fields Replaces the fragmented trace model (separate `meta`/`metrics`/`meta_struct` maps on `Span`, `TagSet`-based resource tags and `TraceSampling` on `Trace`) with a single unified representation: - `AttributeValue` enum covers all typed attribute variants (String, Bool, Int, Float, Bytes, Array, KeyValueList), replacing the three separate span tag maps and the scalar-only `AttributeScalarValue`. - `PayloadFields` struct promotes tracer-payload metadata (container ID, lang, version, env, hostname, runtime ID, etc.) to first-class fields on `Trace`. - Flat sampling fields (`priority`, `dropped_trace`, `sampling_mechanism`, `decision_maker`, `otlp_sampling_rate`) replace the nested `TraceSampling` struct and its accessor methods. - `Span.trace_id` moves to `Trace.trace_id_low` / `Trace.trace_id_high` for 128-bit trace ID support. - `SpanLink.attributes` widened from `FastHashMap<MetaString, MetaString>` to `FastHashMap<MetaString, AttributeValue>`. All existing callers in the OTLP pipeline are updated: translator, stats transform, span concentrator, weight calculator, trace obfuscation, trace sampler (all sub-modules), and the existing OTLP encoder. Builder methods `with_meta`, `with_metrics`, `with_meta_struct` are preserved as migration helpers that insert into the unified attributes map. Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Unifies span attribute construction behind a single `Span::with_attributes` builder that takes the complete `FastHashMap<MetaString, AttributeValue>` map. The three typed-helper builders (`with_meta`, `with_metrics`, `with_meta_struct`) are removed; callers now construct the unified attributes map directly using `AttributeValue::String`, `AttributeValue::Float`, and `AttributeValue::Bytes`. The OTLP span conversion path (`otel_span_to_dd_span` and `otel_to_dd_span_minimal` in `transform.rs`) is updated to build a single `attrs` map throughout instead of maintaining separate `meta` and `metrics` maps that were merged at the end. Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
- Encoder: coerce Bool→meta and Int→metrics for span attributes; add TODO for Array/KeyValueList in meta_struct loop - OTLP translator: store IntValue/BoolValue in their native AttributeValue variants (Int/Bool) instead of Float/String; add comment on coercion strategy - Trace.attributes: change to Arc<FastHashMap<...>> so all traces from the same ResourceSpans batch share one allocation via Arc::clone - apm_stats build_payload_key: scan all spans (not just root) before falling back to payload.env, matching get_trace_env's canonical order Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
2505eb4 to
e182c49
Compare
Binary Size Analysis (Agent Data Plane)Baseline: 66002de · Comparison: e6a8467 · diff ✅ Binary size difference within thresholdChanges by Module
Detailed Symbol Changes |
Regression Detector (Agent Data Plane)Run ID: Optimization Goals: ✅ No significant changes detectedFine details of change detection per experiment (35)Experiments configured
Bounds Checks: ✅ Passed (5)
ExplanationA change is flagged as a regression when |Δ mean %| > 5.00% in the regressing direction for its optimization goal AND SMP marks the experiment as a regression ( |
Update ottl_transform_processor and ottl_filter_processor test helpers to use the new Span/Trace API (with_attributes, no trace_id on Span, Trace::new takes only spans). Apply make fmt to the rest of the workspace. Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Summary
meta/metrics/meta_struct) and the scalar-onlyAttributeScalarValuewith a singleAttributeValueenum covering all typed variants (String, Bool, Int, Float, Bytes, Array, KeyValueList)PayloadFieldsstruct onTracethat promotes tracer-payload metadata (container ID, language, version, env, hostname, runtime ID) from wire-format to first-class fieldsTraceSamplinginto direct fields onTrace(priority,dropped_trace,sampling_mechanism,decision_maker,otlp_sampling_rate)Span.trace_idtoTrace.trace_id_low/Trace.trace_id_highfor 128-bit trace ID supportSpanLink.attributesfromFastHashMap<MetaString, MetaString>toFastHashMap<MetaString, AttributeValue>All existing callers in the OTLP pipeline are updated to the new API: OTLP translator, APM stats transform (concentrator, aggregation, weight), trace obfuscation, trace sampler (all sub-modules), and the existing OTLP encoder.
Builder methods
with_meta,with_metrics,with_meta_structare preserved onSpanas migration helpers that insert into the unified attributes map, keeping callers on the feature branch working with no changes needed for this PR.Test plan
cargo test -p saluki-core -p saluki-componentspasses (548 tests)lib/saluki-core/src/data_model/event/trace/mod.rsreceiveResourceSpansV2in the Go agentMostly generated with Claude Code but also with Andrew 😎