Skip to content

feat(metrics-v3): add Datadog V3 payload encoder#2223

Open
atanzu wants to merge 1 commit into
mainfrom
mark.kirichenko/AGTMETRICS-536/add-metrics-v3-encoder
Open

feat(metrics-v3): add Datadog V3 payload encoder#2223
atanzu wants to merge 1 commit into
mainfrom
mark.kirichenko/AGTMETRICS-536/add-metrics-v3-encoder

Conversation

@atanzu

@atanzu atanzu commented Jul 10, 2026

Copy link
Copy Markdown

What does this PR do?

Add a new library which allows to encode metric payloads using V3 columnar format.

Motivation

This library enables users to encode their metric payloads using an efficient column-based protocol. For performance and compatibility reasons (we also want to keep this crate no_std so we could use it in very resource-constrained environments) this crate does manual protobuf serialization.

Additional Notes

How to test the change?

We do correctness test by comparing the resulting encoded payload with the one produced from protobuf-generated code.

@github-actions

github-actions Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

📚 Documentation Check Results

⚠️ 1 documentation warning(s) found

📦 libdd-metrics-v3 - 1 warning(s)


Updated: 2026-07-16 08:00:35 UTC | Commit: 57db033 | missing-docs job results

@datadog-datadog-prod-us1-2

datadog-datadog-prod-us1-2 Bot commented Jul 10, 2026

Copy link
Copy Markdown

Tests

🎉 All green!

🧪 All tests passed
❄️ No new flaky tests detected

🎯 Code Coverage (details)
Patch Coverage: 97.59%
Overall Coverage: 75.01% (+0.26%)

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

@github-actions

github-actions Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

🔒 Cargo Deny Results

No issues found!

📦 libdd-metrics-v3 - ✅ No issues


Updated: 2026-07-16 08:02:52 UTC | Commit: 57db033 | dependency-check job results

@atanzu
atanzu force-pushed the mark.kirichenko/AGTMETRICS-536/add-metrics-v3-encoder branch from db0bdea to f0b893c Compare July 10, 2026 12:42
@pr-commenter

pr-commenter Bot commented Jul 10, 2026

Copy link
Copy Markdown

Benchmarks

Comparison

Benchmark execution time: 2026-07-16 08:38:39

Comparing candidate commit 8f065a5 in PR branch mark.kirichenko/AGTMETRICS-536/add-metrics-v3-encoder with baseline commit 407f8f2 in branch main.

Found 20 performance improvements and 17 performance regressions! Performance is the same for 105 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:msgpack_decoder::v05/high_sharing/2000

  • 🟩 throughput [+49903.185op/s; +50269.617op/s] or [+4.039%; +4.069%]

scenario:msgpack_decoder::v05/low_sharing/10000

  • 🟩 execution_time [-913.123µs; -850.491µs] or [-5.034%; -4.688%]
  • 🟩 throughput [+27281.242op/s; +28907.160op/s] or [+4.948%; +5.243%]

scenario:msgpack_decoder::v05/low_sharing/200

  • 🟩 execution_time [-15.935µs; -15.657µs] or [-4.423%; -4.346%]
  • 🟩 throughput [+25236.850op/s; +25659.585op/s] or [+4.546%; +4.623%]

scenario:msgpack_decoder::v05/low_sharing/2000

  • 🟩 execution_time [-172.468µs; -170.622µs] or [-4.763%; -4.712%]
  • 🟩 throughput [+27325.899op/s; +27618.647op/s] or [+4.947%; +5.000%]

scenario:otlp/e2e_json/1x1000

  • 🟥 execution_time [+432.438µs; +444.323µs] or [+10.606%; +10.898%]

scenario:otlp/encode_json/1x1000

  • 🟥 execution_time [+423.943µs; +424.444µs] or [+24.003%; +24.031%]

scenario:vec_map/as_deduped_map/already_deduped/16

  • 🟥 execution_time [+1.190ns; +1.274ns] or [+4.934%; +5.281%]

scenario:vec_map/as_deduped_map/already_deduped/8

  • 🟥 execution_time [+1.211ns; +1.227ns] or [+8.365%; +8.481%]

scenario:vec_map/contains_key/128

  • 🟩 execution_time [-1.371µs; -1.359µs] or [-8.405%; -8.332%]
  • 🟩 throughput [+713857.979op/s; +719743.211op/s] or [+9.095%; +9.170%]

scenario:vec_map/contains_key/16

  • 🟩 execution_time [-266.785ns; -266.339ns] or [-53.630%; -53.540%]
  • 🟩 throughput [+37090887.579op/s; +37174492.727op/s] or [+115.319%; +115.579%]

scenario:vec_map/contains_key/64

  • 🟩 execution_time [-702.742ns; -695.791ns] or [-15.077%; -14.928%]
  • 🟩 throughput [+2412596.442op/s; +2433743.525op/s] or [+17.570%; +17.724%]

scenario:vec_map/contains_key/8

  • 🟩 execution_time [-140.953ns; -140.876ns] or [-66.877%; -66.840%]
  • 🟩 throughput [+76518615.408op/s; +76631546.544op/s] or [+201.593%; +201.890%]

scenario:vec_map/get_hit/128

  • 🟥 execution_time [+1.148µs; +1.167µs] or [+9.245%; +9.400%]
  • 🟥 throughput [-887155.909op/s; -871568.728op/s] or [-8.605%; -8.454%]

scenario:vec_map/get_hit/16

  • 🟩 execution_time [-13.352ns; -13.164ns] or [-6.263%; -6.175%]
  • 🟩 throughput [+4941830.049op/s; +5010214.279op/s] or [+6.585%; +6.676%]

scenario:vec_map/get_hit/64

  • 🟥 execution_time [+292.248ns; +295.421ns] or [+8.591%; +8.684%]
  • 🟥 throughput [-1504097.842op/s; -1487776.548op/s] or [-7.995%; -7.908%]

scenario:vec_map/get_hit/8

  • 🟩 execution_time [-7.901ns; -7.748ns] or [-12.792%; -12.544%]
  • 🟩 throughput [+18615871.699op/s; +18939340.435op/s] or [+14.372%; +14.622%]

scenario:vec_map/get_miss/128

  • 🟩 execution_time [-3.735ns; -3.582ns] or [-4.645%; -4.454%]

scenario:vec_map/get_miss/16

  • 🟥 execution_time [+16.970ns; +17.176ns] or [+163.349%; +165.331%]

scenario:vec_map/get_miss/64

  • 🟥 execution_time [+21.172ns; +21.240ns] or [+70.993%; +71.219%]

scenario:vec_map/get_miss/8

  • 🟥 execution_time [+12.113ns; +12.286ns] or [+203.840%; +206.743%]

scenario:vec_map/get_mut/128

  • 🟥 execution_time [+2.229µs; +2.318µs] or [+16.281%; +16.934%]
  • 🟥 throughput [-1359459.530op/s; -1305323.027op/s] or [-14.535%; -13.956%]

scenario:vec_map/get_mut/16

  • 🟥 execution_time [+20.306ns; +30.351ns] or [+7.305%; +10.918%]
  • 🟥 throughput [-6042599.796op/s; -3971377.412op/s] or [-10.398%; -6.834%]

scenario:vec_map/get_mut/64

  • 🟥 execution_time [+469.117ns; +506.440ns] or [+12.127%; +13.091%]
  • 🟥 throughput [-1933357.581op/s; -1784547.167op/s] or [-11.678%; -10.779%]

Benchmark execution time: 2026-07-16 08:52:06

Comparing candidate commit 8f065a5 in PR branch mark.kirichenko/AGTMETRICS-536/add-metrics-v3-encoder with baseline commit 407f8f2 in branch main.

Found 3 performance improvements and 25 performance regressions! Performance is the same for 149 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/sampled_system_fast_path/4096

  • 🟥 execution_time [+4.879ns; +5.073ns] or [+4.963%; +5.159%]

scenario:alloc_free/sampled_system_slow_path/16

  • 🟥 execution_time [+12.930ns; +13.046ns] or [+14.951%; +15.086%]

scenario:alloc_free/sampled_system_slow_path/256

  • 🟥 execution_time [+12.862ns; +12.959ns] or [+14.853%; +14.965%]

scenario:alloc_free/sampled_system_slow_path/4096

  • 🟥 execution_time [+12.717ns; +12.830ns] or [+8.064%; +8.136%]

scenario:alloc_free/sampled_system_slow_path/64

  • 🟥 execution_time [+12.767ns; +12.870ns] or [+14.746%; +14.866%]

scenario:alloc_free/sampled_system_slow_path/65536

  • 🟥 execution_time [+22.158ns; +22.298ns] or [+13.996%; +14.084%]

scenario:credit_card/is_card_number/ 3782-8224-6310-005

  • 🟥 execution_time [+4.767µs; +4.947µs] or [+6.343%; +6.583%]
  • 🟥 throughput [-823948.655op/s; -792955.875op/s] or [-6.191%; -5.958%]

scenario:credit_card/is_card_number/ 378282246310005

  • 🟥 execution_time [+5.603µs; +5.666µs] or [+8.265%; +8.359%]
  • 🟥 throughput [-1137977.035op/s; -1125989.306op/s] or [-7.714%; -7.633%]

scenario:credit_card/is_card_number/378282246310005

  • 🟥 execution_time [+5.595µs; +5.675µs] or [+8.665%; +8.789%]
  • 🟥 throughput [-1251139.552op/s; -1234784.037op/s] or [-8.078%; -7.973%]

scenario:credit_card/is_card_number/37828224631000521389798

  • 🟥 execution_time [+6.969µs; +7.012µs] or [+15.391%; +15.486%]
  • 🟥 throughput [-2963979.892op/s; -2943350.309op/s] or [-13.421%; -13.328%]

scenario:credit_card/is_card_number_no_luhn/ 378282246310005

  • 🟥 execution_time [+5.148µs; +5.200µs] or [+9.696%; +9.795%]
  • 🟥 throughput [-1680439.680op/s; -1664769.842op/s] or [-8.921%; -8.838%]

scenario:credit_card/is_card_number_no_luhn/378282246310005

  • 🟥 execution_time [+5.418µs; +5.492µs] or [+10.854%; +11.003%]
  • 🟥 throughput [-1985481.027op/s; -1961023.224op/s] or [-9.911%; -9.789%]

scenario:credit_card/is_card_number_no_luhn/37828224631000521389798

  • 🟥 execution_time [+6.886µs; +6.927µs] or [+15.177%; +15.265%]
  • 🟥 throughput [-2921048.951op/s; -2902041.504op/s] or [-13.254%; -13.168%]

scenario:glob_matcher/ascii_case_insensitive_match/wall_time

  • 🟥 execution_time [+1.978ns; +2.004ns] or [+7.241%; +7.338%]

scenario:glob_matcher/ascii_exact_match/wall_time

  • 🟥 execution_time [+1.990ns; +2.035ns] or [+7.281%; +7.447%]

scenario:glob_matcher/ascii_exact_miss/wall_time

  • 🟥 execution_time [+2.205ns; +2.258ns] or [+17.722%; +18.154%]

scenario:glob_matcher/unicode_pattern_ascii_subject/wall_time

  • 🟥 execution_time [+4.679ns; +4.814ns] or [+5.174%; +5.324%]

scenario:receiver_entry_point/report/2644

  • 🟥 execution_time [+145.328µs; +149.770µs] or [+4.000%; +4.122%]

scenario:sql/obfuscate_sql_string

  • 🟩 execution_time [-20.384µs; -20.105µs] or [-6.635%; -6.544%]

scenario:trace_buffer/4_senders/no_delay

  • 🟩 execution_time [-127.642µs; -98.622µs] or [-5.232%; -4.042%]
  • 🟩 throughput [+63202.980op/s; +82147.582op/s] or [+4.280%; +5.563%]

Candidate

Omitted due to size.

Baseline

Omitted due to size.

@dd-octo-sts

dd-octo-sts Bot commented Jul 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.a 85.88 MB 85.88 MB 0% (0 B) 👌
/aarch64-alpine-linux-musl/lib/libdatadog_profiling.so 7.88 MB 7.88 MB 0% (0 B) 👌
aarch64-unknown-linux-gnu
Artifact Baseline Commit Change
/aarch64-unknown-linux-gnu/lib/libdatadog_profiling.a 97.10 MB 97.10 MB 0% (0 B) 👌
/aarch64-unknown-linux-gnu/lib/libdatadog_profiling.so 10.61 MB 10.61 MB 0% (0 B) 👌
libdatadog-x64-windows
Artifact Baseline Commit Change
/libdatadog-x64-windows/debug/dynamic/datadog_profiling_ffi.dll 25.45 MB 25.45 MB 0% (0 B) 👌
/libdatadog-x64-windows/debug/dynamic/datadog_profiling_ffi.lib 88.44 KB 88.44 KB 0% (0 B) 👌
/libdatadog-x64-windows/debug/dynamic/datadog_profiling_ffi.pdb 184.54 MB 184.55 MB +0% (+8.00 KB) 👌
/libdatadog-x64-windows/debug/static/datadog_profiling_ffi.lib 946.77 MB 946.77 MB 0% (0 B) 👌
/libdatadog-x64-windows/release/dynamic/datadog_profiling_ffi.dll 8.32 MB 8.32 MB 0% (0 B) 👌
/libdatadog-x64-windows/release/dynamic/datadog_profiling_ffi.lib 88.44 KB 88.44 KB 0% (0 B) 👌
/libdatadog-x64-windows/release/dynamic/datadog_profiling_ffi.pdb 24.62 MB 24.62 MB 0% (0 B) 👌
/libdatadog-x64-windows/release/static/datadog_profiling_ffi.lib 49.03 MB 49.03 MB 0% (0 B) 👌
libdatadog-x86-windows
Artifact Baseline Commit Change
/libdatadog-x86-windows/debug/dynamic/datadog_profiling_ffi.dll 22.05 MB 22.05 MB 0% (0 B) 👌
/libdatadog-x86-windows/debug/dynamic/datadog_profiling_ffi.lib 89.82 KB 89.82 KB 0% (0 B) 👌
/libdatadog-x86-windows/debug/dynamic/datadog_profiling_ffi.pdb 188.76 MB 188.77 MB +0% (+16.00 KB) 👌
/libdatadog-x86-windows/debug/static/datadog_profiling_ffi.lib 935.45 MB 935.45 MB 0% (0 B) 👌
/libdatadog-x86-windows/release/dynamic/datadog_profiling_ffi.dll 6.43 MB 6.43 MB 0% (0 B) 👌
/libdatadog-x86-windows/release/dynamic/datadog_profiling_ffi.lib 89.82 KB 89.82 KB 0% (0 B) 👌
/libdatadog-x86-windows/release/dynamic/datadog_profiling_ffi.pdb 26.43 MB 26.43 MB 0% (0 B) 👌
/libdatadog-x86-windows/release/static/datadog_profiling_ffi.lib 46.66 MB 46.66 MB 0% (0 B) 👌
x86_64-alpine-linux-musl
Artifact Baseline Commit Change
/x86_64-alpine-linux-musl/lib/libdatadog_profiling.a 76.58 MB 76.58 MB 0% (0 B) 👌
/x86_64-alpine-linux-musl/lib/libdatadog_profiling.so 8.78 MB 8.78 MB 0% (0 B) 👌
x86_64-unknown-linux-gnu
Artifact Baseline Commit Change
/x86_64-unknown-linux-gnu/lib/libdatadog_profiling.a 92.10 MB 92.10 MB 0% (0 B) 👌
/x86_64-unknown-linux-gnu/lib/libdatadog_profiling.so 10.69 MB 10.69 MB 0% (0 B) 👌

@atanzu
atanzu force-pushed the mark.kirichenko/AGTMETRICS-536/add-metrics-v3-encoder branch 2 times, most recently from f6a9fc0 to a743570 Compare July 10, 2026 14:28
@atanzu
atanzu marked this pull request as ready for review July 10, 2026 15:19
@atanzu
atanzu requested review from a team as code owners July 10, 2026 15:19

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a743570c4b

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread libdd-metrics-v3/src/writer.rs
Comment thread libdd-metrics-v3/src/writer.rs
Comment thread libdd-metrics-v3/src/writer.rs
Comment thread libdd-metrics-v3/src/writer.rs Outdated
Comment thread libdd-metrics-v3/src/writer.rs
Allows to encode metric payloads using V3 columnar format.

This library enables users to encode their metric payloads using an
efficient column-based protocol. For performance and compatibility
reasons (we also want to keep this crate `no_std` so we could use it in
very resource-constrained environments) this crate does manual protobuf
serialization.

Signed-off-by: Mark Kirichenko <mark.kirichenko@datadoghq.com>
@atanzu
atanzu force-pushed the mark.kirichenko/AGTMETRICS-536/add-metrics-v3-encoder branch from a743570 to 8f065a5 Compare July 16, 2026 07:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant