Skip to content

refactor(trace)!: extract shared span types - #2503

Open
Eldolfin wants to merge 2 commits into
mainfrom
oscarld/extract-trace-types-crate
Open

refactor(trace)!: extract shared span types#2503
Eldolfin wants to merge 2 commits into
mainfrom
oscarld/extract-trace-types-crate

Conversation

@Eldolfin

@Eldolfin Eldolfin commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Move v0.4 and v1 models into a new crate so native trace normalization can reuse them without creating a trace-utils cycle.

Motivation

Normalizing traces before they enter the stats computation pipeline for CSS correctness.

Additional Notes

The original approach was to re-export moved types from libdd-trace-utils to maintain backward compatibility on the consumers, and have less renaming to do in the repo too.
But I find it cleaner to have no re-export, only one way to import it. And this way we might realize we don't need libdd-trace-utils but only its types for some crates.

How to test the change?

  • No logic change, if CI pass it should be enough

[Generated using codex]

@Eldolfin Eldolfin changed the title refactor(trace): extract shared span types refactor(trace)!: extract shared span types Sep 10, 2026
@pr-commenter

pr-commenter Bot commented Sep 10, 2026

Copy link
Copy Markdown

Benchmarks

Comparison

Benchmark execution time: 2026-09-11 14:38:19

Comparing candidate commit c8f26cf in PR branch oscarld/extract-trace-types-crate with baseline commit 132842f in branch main.

📊 Benchmarking dashboard

Found 13 performance improvements and 10 performance regressions! Performance is the same for 133 metrics, 0 unstable metrics.

Explanation

This is an A/B test comparing a candidate commit's performance against that of a baseline commit. Performance changes are noted in the tables below as:

  • 🟩 = significantly better candidate vs. baseline
  • 🟥 = significantly worse candidate vs. baseline

We compute a confidence interval (CI) over the relative difference of means between metrics from the candidate and baseline commits, considering the baseline as the reference.

If the CI is entirely outside the configured SIGNIFICANT_IMPACT_THRESHOLD (or the deprecated UNCONFIDENCE_THRESHOLD), the change is considered significant.

Feel free to reach out to #apm-benchmarking-platform on Slack if you have any questions.

More details about the CI and significant changes

You can imagine this CI as a range of values that is likely to contain the true difference of means between the candidate and baseline commits.

CIs of the difference of means are often centered around 0%, because often changes are not that big:

---------------------------------(------|---^--------)-------------------------------->
                              -0.6%    0%  0.3%     +1.2%
                                 |          |        |
         lower bound of the CI --'          |        |
sample mean (center of the CI) -------------'        |
         upper bound of the CI ----------------------'

As described above, a change is considered significant if the CI is entirely outside the configured SIGNIFICANT_IMPACT_THRESHOLD (or the deprecated UNCONFIDENCE_THRESHOLD).

For instance, for an execution time metric, this confidence interval indicates a significantly worse performance:

----------------------------------------|---------|---(---------^---------)---------->
                                       0%        1%  1.3%      2.2%      3.1%
                                                  |   |         |         |
       significant impact threshold --------------'   |         |         |
                      lower bound of CI --------------'         |         |
       sample mean (center of the CI) --------------------------'         |
                      upper bound of CI ----------------------------------'

scenario:ddsketch_read/ordered_bins/clustered_near_zero

  • 🟩 execution_time [-273.251ns; -270.110ns] or [-4.747%; -4.693%]

scenario:ddsketch_read/ordered_bins/collapsing

  • 🟩 execution_time [-1.344µs; -1.334µs] or [-5.238%; -5.199%]

scenario:ddsketch_read/ordered_bins/large_values

  • 🟩 execution_time [-361.522ns; -357.013ns] or [-4.909%; -4.848%]

scenario:ddsketch_read/ordered_bins/mixed

  • 🟩 execution_time [-586.261ns; -580.273ns] or [-5.181%; -5.128%]

scenario:otlp/e2e_json/1x1000

  • 🟥 execution_time [+341.739µs; +343.282µs] or [+8.547%; +8.585%]

scenario:otlp/encode_json/1x1000

  • 🟥 execution_time [+335.770µs; +336.418µs] or [+20.104%; +20.143%]

scenario:otlp/encode_protobuf/1x1000

  • 🟩 execution_time [-56.100µs; -55.281µs] or [-5.025%; -4.951%]

scenario:vec_map/as_deduped_map/already_deduped/16

  • 🟥 execution_time [+1.200ns; +1.239ns] or [+4.968%; +5.128%]

scenario:vec_map/as_deduped_map/already_deduped/8

  • 🟥 execution_time [+1.204ns; +1.218ns] or [+8.305%; +8.404%]

scenario:vec_map/get_hit/128

  • 🟩 execution_time [-1.398µs; -1.387µs] or [-10.192%; -10.113%]
  • 🟩 throughput [+1050807.685op/s; +1058848.383op/s] or [+11.257%; +11.343%]

scenario:vec_map/get_hit/16

  • 🟩 execution_time [-23.366ns; -22.986ns] or [-9.921%; -9.759%]
  • 🟩 throughput [+7353171.442op/s; +7474816.104op/s] or [+10.824%; +11.003%]

scenario:vec_map/get_hit/64

  • 🟩 execution_time [-335.867ns; -330.438ns] or [-9.021%; -8.875%]
  • 🟩 throughput [+1675452.547op/s; +1703295.545op/s] or [+9.747%; +9.909%]

scenario:vec_map/get_hit/8

  • 🟩 execution_time [-4.369ns; -4.243ns] or [-6.717%; -6.524%]
  • 🟩 throughput [+8593423.945op/s; +8859421.383op/s] or [+6.987%; +7.203%]

scenario:vec_map/get_mut/128

  • 🟥 execution_time [+2.137µs; +2.233µs] or [+15.445%; +16.137%]
  • 🟥 throughput [-1290082.873op/s; -1232441.976op/s] or [-13.943%; -13.320%]

scenario:vec_map/get_mut/16

  • 🟥 execution_time [+14.383ns; +25.796ns] or [+5.273%; +9.457%]
  • 🟥 throughput [-5746995.909op/s; -3605741.525op/s] or [-9.654%; -6.057%]

scenario:vec_map/get_mut/64

  • 🟥 execution_time [+621.781ns; +655.455ns] or [+16.341%; +17.226%]
  • 🟥 throughput [-2487829.090op/s; -2354237.939op/s] or [-14.783%; -13.989%]

Benchmark execution time: 2026-09-11 14:33:34

Comparing candidate commit c8f26cf in PR branch oscarld/extract-trace-types-crate with baseline commit 132842f in branch main.

📊 Benchmarking dashboard

Found 12 performance improvements and 19 performance regressions! Performance is the same for 135 metrics, 10 unstable metrics.

Explanation

This is an A/B test comparing a candidate commit's performance against that of a baseline commit. Performance changes are noted in the tables below as:

  • 🟩 = significantly better candidate vs. baseline
  • 🟥 = significantly worse candidate vs. baseline

We compute a confidence interval (CI) over the relative difference of means between metrics from the candidate and baseline commits, considering the baseline as the reference.

If the CI is entirely outside the configured SIGNIFICANT_IMPACT_THRESHOLD (or the deprecated UNCONFIDENCE_THRESHOLD), the change is considered significant.

Feel free to reach out to #apm-benchmarking-platform on Slack if you have any questions.

More details about the CI and significant changes

You can imagine this CI as a range of values that is likely to contain the true difference of means between the candidate and baseline commits.

CIs of the difference of means are often centered around 0%, because often changes are not that big:

---------------------------------(------|---^--------)-------------------------------->
                              -0.6%    0%  0.3%     +1.2%
                                 |          |        |
         lower bound of the CI --'          |        |
sample mean (center of the CI) -------------'        |
         upper bound of the CI ----------------------'

As described above, a change is considered significant if the CI is entirely outside the configured SIGNIFICANT_IMPACT_THRESHOLD (or the deprecated UNCONFIDENCE_THRESHOLD).

For instance, for an execution time metric, this confidence interval indicates a significantly worse performance:

----------------------------------------|---------|---(---------^---------)---------->
                                       0%        1%  1.3%      2.2%      3.1%
                                                  |   |         |         |
       significant impact threshold --------------'   |         |         |
                      lower bound of CI --------------'         |         |
       sample mean (center of the CI) --------------------------'         |
                      upper bound of CI ----------------------------------'

scenario:alloc_free/system/4096

  • 🟥 execution_time [+8.772ns; +8.912ns] or [+10.460%; +10.626%]

scenario:credit_card/is_card_number/x371413321323331

  • 🟥 execution_time [+728.648ns; +731.428ns] or [+12.731%; +12.780%]
  • 🟥 throughput [-19802990.061op/s; -19729089.534op/s] or [-11.334%; -11.291%]

scenario:credit_card/is_card_number_no_luhn/x371413321323331

  • 🟥 execution_time [+727.351ns; +729.974ns] or [+12.704%; +12.749%]
  • 🟥 throughput [-19754042.141op/s; -19682172.215op/s] or [-11.310%; -11.269%]

scenario:glob_matcher/ascii_case_insensitive_match/wall_time

  • 🟥 execution_time [+2.281ns; +2.338ns] or [+8.368%; +8.578%]

scenario:glob_matcher/ascii_exact_match/wall_time

  • 🟥 execution_time [+2.250ns; +2.326ns] or [+8.249%; +8.528%]

scenario:glob_matcher/ascii_exact_miss/wall_time

  • 🟥 execution_time [+3.022ns; +3.104ns] or [+26.453%; +27.170%]

scenario:glob_matcher/ascii_wildcard_backtrack_match/wall_time

  • 🟩 execution_time [-11.566ns; -11.537ns] or [-23.689%; -23.630%]

scenario:glob_matcher/ascii_wildcard_heavy_backtrack/wall_time

  • 🟩 execution_time [-6.566ns; -6.527ns] or [-13.757%; -13.675%]

scenario:glob_matcher/ascii_wildcard_question_match/wall_time

  • 🟩 execution_time [-9.723ns; -9.701ns] or [-20.853%; -20.805%]

scenario:glob_matcher/ascii_wildcard_star_match/wall_time

  • 🟩 execution_time [-10.310ns; -10.289ns] or [-21.832%; -21.787%]

scenario:no_profiler/short_circuit/4096

  • 🟥 execution_time [+21.455ns; +21.565ns] or [+27.817%; +27.960%]

scenario:normalization/normalize_name/normalize_name/Too-Long-.Too-Long-.Too-Long-.Too-Long-.Too-Long-.Too-Lo...

  • 🟥 execution_time [+18.351µs; +18.580µs] or [+9.822%; +9.945%]
  • 🟥 throughput [-484638.098op/s; -478340.716op/s] or [-9.054%; -8.937%]

scenario:normalization/normalize_name/normalize_name/bad-name

  • 🟥 execution_time [+1.549µs; +1.603µs] or [+8.789%; +9.096%]
  • 🟥 throughput [-4726670.947op/s; -4579848.421op/s] or [-8.330%; -8.071%]

scenario:normalization/normalize_name/normalize_name/good

  • 🟥 execution_time [+1.186µs; +1.207µs] or [+12.061%; +12.275%]
  • 🟥 throughput [-11123062.169op/s; -10937853.257op/s] or [-10.937%; -10.755%]

scenario:normalization/normalize_service/normalize_service/A0000000000000000000000000000000000000000000000000...

  • 🟥 execution_time [+36.763µs; +37.182µs] or [+7.381%; +7.465%]
  • 🟥 throughput [-139515.755op/s; -137935.625op/s] or [-6.949%; -6.871%]

scenario:normalization/normalize_service/normalize_service/Test Conversion 0f Weird !@#$%^&**() Characters

  • 🟥 execution_time [+21.104µs; +21.216µs] or [+12.468%; +12.534%]
  • 🟥 throughput [-658197.113op/s; -654776.016op/s] or [-11.141%; -11.083%]

scenario:profiler_attached/fast_path_noop/16

  • 🟩 execution_time [-0.741ns; -0.730ns] or [-4.867%; -4.795%]

scenario:profiler_attached/fast_path_noop/256

  • 🟩 execution_time [-0.746ns; -0.738ns] or [-4.895%; -4.843%]

scenario:profiler_attached/fast_path_noop/4096

  • 🟩 execution_time [-0.745ns; -0.734ns] or [-4.893%; -4.819%]

scenario:profiler_attached/fast_path_noop/64

  • 🟩 execution_time [-0.747ns; -0.734ns] or [-4.901%; -4.820%]

scenario:profiler_attached/fast_path_noop/65536

  • 🟩 execution_time [-0.745ns; -0.734ns] or [-4.893%; -4.816%]

scenario:profiler_attached/fast_path_system/4096

  • 🟩 execution_time [-4.889ns; -4.773ns] or [-5.091%; -4.970%]

scenario:trace_buffer/2_senders/no_delay

  • 🟩 execution_time [-169.555µs; -154.499µs] or [-9.553%; -8.704%]
  • 🟩 throughput [+97102.282op/s; +106507.962op/s] or [+9.570%; +10.497%]

Unstable benchmarks

These benchmarks have a confidence interval too wide to call a change; treat them as noise rather than signal.

scenario:datadog_sample_span/parent_not_sampled_short_circuit/allocated_bytes

  • unstable execution_time [-0.000ns; +0.000ns] or [+555.927%; -555.825%]

scenario:datadog_sample_span/parent_sampled_short_circuit/allocated_bytes

  • unstable execution_time [-0.000ns; +0.000ns] or [+555.735%; -555.735%]

scenario:glob_matcher/ascii_case_insensitive_match/allocated_bytes

  • unstable execution_time [-0.000ns; +0.000ns] or [+586.265%; -570.330%]

scenario:glob_matcher/ascii_exact_match/allocated_bytes

  • unstable execution_time [-0.000ns; +0.000ns] or [+588.161%; -571.250%]

scenario:glob_matcher/ascii_exact_miss/allocated_bytes

  • unstable execution_time [-0.000ns; +0.000ns] or [+662.237%; -608.221%]

scenario:glob_matcher/ascii_wildcard_backtrack_match/allocated_bytes

  • unstable execution_time [-0.000ns; +0.000ns] or [+558.084%; -556.842%]

scenario:glob_matcher/ascii_wildcard_heavy_backtrack/allocated_bytes

  • unstable execution_time [-0.000ns; +0.000ns] or [+554.026%; -554.931%]

scenario:glob_matcher/ascii_wildcard_question_match/allocated_bytes

  • unstable execution_time [-0.000ns; +0.000ns] or [+555.735%; -555.735%]

scenario:glob_matcher/ascii_wildcard_star_match/allocated_bytes

  • unstable execution_time [-0.000ns; +0.000ns] or [+554.965%; -555.373%]

scenario:glob_matcher/star_short_circuit/allocated_bytes

  • unstable execution_time [-0.000ns; +0.000ns] or [+552.047%; -554.002%]

Candidate

Omitted due to size.

Baseline

Omitted due to size.

@dd-octo-sts

dd-octo-sts Bot commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

Artifact Size Benchmark Report

aarch64-alpine-linux-musl
Artifact Baseline Commit Change
/aarch64-alpine-linux-musl/lib/libdatadog_profiling.so 8.96 MB 8.96 MB 0% (0 B) 👌
/aarch64-alpine-linux-musl/lib/libdatadog_profiling.a 95.57 MB 95.57 MB +0% (+2.91 KB) 👌
aarch64-unknown-linux-gnu
Artifact Baseline Commit Change
/aarch64-unknown-linux-gnu/lib/libdatadog_profiling.a 106.92 MB 106.93 MB +0% (+5.03 KB) 👌
/aarch64-unknown-linux-gnu/lib/libdatadog_profiling.so 12.10 MB 12.10 MB +0% (+144 B) 👌
libdatadog-x64-windows
Artifact Baseline Commit Change
/libdatadog-x64-windows/debug/dynamic/datadog_profiling_ffi.dll 28.91 MB 28.91 MB -0% (-1.50 KB) 👌
/libdatadog-x64-windows/debug/dynamic/datadog_profiling_ffi.lib 96.08 KB 96.08 KB 0% (0 B) 👌
/libdatadog-x64-windows/debug/dynamic/datadog_profiling_ffi.pdb 191.08 MB 191.10 MB +.01% (+24.00 KB) 🔍
/libdatadog-x64-windows/debug/static/datadog_profiling_ffi.lib 810.01 MB 810.59 MB +.07% (+592.57 KB) 🔍
/libdatadog-x64-windows/release/dynamic/datadog_profiling_ffi.dll 9.65 MB 9.65 MB +.01% (+1.50 KB) 🔍
/libdatadog-x64-windows/release/dynamic/datadog_profiling_ffi.lib 96.08 KB 96.08 KB 0% (0 B) 👌
/libdatadog-x64-windows/release/dynamic/datadog_profiling_ffi.pdb 27.37 MB 27.38 MB +.02% (+8.00 KB) 🔍
/libdatadog-x64-windows/release/static/datadog_profiling_ffi.lib 55.31 MB 55.32 MB +.02% (+12.25 KB) 🔍
libdatadog-x86-windows
Artifact Baseline Commit Change
/libdatadog-x86-windows/debug/dynamic/datadog_profiling_ffi.dll 25.26 MB 25.26 MB +.01% (+3.00 KB) 🔍
/libdatadog-x86-windows/debug/dynamic/datadog_profiling_ffi.lib 97.58 KB 97.58 KB 0% (0 B) 👌
/libdatadog-x86-windows/debug/dynamic/datadog_profiling_ffi.pdb 196.30 MB 196.30 MB -0% (-8.00 KB) 👌
/libdatadog-x86-windows/debug/static/datadog_profiling_ffi.lib 795.90 MB 796.97 MB +.13% (+1.07 MB) 🔍
/libdatadog-x86-windows/release/dynamic/datadog_profiling_ffi.dll 7.46 MB 7.46 MB +0% (+512 B) 👌
/libdatadog-x86-windows/release/dynamic/datadog_profiling_ffi.lib 97.58 KB 97.58 KB 0% (0 B) 👌
/libdatadog-x86-windows/release/dynamic/datadog_profiling_ffi.pdb 29.44 MB 29.45 MB +.02% (+8.00 KB) 🔍
/libdatadog-x86-windows/release/static/datadog_profiling_ffi.lib 52.22 MB 52.22 MB +0% (+3.01 KB) 👌
x86_64-alpine-linux-musl
Artifact Baseline Commit Change
/x86_64-alpine-linux-musl/lib/libdatadog_profiling.a 85.61 MB 85.60 MB -0% (-3.72 KB) 👌
/x86_64-alpine-linux-musl/lib/libdatadog_profiling.so 9.99 MB 9.99 MB 0% (0 B) 👌
x86_64-unknown-linux-gnu
Artifact Baseline Commit Change
/x86_64-unknown-linux-gnu/lib/libdatadog_profiling.a 101.52 MB 101.51 MB -0% (-3.75 KB) 👌
/x86_64-unknown-linux-gnu/lib/libdatadog_profiling.so 12.20 MB 12.20 MB +0% (+192 B) 👌

@Eldolfin
Eldolfin force-pushed the oscarld/extract-trace-types-crate branch from efa93fd to ccb23b8 Compare September 11, 2026 12:04
@Eldolfin
Eldolfin added this pull request to stack #2510 September 11, 2026 12:16
@Eldolfin
Eldolfin marked this pull request as ready for review September 11, 2026 15:02
@Eldolfin
Eldolfin requested review from a team as code owners September 11, 2026 15:02
@Eldolfin
Eldolfin requested review from mabdinur and removed request for a team September 11, 2026 15:02
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 11, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-11T15:07:04.008987Z c8f26cf Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant