Skip to content

enhancement(core): unify trace event model with Datadog Agent#1693

Draft
ajgajg1134 wants to merge 11 commits into
mainfrom
andrew.glaude/trace-data-model
Draft

enhancement(core): unify trace event model with Datadog Agent#1693
ajgajg1134 wants to merge 11 commits into
mainfrom
andrew.glaude/trace-data-model

Conversation

@ajgajg1134
Copy link
Copy Markdown

@ajgajg1134 ajgajg1134 commented May 18, 2026

Summary

  • Replaces three separate span tag maps (meta/metrics/meta_struct) and the scalar-only AttributeScalarValue with a single AttributeValue enum covering all typed variants (String, Bool, Int, Float, Bytes, Array, KeyValueList)
  • Introduces PayloadFields struct on Trace that promotes tracer-payload metadata (container ID, language, version, env, hostname, runtime ID) from wire-format to first-class fields
  • Flattens TraceSampling into direct fields on Trace (priority, dropped_trace, sampling_mechanism, decision_maker, otlp_sampling_rate)
  • Moves Span.trace_id to Trace.trace_id_low / Trace.trace_id_high for 128-bit trace ID support
  • Widens SpanLink.attributes from FastHashMap<MetaString, MetaString> to FastHashMap<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_struct are preserved on Span as 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-components passes (548 tests)
  • Review data model changes in lib/saluki-core/src/data_model/event/trace/mod.rs
  • Review OTLP translator alignment with receiveResourceSpansV2 in the Go agent

Mostly generated with Claude Code but also with Andrew 😎

@dd-octo-sts dd-octo-sts Bot added area/core Core functionality, event model, etc. area/components Sources, transforms, and destinations. encoder/datadog-traces Datadog Traces encoder. transform/apm-stats APM Stats transform. transform/trace-obfuscation Trace Obfuscation synchronous transform. transform/trace-sampler Trace Sampler synchronous transform. labels May 18, 2026
@tobz tobz changed the title Unify trace data model: AttributeValue, PayloadFields, flat sampling fields enhancement(core): unify trace event model with Datadog Agent May 19, 2026
@datadog-datadog-prod-us1-2

This comment has been minimized.

ajgajg1134 and others added 4 commits May 19, 2026 14:52
…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>
@ajgajg1134 ajgajg1134 force-pushed the andrew.glaude/trace-data-model branch from 2505eb4 to e182c49 Compare May 19, 2026 19:31
@pr-commenter
Copy link
Copy Markdown

pr-commenter Bot commented May 19, 2026

Binary Size Analysis (Agent Data Plane)

Baseline: 66002de · Comparison: e6a8467 · diff
Analysis Configuration: stripped binaries · Pass/Fail Threshold: +5%
Sizes: 37.32 MiB (baseline) vs 37.34 MiB (comparison)
Size Change: +22.20 KiB (+0.06%)

✅ Binary size difference within threshold

Changes by Module
Module File Size Symbols
figment +122.17 KiB 224
hyper_util -32.35 KiB 59
prost -31.52 KiB 160
anyhow -30.97 KiB 406
alloc +24.08 KiB 786
saluki_components::common::datadog -21.51 KiB 89
piecemeal +18.71 KiB 22
tonic -16.78 KiB 221
serde_core +13.45 KiB 121
h2 +11.94 KiB 206
saluki_components::transforms::dogstatsd_mapper -11.89 KiB 7
serde_with +11.89 KiB 33
hyper +9.48 KiB 204
axum +9.07 KiB 172
core -8.89 KiB 2173
hashbrown -8.59 KiB 225
datadog_protos::trace_piecemeal_include::datadog -8.36 KiB 20
[sections] +7.55 KiB 8
crossbeam_channel +7.21 KiB 35
std -6.25 KiB 148
Detailed Symbol Changes
    FILE SIZE        VM SIZE    
 --------------  -------------- 
  [NEW] +43.0Ki  [NEW] +42.9Ki    saluki_components::transforms::apm_stats::ApmStats::process_trace::h9f9ed1c4c23abc68
  +0.2% +29.7Ki  +0.2% +20.0Ki    [12931 Others]
  [NEW] +25.2Ki  [NEW] +25.1Ki    saluki_components::common::otlp::traces::transform::otel_to_dd_span_minimal::h04cf0c23de922836
  [NEW] +21.3Ki  [NEW] +21.2Ki    _<figment::value::de::ConfiguredValueDe<I> as serde_core::de::Deserializer>::deserialize_struct::hed9234a71ae20cd4
  [NEW] +19.9Ki  [NEW] +19.8Ki    saluki_components::common::otlp::traces::transform::otel_span_to_dd_span::h86244c487e8ed2d5
  +101% +19.1Ki  +102% +19.0Ki    agent_data_plane::internal::env::ADPEnvironmentProvider::from_configuration::_{{closure}}::hf4fc2f25aacab3e6
   +97% +18.4Ki   +98% +18.3Ki    agent_data_plane::internal::env::workload::build_collector::_{{closure}}::h28d4115e9cfd8e68
  +297% +17.2Ki  +302% +17.2Ki    h2::proto::connection::DynConnection<B>::recv_frame::h0fe91f2f6ee9ac4a
  [NEW] +14.6Ki  [NEW] +14.5Ki    _<figment::value::de::ConfiguredValueDe<I> as serde_core::de::Deserializer>::deserialize_struct::h6948f527d7ba396f
  [NEW] +12.9Ki  [NEW] +12.7Ki    _<figment::value::magic::RelativePathBuf as figment::value::magic::Magic>::deserialize_from::hbaa30d53055c9377
 +52e2% +12.5Ki +31e3% +12.5Ki    _<saluki_components::transforms::trace_sampler::TraceSampler as saluki_core::components::transforms::SynchronousTransform>::transform_buffer::hf35cdf66ba7a245f
  [DEL] -14.2Ki  [DEL] -14.0Ki    saluki_components::common::datadog::apm::_::_<impl serde_core::de::Deserialize for saluki_components::common::datadog::apm::ApmConfiguration>::deserialize::haaad9ebeb9100870
  [DEL] -15.3Ki  [DEL] -15.2Ki    h2::server::Connection<T,B>::poll_closed::h2d88ac9d7f1e941c
  [DEL] -15.4Ki  [DEL] -15.3Ki    h2::server::Connection<T,B>::poll_closed::h83203de9713e50cd
  [DEL] -16.9Ki  [DEL] -16.8Ki    h2::server::Connection<T,B>::poll_closed::h5b7f429aa9aaf99d
  [DEL] -18.9Ki  [DEL] -18.8Ki    _<hyper_util::server::conn::auto::Connection<I,S,E> as core::future::future::Future>::poll::h2d49a88a91640cc8
  [DEL] -21.8Ki  [DEL] -21.6Ki    saluki_components::common::otlp::traces::transform::otel_span_to_dd_span::h12a6ada56460ed27
 -61.6% -22.8Ki -61.8% -22.8Ki    saluki_components::sources::otlp::metrics::translator::OtlpMetricsTranslator::translate_metrics::ha7c3f501c30996a6
  [DEL] -25.6Ki  [DEL] -25.5Ki    saluki_components::common::otlp::traces::transform::otel_to_dd_span_minimal::h32cc9c15b28458d7
 -49.1% -29.5Ki -49.2% -29.5Ki    agent_data_plane::internal::env::workload::RemoteAgentWorkloadProvider::from_configuration::_{{closure}}::hea9789cc98b277de
  [DEL] -31.3Ki  [DEL] -31.2Ki    saluki_components::transforms::apm_stats::ApmStats::process_trace::h4fce2ef29c70bbcd
  +0.1% +22.2Ki  +0.0% +12.7Ki    TOTAL

@pr-commenter
Copy link
Copy Markdown

pr-commenter Bot commented May 19, 2026

Regression Detector (Agent Data Plane)

Run ID: e00c5dc8-085c-48bb-97bb-8dea3a60e81e
Baseline: 66002dee · Comparison: e6a8467e · diff

Optimization Goals: ✅ No significant changes detected

Fine details of change detection per experiment (35)

Experiments configured erratic: true are tagged (ignored) and skipped when determining which experiments regressed or improved. Experiments which are detected as erratic at runtime are tagged (erratic) to flag that the run's sample dispersion was high, but their regression / improvement signal still counts.

experiment goal Δ mean % links
dsd_uds_512kb_3k_contexts_cpu (erratic) cpu ⚪ +5.88 metrics profiles logs
otlp_ingest_traces_ottl_transform_5mb_memory memory ⚪ +4.32 metrics profiles logs
dsd_uds_1mb_3k_contexts_cpu (erratic) cpu ⚪ +4.21 metrics profiles logs
otlp_ingest_traces_5mb_memory memory ⚪ +4.12 metrics profiles logs
otlp_ingest_metrics_5mb_cpu (erratic) cpu ⚪ +3.80 metrics profiles logs
otlp_ingest_traces_ottl_filtering_5mb_memory memory ⚪ +3.19 metrics profiles logs
otlp_ingest_logs_5mb_cpu (ignored) cpu ⚪ +3.16 metrics profiles logs
dsd_uds_100mb_3k_contexts_cpu (erratic) cpu ⚪ +3.08 metrics profiles logs
dsd_uds_500mb_3k_contexts_throughput throughput ⚪ -2.55 metrics profiles logs
dsd_uds_10mb_3k_contexts_cpu (erratic) cpu ⚪ +2.54 metrics profiles logs
otlp_ingest_logs_5mb_memory (ignored) memory ⚪ +2.35 metrics profiles logs
otlp_ingest_traces_ottl_filtering_5mb_cpu (erratic) cpu ⚪ +1.79 metrics profiles logs
otlp_ingest_traces_ottl_transform_5mb_cpu (erratic) cpu ⚪ +1.47 metrics profiles logs
quality_gates_rss_dsd_ultraheavy memory ⚪ +0.49 metrics profiles logs
dsd_uds_1mb_3k_contexts_memory memory ⚪ +0.40 metrics profiles logs
quality_gates_rss_dsd_low memory ⚪ +0.36 metrics profiles logs
quality_gates_rss_dsd_heavy memory ⚪ +0.25 metrics profiles logs
otlp_ingest_traces_ottl_filtering_5mb_throughput throughput ⚪ -0.16 metrics profiles logs
dsd_uds_100mb_3k_contexts_memory memory ⚪ +0.15 metrics profiles logs
otlp_ingest_traces_5mb_throughput throughput ⚪ -0.07 metrics profiles logs
dsd_uds_10mb_3k_contexts_throughput throughput ⚪ -0.01 metrics profiles logs
dsd_uds_512kb_3k_contexts_throughput throughput ⚪ +0.00 metrics profiles logs
dsd_uds_1mb_3k_contexts_throughput throughput ⚪ +0.00 metrics profiles logs
dsd_uds_512kb_3k_contexts_memory memory ⚪ -0.00 metrics profiles logs
otlp_ingest_traces_ottl_transform_5mb_throughput throughput ⚪ +0.01 metrics profiles logs
dsd_uds_500mb_3k_contexts_memory memory ⚪ -0.02 metrics profiles logs
dsd_uds_100mb_3k_contexts_throughput throughput ⚪ +0.02 metrics profiles logs
otlp_ingest_metrics_5mb_throughput throughput ⚪ +0.03 metrics profiles logs
otlp_ingest_logs_5mb_throughput (ignored) throughput ⚪ +0.03 metrics profiles logs
dsd_uds_500mb_3k_contexts_cpu (erratic) cpu ⚪ -0.15 metrics profiles logs
otlp_ingest_traces_5mb_cpu (erratic) cpu ⚪ -0.21 metrics profiles logs
dsd_uds_10mb_3k_contexts_memory memory ⚪ -0.27 metrics profiles logs
quality_gates_rss_dsd_medium memory ⚪ -0.34 metrics profiles logs
quality_gates_rss_idle memory ⚪ -1.43 metrics profiles logs
otlp_ingest_metrics_5mb_memory memory ⚪ -3.45 metrics profiles logs
Bounds Checks: ✅ Passed (5)
experiment check replicates observed links
quality_gates_rss_dsd_heavy memory_usage 10/10 ✅ 126 MiB ≤ 140 MiB metrics profiles logs
quality_gates_rss_dsd_low memory_usage 10/10 ✅ 39 MiB ≤ 50 MiB metrics profiles logs
quality_gates_rss_dsd_medium memory_usage 10/10 ✅ 60.6 MiB ≤ 75 MiB metrics profiles logs
quality_gates_rss_dsd_ultraheavy memory_usage 10/10 ✅ 183 MiB ≤ 200 MiB metrics profiles logs
quality_gates_rss_idle memory_usage 10/10 ✅ 26.6 MiB ≤ 40 MiB metrics profiles logs
Explanation

A 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 (is_regression: true). Improvements use the matching criteria for the improving direction. Experiments configured erratic: true (tagged (ignored)) are skipped outright; experiments detected as erratic at runtime (tagged (erratic)) still count, since that flag describes sample dispersion rather than directional certainty. The Δ mean % cell is colored accordingly: 🟢 = improvement, 🔴 = regression, ⚪ = neutral. Reduction in CPU or memory is an improvement; reduction in ingress throughput is a regression.

ajgajg1134 and others added 3 commits May 19, 2026 17:05
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>
@dd-octo-sts dd-octo-sts Bot added the area/test All things testing: unit/integration, correctness, SMP regression, etc. label May 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/components Sources, transforms, and destinations. area/core Core functionality, event model, etc. area/test All things testing: unit/integration, correctness, SMP regression, etc. encoder/datadog-traces Datadog Traces encoder. transform/apm-stats APM Stats transform. transform/trace-obfuscation Trace Obfuscation synchronous transform. transform/trace-sampler Trace Sampler synchronous transform.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant