Skip to content

feat(common): allocation-free tag validation and parsing - #2329

Merged
gh-worker-dd-mergequeue-cf854d[bot] merged 2 commits into
mainfrom
PROF-15487-allocation-free-tag-validation
Aug 10, 2026
Merged

feat(common): allocation-free tag validation and parsing#2329
gh-worker-dd-mergequeue-cf854d[bot] merged 2 commits into
mainfrom
PROF-15487-allocation-free-tag-validation

Conversation

@morrisonlevi

@morrisonlevi morrisonlevi commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Adds typed tag validation errors and a borrowed iterator for tag lists.

Motivation

In the OTel process and context work in PHP, we are now going to be making tags on every sample. I'm working to avoid allocations, or delay them until later if feasible. Right now there's no room because the only validation APIs are to actually make a tag. These new APIs let us validate key:value, value, and DD_TAGS style tags all without allocating.

Additional Notes

These new APIs are consumed internally so they aren't dead code either, except for validating a (key, value) pair. The reason is that the way it is technically implemented in the constructor is to format!("{key}:{value}") and then use the serialized key:value validator instead. This is undesirable for me so I've added the new API and tried to make property tests to ensure it stays in-sync with the equivalent behavior.

How to test the change?

Test regularly, nothing should be significantly different.

Add typed tag validation errors and a borrowed iterator for tag lists.
Reuse them internally while preserving existing constructors, return types,
and error messages.
@github-actions github-actions Bot added the common label Aug 6, 2026
@datadog-prod-us1-4

datadog-prod-us1-4 Bot commented Aug 6, 2026

Copy link
Copy Markdown

Tests

🎉 All green!

🧪 All tests passed
❄️ No new flaky tests detected

🎯 Code Coverage (details)
Patch Coverage: 100.00%
Overall Coverage: 75.92% (+0.01%)

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: e1489d3 | Docs | Datadog PR Page | Give us feedback!

@dd-octo-sts

dd-octo-sts Bot commented Aug 6, 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.a 89.19 MB 89.19 MB -0% (-6.21 KB) 👌
/aarch64-alpine-linux-musl/lib/libdatadog_profiling.so 8.20 MB 8.20 MB 0% (0 B) 👌
aarch64-unknown-linux-gnu
Artifact Baseline Commit Change
/aarch64-unknown-linux-gnu/lib/libdatadog_profiling.so 11.06 MB 11.06 MB +0% (+128 B) 👌
/aarch64-unknown-linux-gnu/lib/libdatadog_profiling.a 100.37 MB 100.36 MB -0% (-6.10 KB) 👌
libdatadog-x64-windows
Artifact Baseline Commit Change
/libdatadog-x64-windows/debug/dynamic/datadog_profiling_ffi.dll 26.63 MB 26.63 MB -0% (-1.00 KB) 👌
/libdatadog-x64-windows/debug/dynamic/datadog_profiling_ffi.lib 94.56 KB 94.56 KB 0% (0 B) 👌
/libdatadog-x64-windows/debug/dynamic/datadog_profiling_ffi.pdb 191.43 MB 191.42 MB -0% (-8.00 KB) 👌
/libdatadog-x64-windows/debug/static/datadog_profiling_ffi.lib 1001.70 MB 1001.43 MB --.02% (-272.57 KB) 💪
/libdatadog-x64-windows/release/dynamic/datadog_profiling_ffi.dll 8.71 MB 8.71 MB --.02% (-2.00 KB) 💪
/libdatadog-x64-windows/release/dynamic/datadog_profiling_ffi.lib 94.56 KB 94.56 KB 0% (0 B) 👌
/libdatadog-x64-windows/release/dynamic/datadog_profiling_ffi.pdb 25.62 MB 25.62 MB 0% (0 B) 👌
/libdatadog-x64-windows/release/static/datadog_profiling_ffi.lib 51.01 MB 51.01 MB -0% (-2.73 KB) 👌
libdatadog-x86-windows
Artifact Baseline Commit Change
/libdatadog-x86-windows/debug/dynamic/datadog_profiling_ffi.dll 23.22 MB 23.22 MB -0% (-1.00 KB) 👌
/libdatadog-x86-windows/debug/dynamic/datadog_profiling_ffi.lib 96.04 KB 96.04 KB 0% (0 B) 👌
/libdatadog-x86-windows/debug/dynamic/datadog_profiling_ffi.pdb 196.35 MB 196.33 MB --.01% (-24.00 KB) 💪
/libdatadog-x86-windows/debug/static/datadog_profiling_ffi.lib 990.83 MB 990.81 MB -0% (-23.72 KB) 👌
/libdatadog-x86-windows/release/dynamic/datadog_profiling_ffi.dll 6.73 MB 6.73 MB --.01% (-1.00 KB) 💪
/libdatadog-x86-windows/release/dynamic/datadog_profiling_ffi.lib 96.04 KB 96.04 KB 0% (0 B) 👌
/libdatadog-x86-windows/release/dynamic/datadog_profiling_ffi.pdb 27.55 MB 27.55 MB 0% (0 B) 👌
/libdatadog-x86-windows/release/static/datadog_profiling_ffi.lib 48.56 MB 48.55 MB -0% (-2.20 KB) 👌
x86_64-alpine-linux-musl
Artifact Baseline Commit Change
/x86_64-alpine-linux-musl/lib/libdatadog_profiling.a 79.47 MB 79.46 MB --.01% (-8.64 KB) 💪
/x86_64-alpine-linux-musl/lib/libdatadog_profiling.so 9.13 MB 9.12 MB --.04% (-4.00 KB) 💪
x86_64-unknown-linux-gnu
Artifact Baseline Commit Change
/x86_64-unknown-linux-gnu/lib/libdatadog_profiling.a 95.12 MB 95.12 MB -0% (-8.42 KB) 👌
/x86_64-unknown-linux-gnu/lib/libdatadog_profiling.so 11.14 MB 11.14 MB --.03% (-3.88 KB) 💪

@pr-commenter

pr-commenter Bot commented Aug 7, 2026

Copy link
Copy Markdown

Benchmarks

Comparison

Benchmark execution time: 2026-08-07 05:43:06

Comparing candidate commit e1489d3 in PR branch PROF-15487-allocation-free-tag-validation with baseline commit ea75b04 in branch main.

Found 0 performance improvements and 2 performance regressions! Performance is the same for 138 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:vec_map/as_deduped_map/already_deduped/16

  • 🟥 execution_time [+2.722ns; +3.818ns] or [+8.940%; +12.538%]

scenario:vec_map/get_miss/64

  • 🟥 execution_time [+28.678ns; +28.785ns] or [+102.664%; +103.045%]

Benchmark execution time: 2026-08-07 05:54:01

Comparing candidate commit e1489d3 in PR branch PROF-15487-allocation-free-tag-validation with baseline commit ea75b04 in branch main.

Found 7 performance improvements and 2 performance regressions! Performance is the same for 171 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 [-12.315ns; -12.125ns] or [-11.627%; -11.448%]

scenario:datadog_sample_span/name_pattern_rule_matching/wall_time

  • 🟥 execution_time [+33.482ns; +33.666ns] or [+13.042%; +13.114%]

scenario:profiler_attached/fast_path_system/16

  • 🟩 execution_time [-17.191ns; -17.162ns] or [-38.611%; -38.546%]

scenario:profiler_attached/fast_path_system/256

  • 🟩 execution_time [-17.283ns; -17.249ns] or [-38.811%; -38.736%]

scenario:profiler_attached/fast_path_system/64

  • 🟩 execution_time [-17.317ns; -17.282ns] or [-38.890%; -38.810%]

scenario:profiler_attached/fast_path_system/65536

  • 🟩 execution_time [-10.084ns; -9.922ns] or [-9.029%; -8.883%]

scenario:profiler_attached/slow_path_system/4096

  • 🟥 execution_time [+25.134ns; +25.236ns] or [+19.659%; +19.739%]

scenario:trace_buffer/4_senders/no_delay

  • 🟩 execution_time [-180.039µs; -155.845µs] or [-6.806%; -5.892%]
  • 🟩 throughput [+85566.255op/s; +99006.913op/s] or [+6.284%; +7.271%]

Candidate

Omitted due to size.

Baseline

Omitted due to size.

@morrisonlevi
morrisonlevi marked this pull request as ready for review August 7, 2026 03:45
@morrisonlevi
morrisonlevi requested a review from a team as a code owner August 7, 2026 03:45
@morrisonlevi

Copy link
Copy Markdown
Contributor Author

/merge

@gh-worker-devflow-routing-ef8351

gh-worker-devflow-routing-ef8351 Bot commented Aug 10, 2026

Copy link
Copy Markdown

View all feedbacks in Devflow UI.

2026-08-10 14:00:52 UTC ℹ️ Start processing command /merge


2026-08-10 14:00:56 UTC ℹ️ MergeQueue: pull request added to the queue

The expected merge time in main is approximately 53m (p90).


2026-08-10 15:18:03 UTC ℹ️ MergeQueue: This merge request was merged

@gh-worker-dd-mergequeue-cf854d
gh-worker-dd-mergequeue-cf854d Bot merged commit acec90d into main Aug 10, 2026
93 checks passed
@gh-worker-dd-mergequeue-cf854d
gh-worker-dd-mergequeue-cf854d Bot deleted the PROF-15487-allocation-free-tag-validation branch August 10, 2026 15:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants