Skip to content

feat(data-pipeline): Cross-Language Logging Integration #1018

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 28 commits into
base: main
Choose a base branch
from

Conversation

ganeshnj
Copy link
Contributor

@ganeshnj ganeshnj commented Apr 11, 2025

What does this PR do?

This pull request includes several changes to add new logging functionality and update dependencies across multiple files. The most important changes include adding new ddlog and ddlog-ffi crates, updating dependencies to use tracing instead of log.

It introduces callback based mechanism to allow lanagues to setup the callback which is called on every logging action, depending on the configured log level.

There are two important APIs introduced

  • ddog_logger_init
  • ddog_logger_set_log_level

Motivation

Fixes https://datadoghq.atlassian.net/browse/APMSP-1835

This is part of bigger effort to allow language integration access to the logs happening in the libdatadog.

Check the RFC for more details. Also, available internally in Google docs.

Note

This is blocking issue for data-pipeline .NET integration.

Why separate crate?
Holistically speaking, this functionality not only works for data-pipeline but for any integration. Hence, I decided to move to its own crate just like telemetry. This also gives a place to start adding any other additional crate agnostic logging logic.

Additional Notes

Note

I'm still exploring ways to make it a linter rule (or script) so we don't ever introduce a logging statement with formatted string.

Note

One thing I'm not sure, what will be the impact on non data-pipeline products such as profiler which I'm still investigating.

How to test the change?

For now, I used below script to check there is no formatted logging is happening in the dependencies of data-pipeline

➜ cargo tree  | grep 'dd/libdatadog'
data-pipeline v17.0.0 (/Users/ganesh.jangir/dd/libdatadog/data-pipeline)
├── datadog-ddsketch v17.0.0 (/Users/ganesh.jangir/dd/libdatadog/ddsketch)
├── datadog-trace-protobuf v17.0.0 (/Users/ganesh.jangir/dd/libdatadog/trace-protobuf)
├── datadog-trace-utils v17.0.0 (/Users/ganesh.jangir/dd/libdatadog/trace-utils)
│   ├── datadog-trace-normalization v17.0.0 (/Users/ganesh.jangir/dd/libdatadog/trace-normalization)
│   │   └── datadog-trace-protobuf v17.0.0 (/Users/ganesh.jangir/dd/libdatadog/trace-protobuf) (*)
│   ├── datadog-trace-protobuf v17.0.0 (/Users/ganesh.jangir/dd/libdatadog/trace-protobuf) (*)
│   ├── ddcommon v17.0.0 (/Users/ganesh.jangir/dd/libdatadog/ddcommon)
│   ├── tinybytes v17.0.0 (/Users/ganesh.jangir/dd/libdatadog/tinybytes)
├── ddcommon v17.0.0 (/Users/ganesh.jangir/dd/libdatadog/ddcommon) (*)
├── ddtelemetry v17.0.0 (/Users/ganesh.jangir/dd/libdatadog/ddtelemetry)
│   ├── datadog-ddsketch v17.0.0 (/Users/ganesh.jangir/dd/libdatadog/ddsketch) (*)
│   ├── ddcommon v17.0.0 (/Users/ganesh.jangir/dd/libdatadog/ddcommon) (*)
├── dogstatsd-client v17.0.0 (/Users/ganesh.jangir/dd/libdatadog/dogstatsd-client)
│   ├── ddcommon v17.0.0 (/Users/ganesh.jangir/dd/libdatadog/ddcommon) (*)
├── tinybytes v17.0.0 (/Users/ganesh.jangir/dd/libdatadog/tinybytes) (*)
├── data-pipeline v17.0.0 (/Users/ganesh.jangir/dd/libdatadog/data-pipeline) (*)
├── datadog-trace-utils v17.0.0 (/Users/ganesh.jangir/dd/libdatadog/trace-utils) (*)
➜ cat check_structured_logging.sh                   
#!/usr/bin/env bash
set -e

if [ "$#" -ne 1 ]; then
    echo "Usage: $0 <directory>"
    echo "Example: $0 src/"
    exit 1
fi

search_dir="$1"

if [ ! -d "$search_dir" ]; then
    echo "Error: Directory '$search_dir' does not exist"
    exit 1
fi

echo "🔍 Checking for formatted strings in tracing macros in $search_dir..."

# Regex pattern: look for any tracing macro with a string literal that includes `{`
pattern='(trace|debug|info|warn|error)!\s*\(\s*".*\{.*\}"'

# Search in the provided directory
violations=$(grep -Enr --include="*.rs" -e "$pattern" "$search_dir" 2>/dev/null || true)

if [[ -n "$violations" ]]; then
  echo "🚫 Found disallowed formatted logging macros:"
  echo "$violations"
  echo
  echo "💡 Use structured logging: info!(key = value) instead of formatted strings"
  exit 1
fi

echo "✅ No formatted strings in logging macros. You're good!"

The trace exporter example is updated with log usage

➜ ./examples/ffi/build/trace_exporter                                                                                               
ERROR :: Error deserializing trace from request body :: err: "Invalid format: Unable to read array len for trace count"
Operation failed with error: 18, reason: Invalid format: Unable to read array len for trace count
TRACE :: checkout waiting for idle connection: ("http", localhost:8126) :: 
TRACE :: Http::connect; scheme=Some("http"), host=Some("localhost"), port=Some(Port(8126)) :: 
TRACE :: checkout dropped for ("http", localhost:8126) :: 
ERROR :: Error while fetching /info :: err: client error (Connect)

@codecov-commenter
Copy link

codecov-commenter commented Apr 11, 2025

Codecov Report

Attention: Patch coverage is 82.55814% with 30 lines in your changes missing coverage. Please review.

Project coverage is 71.55%. Comparing base (3dab0be) to head (e0e5c8a).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1018      +/-   ##
==========================================
+ Coverage   71.52%   71.55%   +0.02%     
==========================================
  Files         339      341       +2     
  Lines       50628    50790     +162     
==========================================
+ Hits        36214    36345     +131     
- Misses      14414    14445      +31     
Components Coverage Δ
crashtracker 42.82% <ø> (ø)
crashtracker-ffi 6.30% <ø> (ø)
datadog-alloc 98.73% <ø> (ø)
data-pipeline 91.00% <50.00%> (ø)
data-pipeline-ffi 90.35% <ø> (ø)
ddcommon 78.57% <ø> (ø)
ddcommon-ffi 66.37% <ø> (ø)
ddtelemetry 60.29% <ø> (ø)
ddtelemetry-ffi 21.43% <ø> (ø)
dogstatsd-client 82.57% <0.00%> (ø)
ipc 82.41% <ø> (ø)
profiling 77.49% <ø> (ø)
profiling-ffi 62.12% <ø> (ø)
serverless 0.00% <ø> (ø)
sidecar 41.18% <ø> (ø)
sidecar-ffi 2.05% <ø> (ø)
spawn-worker 54.37% <ø> (ø)
tinybytes 89.86% <ø> (ø)
trace-mini-agent 73.80% <ø> (ø)
trace-normalization 98.24% <ø> (ø)
trace-obfuscation 96.00% <ø> (ø)
trace-protobuf 78.50% <ø> (ø)
trace-utils 92.98% <0.00%> (-0.16%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@pr-commenter
Copy link

pr-commenter bot commented Apr 11, 2025

Benchmarks

Comparison

Benchmark execution time: 2025-04-16 13:59:07

Comparing candidate commit e0e5c8a in PR branch ganeshnj/feat/logging-ffi with baseline commit 3dab0be in branch main.

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

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

  • 🟥 execution_time [+4.837µs; +4.998µs] or [+6.232%; +6.440%]
  • 🟥 throughput [-780945.302op/s; -755283.128op/s] or [-6.060%; -5.861%]

scenario:credit_card/is_card_number/ 378282246310005

  • 🟥 execution_time [+5.576µs; +5.711µs] or [+7.815%; +8.004%]
  • 🟥 throughput [-1038863.896op/s; -1015139.968op/s] or [-7.413%; -7.243%]

scenario:credit_card/is_card_number/378282246310005

  • 🟥 execution_time [+5.620µs; +5.820µs] or [+8.262%; +8.555%]
  • 🟥 throughput [-1159850.470op/s; -1120483.715op/s] or [-7.890%; -7.622%]

scenario:credit_card/is_card_number/x371413321323331

  • 🟥 execution_time [+506.469ns; +527.229ns] or [+8.364%; +8.707%]
  • 🟥 throughput [-13218531.132op/s; -12727160.550op/s] or [-8.004%; -7.707%]

scenario:credit_card/is_card_number_no_luhn/x371413321323331

  • 🟥 execution_time [+509.943ns; +532.029ns] or [+8.417%; +8.782%]
  • 🟥 throughput [-13314518.998op/s; -12793132.305op/s] or [-8.066%; -7.751%]

Candidate

Candidate benchmark details

Group 1

cpu_model git_commit_sha git_commit_date git_branch
Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz e0e5c8a 1744811232 ganeshnj/feat/logging-ffi
scenario metric min mean ± sd median ± mad p75 p95 p99 max peak_to_median_ratio skewness kurtosis cv sem runs sample_size
normalization/normalize_trace/test_trace execution_time 243.214ns 254.617ns ± 13.465ns 248.500ns ± 3.716ns 255.471ns 284.631ns 285.914ns 286.872ns 15.44% 1.321 0.233 5.28% 0.952ns 1 200
scenario metric 95% CI mean Shapiro-Wilk pvalue Ljung-Box pvalue (lag=1) Dip test pvalue
normalization/normalize_trace/test_trace execution_time [252.751ns; 256.483ns] or [-0.733%; +0.733%] None None None

Group 2

cpu_model git_commit_sha git_commit_date git_branch
Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz e0e5c8a 1744811232 ganeshnj/feat/logging-ffi
scenario metric min mean ± sd median ± mad p75 p95 p99 max peak_to_median_ratio skewness kurtosis cv sem runs sample_size
write only interface execution_time 1.185µs 3.178µs ± 1.430µs 2.983µs ± 0.028µs 3.009µs 3.638µs 13.869µs 14.916µs 400.12% 7.381 55.462 44.88% 0.101µs 1 200
scenario metric 95% CI mean Shapiro-Wilk pvalue Ljung-Box pvalue (lag=1) Dip test pvalue
write only interface execution_time [2.980µs; 3.376µs] or [-6.236%; +6.236%] None None None

Group 3

cpu_model git_commit_sha git_commit_date git_branch
Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz e0e5c8a 1744811232 ganeshnj/feat/logging-ffi
scenario metric min mean ± sd median ± mad p75 p95 p99 max peak_to_median_ratio skewness kurtosis cv sem runs sample_size
credit_card/is_card_number/ execution_time 3.894µs 3.913µs ± 0.003µs 3.913µs ± 0.001µs 3.915µs 3.917µs 3.920µs 3.921µs 0.18% -1.683 9.930 0.07% 0.000µs 1 200
credit_card/is_card_number/ throughput 255068590.099op/s 255534176.901op/s ± 186466.916op/s 255539258.321op/s ± 89277.028op/s 255606831.094op/s 255854995.330op/s 255992891.646op/s 256801368.161op/s 0.49% 1.703 10.077 0.07% 13185.202op/s 1 200
credit_card/is_card_number/ 3782-8224-6310-005 execution_time 81.984µs 82.521µs ± 0.332µs 82.471µs ± 0.205µs 82.680µs 83.150µs 83.553µs 84.035µs 1.90% 1.431 3.016 0.40% 0.023µs 1 200
credit_card/is_card_number/ 3782-8224-6310-005 throughput 11899793.207op/s 12118386.402op/s ± 48419.034op/s 12125469.599op/s ± 30126.371op/s 12154709.729op/s 12174252.370op/s 12181794.665op/s 12197448.294op/s 0.59% -1.396 2.853 0.40% 3423.743op/s 1 200
credit_card/is_card_number/ 378282246310005 execution_time 76.227µs 76.996µs ± 0.417µs 76.914µs ± 0.253µs 77.269µs 77.764µs 78.117µs 78.328µs 1.84% 0.646 0.028 0.54% 0.029µs 1 200
credit_card/is_card_number/ 378282246310005 throughput 12766791.572op/s 12987999.490op/s ± 70071.292op/s 13001590.157op/s ± 42851.695op/s 13033811.993op/s 13088581.103op/s 13108488.391op/s 13118691.360op/s 0.90% -0.620 -0.014 0.54% 4954.789op/s 1 200
credit_card/is_card_number/37828224631 execution_time 3.894µs 3.913µs ± 0.003µs 3.913µs ± 0.002µs 3.915µs 3.918µs 3.921µs 3.922µs 0.22% -0.892 4.978 0.08% 0.000µs 1 200
credit_card/is_card_number/37828224631 throughput 254970121.811op/s 255539014.013op/s ± 213966.785op/s 255535170.728op/s ± 106199.683op/s 255625338.874op/s 255885137.933op/s 255940998.572op/s 256788803.767op/s 0.49% 0.908 5.061 0.08% 15129.736op/s 1 200
credit_card/is_card_number/378282246310005 execution_time 72.761µs 73.745µs ± 0.546µs 73.660µs ± 0.393µs 74.092µs 74.770µs 75.034µs 75.832µs 2.95% 0.648 0.227 0.74% 0.039µs 1 200
credit_card/is_card_number/378282246310005 throughput 13187016.916op/s 13560925.953op/s ± 99917.462op/s 13575879.153op/s ± 72409.778op/s 13634988.593op/s 13696470.245op/s 13724105.415op/s 13743623.616op/s 1.24% -0.609 0.126 0.73% 7065.232op/s 1 200
credit_card/is_card_number/37828224631000521389798 execution_time 51.918µs 52.155µs ± 0.108µs 52.161µs ± 0.072µs 52.223µs 52.335µs 52.360µs 52.481µs 0.61% 0.061 -0.142 0.21% 0.008µs 1 200
credit_card/is_card_number/37828224631000521389798 throughput 19054522.531op/s 19173621.059op/s ± 39727.981op/s 19171566.650op/s ± 26496.188op/s 19200395.531op/s 19243881.728op/s 19255866.874op/s 19261272.032op/s 0.47% -0.050 -0.150 0.21% 2809.192op/s 1 200
credit_card/is_card_number/x371413321323331 execution_time 6.434µs 6.572µs ± 0.070µs 6.569µs ± 0.055µs 6.628µs 6.693µs 6.723µs 6.741µs 2.62% 0.182 -0.693 1.06% 0.005µs 1 200
credit_card/is_card_number/x371413321323331 throughput 148350408.174op/s 152170505.611op/s ± 1614683.310op/s 152238665.669op/s ± 1277789.740op/s 153492748.244op/s 154596083.601op/s 155350778.585op/s 155425665.493op/s 2.09% -0.142 -0.711 1.06% 114175.352op/s 1 200
credit_card/is_card_number_no_luhn/ execution_time 3.893µs 3.912µs ± 0.003µs 3.912µs ± 0.001µs 3.914µs 3.916µs 3.919µs 3.922µs 0.25% -1.213 6.597 0.08% 0.000µs 1 200
credit_card/is_card_number_no_luhn/ throughput 254958600.648op/s 255618926.390op/s ± 200892.639op/s 255603719.046op/s ± 89476.200op/s 255688186.856op/s 255961286.822op/s 256101241.109op/s 256849960.332op/s 0.49% 1.230 6.689 0.08% 14205.255op/s 1 200
credit_card/is_card_number_no_luhn/ 3782-8224-6310-005 execution_time 63.588µs 63.958µs ± 0.177µs 63.909µs ± 0.098µs 64.053µs 64.284µs 64.488µs 64.527µs 0.97% 0.941 0.600 0.28% 0.012µs 1 200
credit_card/is_card_number_no_luhn/ 3782-8224-6310-005 throughput 15497492.713op/s 15635362.576op/s ± 43084.727op/s 15647170.485op/s ± 23932.086op/s 15666858.328op/s 15684187.832op/s 15699587.896op/s 15726355.800op/s 0.51% -0.927 0.566 0.27% 3046.550op/s 1 200
credit_card/is_card_number_no_luhn/ 378282246310005 execution_time 57.407µs 57.551µs ± 0.060µs 57.545µs ± 0.035µs 57.581µs 57.664µs 57.728µs 57.766µs 0.38% 0.687 1.370 0.10% 0.004µs 1 200
credit_card/is_card_number_no_luhn/ 378282246310005 throughput 17311343.417op/s 17375974.245op/s ± 18207.317op/s 17377762.546op/s ± 10504.417op/s 17388093.938op/s 17403465.030op/s 17418022.568op/s 17419506.363op/s 0.24% -0.678 1.353 0.10% 1287.452op/s 1 200
credit_card/is_card_number_no_luhn/37828224631 execution_time 3.901µs 3.914µs ± 0.003µs 3.914µs ± 0.001µs 3.915µs 3.919µs 3.921µs 3.922µs 0.21% -0.224 2.313 0.07% 0.000µs 1 200
credit_card/is_card_number_no_luhn/37828224631 throughput 255001078.966op/s 255525074.697op/s ± 184722.905op/s 255524581.920op/s ± 89573.465op/s 255612218.267op/s 255828215.397op/s 255981638.527op/s 256357639.367op/s 0.33% 0.233 2.330 0.07% 13061.882op/s 1 200
credit_card/is_card_number_no_luhn/378282246310005 execution_time 54.549µs 54.763µs ± 0.220µs 54.677µs ± 0.046µs 54.759µs 55.161µs 55.521µs 55.893µs 2.22% 2.059 4.687 0.40% 0.016µs 1 200
credit_card/is_card_number_no_luhn/378282246310005 throughput 17891357.809op/s 18260801.500op/s ± 72819.257op/s 18289317.211op/s ± 15404.135op/s 18301073.818op/s 18319541.971op/s 18331573.753op/s 18332296.006op/s 0.23% -2.030 4.490 0.40% 5149.099op/s 1 200
credit_card/is_card_number_no_luhn/37828224631000521389798 execution_time 51.927µs 52.142µs ± 0.103µs 52.141µs ± 0.071µs 52.212µs 52.312µs 52.370µs 52.505µs 0.70% 0.251 -0.065 0.20% 0.007µs 1 200
credit_card/is_card_number_no_luhn/37828224631000521389798 throughput 19045895.848op/s 19178325.898op/s ± 37981.040op/s 19178654.158op/s ± 25950.800op/s 19204583.185op/s 19237882.568op/s 19255985.449op/s 19257779.115op/s 0.41% -0.240 -0.081 0.20% 2685.665op/s 1 200
credit_card/is_card_number_no_luhn/x371413321323331 execution_time 6.428µs 6.579µs ± 0.075µs 6.581µs ± 0.053µs 6.634µs 6.709µs 6.751µs 6.763µs 2.77% 0.135 -0.531 1.13% 0.005µs 1 200
credit_card/is_card_number_no_luhn/x371413321323331 throughput 147856477.902op/s 152006787.496op/s ± 1721721.283op/s 151947266.638op/s ± 1216950.650op/s 153146471.771op/s 154679980.598op/s 155371902.304op/s 155573762.531op/s 2.39% -0.086 -0.550 1.13% 121744.079op/s 1 200
scenario metric 95% CI mean Shapiro-Wilk pvalue Ljung-Box pvalue (lag=1) Dip test pvalue
credit_card/is_card_number/ execution_time [3.913µs; 3.914µs] or [-0.010%; +0.010%] None None None
credit_card/is_card_number/ throughput [255508334.380op/s; 255560019.422op/s] or [-0.010%; +0.010%] None None None
credit_card/is_card_number/ 3782-8224-6310-005 execution_time [82.475µs; 82.567µs] or [-0.056%; +0.056%] None None None
credit_card/is_card_number/ 3782-8224-6310-005 throughput [12111675.990op/s; 12125096.815op/s] or [-0.055%; +0.055%] None None None
credit_card/is_card_number/ 378282246310005 execution_time [76.939µs; 77.054µs] or [-0.075%; +0.075%] None None None
credit_card/is_card_number/ 378282246310005 throughput [12978288.283op/s; 12997710.697op/s] or [-0.075%; +0.075%] None None None
credit_card/is_card_number/37828224631 execution_time [3.913µs; 3.914µs] or [-0.012%; +0.012%] None None None
credit_card/is_card_number/37828224631 throughput [255509360.274op/s; 255568667.751op/s] or [-0.012%; +0.012%] None None None
credit_card/is_card_number/378282246310005 execution_time [73.670µs; 73.821µs] or [-0.103%; +0.103%] None None None
credit_card/is_card_number/378282246310005 throughput [13547078.354op/s; 13574773.552op/s] or [-0.102%; +0.102%] None None None
credit_card/is_card_number/37828224631000521389798 execution_time [52.140µs; 52.170µs] or [-0.029%; +0.029%] None None None
credit_card/is_card_number/37828224631000521389798 throughput [19168115.143op/s; 19179126.975op/s] or [-0.029%; +0.029%] None None None
credit_card/is_card_number/x371413321323331 execution_time [6.563µs; 6.582µs] or [-0.147%; +0.147%] None None None
credit_card/is_card_number/x371413321323331 throughput [151946726.033op/s; 152394285.188op/s] or [-0.147%; +0.147%] None None None
credit_card/is_card_number_no_luhn/ execution_time [3.912µs; 3.913µs] or [-0.011%; +0.011%] None None None
credit_card/is_card_number_no_luhn/ throughput [255591084.602op/s; 255646768.178op/s] or [-0.011%; +0.011%] None None None
credit_card/is_card_number_no_luhn/ 3782-8224-6310-005 execution_time [63.934µs; 63.983µs] or [-0.038%; +0.038%] None None None
credit_card/is_card_number_no_luhn/ 3782-8224-6310-005 throughput [15629391.448op/s; 15641333.705op/s] or [-0.038%; +0.038%] None None None
credit_card/is_card_number_no_luhn/ 378282246310005 execution_time [57.542µs; 57.559µs] or [-0.015%; +0.015%] None None None
credit_card/is_card_number_no_luhn/ 378282246310005 throughput [17373450.886op/s; 17378497.604op/s] or [-0.015%; +0.015%] None None None
credit_card/is_card_number_no_luhn/37828224631 execution_time [3.913µs; 3.914µs] or [-0.010%; +0.010%] None None None
credit_card/is_card_number_no_luhn/37828224631 throughput [255499473.879op/s; 255550675.515op/s] or [-0.010%; +0.010%] None None None
credit_card/is_card_number_no_luhn/378282246310005 execution_time [54.732µs; 54.793µs] or [-0.056%; +0.056%] None None None
credit_card/is_card_number_no_luhn/378282246310005 throughput [18250709.451op/s; 18270893.548op/s] or [-0.055%; +0.055%] None None None
credit_card/is_card_number_no_luhn/37828224631000521389798 execution_time [52.128µs; 52.157µs] or [-0.027%; +0.027%] None None None
credit_card/is_card_number_no_luhn/37828224631000521389798 throughput [19173062.091op/s; 19183589.704op/s] or [-0.027%; +0.027%] None None None
credit_card/is_card_number_no_luhn/x371413321323331 execution_time [6.569µs; 6.590µs] or [-0.157%; +0.157%] None None None
credit_card/is_card_number_no_luhn/x371413321323331 throughput [151768173.485op/s; 152245401.507op/s] or [-0.157%; +0.157%] None None None

Group 4

cpu_model git_commit_sha git_commit_date git_branch
Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz e0e5c8a 1744811232 ganeshnj/feat/logging-ffi
scenario metric min mean ± sd median ± mad p75 p95 p99 max peak_to_median_ratio skewness kurtosis cv sem runs sample_size
benching string interning on wordpress profile execution_time 149.617µs 150.645µs ± 0.385µs 150.636µs ± 0.254µs 150.881µs 151.275µs 151.457µs 152.684µs 1.36% 0.788 2.917 0.25% 0.027µs 1 200
scenario metric 95% CI mean Shapiro-Wilk pvalue Ljung-Box pvalue (lag=1) Dip test pvalue
benching string interning on wordpress profile execution_time [150.592µs; 150.699µs] or [-0.035%; +0.035%] None None None

Group 5

cpu_model git_commit_sha git_commit_date git_branch
Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz e0e5c8a 1744811232 ganeshnj/feat/logging-ffi
scenario metric min mean ± sd median ± mad p75 p95 p99 max peak_to_median_ratio skewness kurtosis cv sem runs sample_size
two way interface execution_time 17.547µs 24.961µs ± 10.214µs 17.749µs ± 0.136µs 33.410µs 42.300µs 43.598µs 84.089µs 373.78% 1.793 5.899 40.82% 0.722µs 1 200
scenario metric 95% CI mean Shapiro-Wilk pvalue Ljung-Box pvalue (lag=1) Dip test pvalue
two way interface execution_time [23.546µs; 26.377µs] or [-5.671%; +5.671%] None None None

Group 6

cpu_model git_commit_sha git_commit_date git_branch
Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz e0e5c8a 1744811232 ganeshnj/feat/logging-ffi
scenario metric min mean ± sd median ± mad p75 p95 p99 max peak_to_median_ratio skewness kurtosis cv sem runs sample_size
normalization/normalize_name/normalize_name/Too-Long-.Too-Long-.Too-Long-.Too-Long-.Too-Long-.Too-Lo... execution_time 208.749µs 209.113µs ± 0.144µs 209.112µs ± 0.091µs 209.204µs 209.366µs 209.418µs 209.515µs 0.19% -0.004 -0.018 0.07% 0.010µs 1 200
normalization/normalize_name/normalize_name/Too-Long-.Too-Long-.Too-Long-.Too-Long-.Too-Long-.Too-Lo... throughput 4772922.257op/s 4782114.154op/s ± 3285.799op/s 4782126.960op/s ± 2087.090op/s 4784179.993op/s 4787549.309op/s 4789724.942op/s 4790448.484op/s 0.17% 0.008 -0.018 0.07% 232.341op/s 1 200
normalization/normalize_name/normalize_name/bad-name execution_time 18.619µs 18.675µs ± 0.027µs 18.672µs ± 0.015µs 18.694µs 18.717µs 18.752µs 18.778µs 0.57% 0.532 0.879 0.14% 0.002µs 1 200
normalization/normalize_name/normalize_name/bad-name throughput 53252678.091op/s 53547170.332op/s ± 77604.508op/s 53557500.219op/s ± 42086.791op/s 53592454.365op/s 53671293.891op/s 53695517.795op/s 53708210.574op/s 0.28% -0.521 0.853 0.14% 5487.467op/s 1 200
normalization/normalize_name/normalize_name/good execution_time 10.893µs 10.951µs ± 0.035µs 10.948µs ± 0.026µs 10.975µs 11.011µs 11.026µs 11.039µs 0.83% 0.294 -0.773 0.32% 0.002µs 1 200
normalization/normalize_name/normalize_name/good throughput 90589809.343op/s 91317922.940op/s ± 292803.153op/s 91344317.840op/s ± 220001.164op/s 91546733.354op/s 91726120.516op/s 91772644.556op/s 91799287.214op/s 0.50% -0.283 -0.784 0.32% 20704.310op/s 1 200
scenario metric 95% CI mean Shapiro-Wilk pvalue Ljung-Box pvalue (lag=1) Dip test pvalue
normalization/normalize_name/normalize_name/Too-Long-.Too-Long-.Too-Long-.Too-Long-.Too-Long-.Too-Lo... execution_time [209.093µs; 209.133µs] or [-0.010%; +0.010%] None None None
normalization/normalize_name/normalize_name/Too-Long-.Too-Long-.Too-Long-.Too-Long-.Too-Long-.Too-Lo... throughput [4781658.774op/s; 4782569.534op/s] or [-0.010%; +0.010%] None None None
normalization/normalize_name/normalize_name/bad-name execution_time [18.671µs; 18.679µs] or [-0.020%; +0.020%] None None None
normalization/normalize_name/normalize_name/bad-name throughput [53536415.094op/s; 53557925.570op/s] or [-0.020%; +0.020%] None None None
normalization/normalize_name/normalize_name/good execution_time [10.946µs; 10.956µs] or [-0.044%; +0.044%] None None None
normalization/normalize_name/normalize_name/good throughput [91277343.239op/s; 91358502.641op/s] or [-0.044%; +0.044%] None None None

Group 7

cpu_model git_commit_sha git_commit_date git_branch
Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz e0e5c8a 1744811232 ganeshnj/feat/logging-ffi
scenario metric min mean ± sd median ± mad p75 p95 p99 max peak_to_median_ratio skewness kurtosis cv sem runs sample_size
normalization/normalize_service/normalize_service/A0000000000000000000000000000000000000000000000000... execution_time 503.906µs 505.039µs ± 0.523µs 505.034µs ± 0.234µs 505.278µs 505.623µs 505.961µs 509.791µs 0.94% 3.520 32.539 0.10% 0.037µs 1 200
normalization/normalize_service/normalize_service/A0000000000000000000000000000000000000000000000000... throughput 1961587.539op/s 1980047.492op/s ± 2044.367op/s 1980064.164op/s ± 917.646op/s 1980860.922op/s 1983161.527op/s 1984055.841op/s 1984499.078op/s 0.22% -3.452 31.791 0.10% 144.559op/s 1 200
normalization/normalize_service/normalize_service/Data🐨dog🐶 繋がっ⛰てて execution_time 453.468µs 454.925µs ± 0.505µs 454.875µs ± 0.359µs 455.245µs 455.704µs 456.355µs 456.512µs 0.36% 0.306 0.333 0.11% 0.036µs 1 200
normalization/normalize_service/normalize_service/Data🐨dog🐶 繋がっ⛰てて throughput 2190521.154op/s 2198166.799op/s ± 2438.424op/s 2198405.138op/s ± 1737.440op/s 2199868.853op/s 2201659.584op/s 2203105.758op/s 2205225.479op/s 0.31% -0.299 0.325 0.11% 172.423op/s 1 200
normalization/normalize_service/normalize_service/Test Conversion 0f Weird !@#$%^&**() Characters execution_time 177.631µs 177.912µs ± 0.126µs 177.899µs ± 0.082µs 177.998µs 178.120µs 178.222µs 178.272µs 0.21% 0.212 -0.146 0.07% 0.009µs 1 200
normalization/normalize_service/normalize_service/Test Conversion 0f Weird !@#$%^&**() Characters throughput 5609407.387op/s 5620771.426op/s ± 3981.820op/s 5621162.443op/s ± 2597.201op/s 5623139.328op/s 5627296.031op/s 5628773.590op/s 5629634.837op/s 0.15% -0.208 -0.149 0.07% 281.557op/s 1 200
normalization/normalize_service/normalize_service/[empty string] execution_time 37.532µs 37.643µs ± 0.044µs 37.644µs ± 0.030µs 37.673µs 37.719µs 37.744µs 37.787µs 0.38% 0.180 -0.171 0.12% 0.003µs 1 200
normalization/normalize_service/normalize_service/[empty string] throughput 26464271.129op/s 26565139.763op/s ± 31315.430op/s 26564989.192op/s ± 21152.119op/s 26586616.781op/s 26614543.898op/s 26626941.489op/s 26643942.613op/s 0.30% -0.174 -0.177 0.12% 2214.335op/s 1 200
normalization/normalize_service/normalize_service/test_ASCII execution_time 48.180µs 48.309µs ± 0.115µs 48.302µs ± 0.031µs 48.332µs 48.388µs 48.450µs 49.765µs 3.03% 10.194 125.994 0.24% 0.008µs 1 200
normalization/normalize_service/normalize_service/test_ASCII throughput 20094402.590op/s 20700140.415op/s ± 48208.872op/s 20703203.115op/s ± 13393.374op/s 20716708.661op/s 20735618.451op/s 20745509.794op/s 20755470.835op/s 0.25% -10.022 123.084 0.23% 3408.882op/s 1 200
scenario metric 95% CI mean Shapiro-Wilk pvalue Ljung-Box pvalue (lag=1) Dip test pvalue
normalization/normalize_service/normalize_service/A0000000000000000000000000000000000000000000000000... execution_time [504.966µs; 505.111µs] or [-0.014%; +0.014%] None None None
normalization/normalize_service/normalize_service/A0000000000000000000000000000000000000000000000000... throughput [1979764.162op/s; 1980330.822op/s] or [-0.014%; +0.014%] None None None
normalization/normalize_service/normalize_service/Data🐨dog🐶 繋がっ⛰てて execution_time [454.855µs; 454.995µs] or [-0.015%; +0.015%] None None None
normalization/normalize_service/normalize_service/Data🐨dog🐶 繋がっ⛰てて throughput [2197828.857op/s; 2198504.741op/s] or [-0.015%; +0.015%] None None None
normalization/normalize_service/normalize_service/Test Conversion 0f Weird !@#$%^&**() Characters execution_time [177.894µs; 177.929µs] or [-0.010%; +0.010%] None None None
normalization/normalize_service/normalize_service/Test Conversion 0f Weird !@#$%^&**() Characters throughput [5620219.585op/s; 5621323.268op/s] or [-0.010%; +0.010%] None None None
normalization/normalize_service/normalize_service/[empty string] execution_time [37.637µs; 37.650µs] or [-0.016%; +0.016%] None None None
normalization/normalize_service/normalize_service/[empty string] throughput [26560799.746op/s; 26569479.781op/s] or [-0.016%; +0.016%] None None None
normalization/normalize_service/normalize_service/test_ASCII execution_time [48.293µs; 48.325µs] or [-0.033%; +0.033%] None None None
normalization/normalize_service/normalize_service/test_ASCII throughput [20693459.129op/s; 20706821.701op/s] or [-0.032%; +0.032%] None None None

Group 8

cpu_model git_commit_sha git_commit_date git_branch
Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz e0e5c8a 1744811232 ganeshnj/feat/logging-ffi
scenario metric min mean ± sd median ± mad p75 p95 p99 max peak_to_median_ratio skewness kurtosis cv sem runs sample_size
redis/obfuscate_redis_string execution_time 31.988µs 33.008µs ± 1.414µs 32.115µs ± 0.069µs 34.919µs 35.445µs 35.519µs 35.540µs 10.67% 0.925 -1.096 4.27% 0.100µs 1 200
scenario metric 95% CI mean Shapiro-Wilk pvalue Ljung-Box pvalue (lag=1) Dip test pvalue
redis/obfuscate_redis_string execution_time [32.812µs; 33.204µs] or [-0.594%; +0.594%] None None None

Group 9

cpu_model git_commit_sha git_commit_date git_branch
Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz e0e5c8a 1744811232 ganeshnj/feat/logging-ffi
scenario metric min mean ± sd median ± mad p75 p95 p99 max peak_to_median_ratio skewness kurtosis cv sem runs sample_size
concentrator/add_spans_to_concentrator execution_time 5.961ms 5.979ms ± 0.012ms 5.978ms ± 0.004ms 5.982ms 5.988ms 6.024ms 6.083ms 1.77% 4.902 36.280 0.20% 0.001ms 1 200
scenario metric 95% CI mean Shapiro-Wilk pvalue Ljung-Box pvalue (lag=1) Dip test pvalue
concentrator/add_spans_to_concentrator execution_time [5.977ms; 5.980ms] or [-0.027%; +0.027%] None None None

Group 10

cpu_model git_commit_sha git_commit_date git_branch
Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz e0e5c8a 1744811232 ganeshnj/feat/logging-ffi
scenario metric min mean ± sd median ± mad p75 p95 p99 max peak_to_median_ratio skewness kurtosis cv sem runs sample_size
benching deserializing traces from msgpack to their internal representation execution_time 72.339ms 72.590ms ± 0.178ms 72.560ms ± 0.108ms 72.686ms 72.872ms 73.195ms 73.472ms 1.26% 1.800 5.617 0.25% 0.013ms 1 200
scenario metric 95% CI mean Shapiro-Wilk pvalue Ljung-Box pvalue (lag=1) Dip test pvalue
benching deserializing traces from msgpack to their internal representation execution_time [72.565ms; 72.615ms] or [-0.034%; +0.034%] None None None

Group 11

cpu_model git_commit_sha git_commit_date git_branch
Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz e0e5c8a 1744811232 ganeshnj/feat/logging-ffi
scenario metric min mean ± sd median ± mad p75 p95 p99 max peak_to_median_ratio skewness kurtosis cv sem runs sample_size
sql/obfuscate_sql_string execution_time 67.681µs 67.921µs ± 0.205µs 67.889µs ± 0.060µs 67.956µs 68.153µs 68.550µs 70.020µs 3.14% 6.177 55.795 0.30% 0.014µs 1 200
scenario metric 95% CI mean Shapiro-Wilk pvalue Ljung-Box pvalue (lag=1) Dip test pvalue
sql/obfuscate_sql_string execution_time [67.893µs; 67.950µs] or [-0.042%; +0.042%] None None None

Group 12

cpu_model git_commit_sha git_commit_date git_branch
Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz e0e5c8a 1744811232 ganeshnj/feat/logging-ffi
scenario metric min mean ± sd median ± mad p75 p95 p99 max peak_to_median_ratio skewness kurtosis cv sem runs sample_size
ip_address/quantize_peer_ip_address_benchmark execution_time 4.895µs 4.973µs ± 0.038µs 4.978µs ± 0.036µs 5.004µs 5.021µs 5.026µs 5.053µs 1.52% -0.246 -1.275 0.77% 0.003µs 1 200
scenario metric 95% CI mean Shapiro-Wilk pvalue Ljung-Box pvalue (lag=1) Dip test pvalue
ip_address/quantize_peer_ip_address_benchmark execution_time [4.968µs; 4.978µs] or [-0.107%; +0.107%] None None None

Group 13

cpu_model git_commit_sha git_commit_date git_branch
Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz e0e5c8a 1744811232 ganeshnj/feat/logging-ffi
scenario metric min mean ± sd median ± mad p75 p95 p99 max peak_to_median_ratio skewness kurtosis cv sem runs sample_size
tags/replace_trace_tags execution_time 2.327µs 2.380µs ± 0.015µs 2.379µs ± 0.006µs 2.386µs 2.413µs 2.419µs 2.425µs 1.90% -0.064 2.201 0.64% 0.001µs 1 200
scenario metric 95% CI mean Shapiro-Wilk pvalue Ljung-Box pvalue (lag=1) Dip test pvalue
tags/replace_trace_tags execution_time [2.378µs; 2.382µs] or [-0.088%; +0.088%] None None None

Baseline

Omitted due to size.

@r1viollet
Copy link
Contributor

r1viollet commented Apr 11, 2025

Artifact Size Benchmark Report

aarch64-alpine-linux-musl
Artifact Baseline Commit Change
/aarch64-alpine-linux-musl/lib/libdatadog_profiling.a 77.58 MB 78.79 MB +1.55% (+1.20 MB) ⚠️
/aarch64-alpine-linux-musl/lib/libdatadog_profiling.so 7.77 MB 7.98 MB +2.61% (+208.17 KB) ⚠️
/aarch64-alpine-linux-musl/lib/libdatadog_profiling.so.debug 24.05 MB 24.52 MB +1.93% (+477.10 KB) ⚠️
aarch64-unknown-linux-gnu
Artifact Baseline Commit Change
/aarch64-unknown-linux-gnu/lib/libdatadog_profiling.a 71.95 MB 73.22 MB +1.77% (+1.27 MB) ⚠️
/aarch64-unknown-linux-gnu/lib/libdatadog_profiling.so 7.70 MB 7.84 MB +1.82% (+144.31 KB) ⚠️
/aarch64-unknown-linux-gnu/lib/libdatadog_profiling.so.debug 22.66 MB 23.15 MB +2.16% (+502.56 KB) ⚠️
libdatadog-x64-windows
Artifact Baseline Commit Change
/libdatadog-x64-windows/debug/dynamic/datadog_profiling_ffi.dll 16.87 MB 16.90 MB +.13% (+22.50 KB) 🔍
/libdatadog-x64-windows/debug/dynamic/datadog_profiling_ffi.lib 61.83 KB 61.83 KB 0% (0 B) 👌
/libdatadog-x64-windows/debug/dynamic/datadog_profiling_ffi.pdb 113.66 MB 113.83 MB +.15% (+184.00 KB) 🔍
/libdatadog-x64-windows/debug/static/datadog_profiling_ffi.lib 633.16 MB 634.21 MB +.16% (+1.05 MB) 🔍
/libdatadog-x64-windows/release/dynamic/datadog_profiling_ffi.dll 5.02 MB 5.02 MB +0% (+512 B) 👌
/libdatadog-x64-windows/release/dynamic/datadog_profiling_ffi.lib 61.83 KB 61.83 KB 0% (0 B) 👌
/libdatadog-x64-windows/release/dynamic/datadog_profiling_ffi.pdb 16.02 MB 16.01 MB --.04% (-8.00 KB) 💪
/libdatadog-x64-windows/release/static/datadog_profiling_ffi.lib 26.62 MB 26.62 MB --.01% (-5.28 KB) 💪
libdatadog-x86-windows
Artifact Baseline Commit Change
/libdatadog-x86-windows/debug/dynamic/datadog_profiling_ffi.dll 14.28 MB 14.30 MB +.17% (+25.50 KB) 🔍
/libdatadog-x86-windows/debug/dynamic/datadog_profiling_ffi.lib 62.78 KB 62.78 KB 0% (0 B) 👌
/libdatadog-x86-windows/debug/dynamic/datadog_profiling_ffi.pdb 115.66 MB 115.82 MB +.13% (+160.00 KB) 🔍
/libdatadog-x86-windows/debug/static/datadog_profiling_ffi.lib 624.89 MB 626.56 MB +.26% (+1.67 MB) 🔍
/libdatadog-x86-windows/release/dynamic/datadog_profiling_ffi.dll 3.80 MB 3.81 MB +.05% (+2.00 KB) 🔍
/libdatadog-x86-windows/release/dynamic/datadog_profiling_ffi.lib 62.78 KB 62.78 KB 0% (0 B) 👌
/libdatadog-x86-windows/release/dynamic/datadog_profiling_ffi.pdb 16.64 MB 16.64 MB 0% (0 B) 👌
/libdatadog-x86-windows/release/static/datadog_profiling_ffi.lib 24.54 MB 24.54 MB +0% (+174 B) 👌
x86_64-alpine-linux-musl
Artifact Baseline Commit Change
/x86_64-alpine-linux-musl/lib/libdatadog_profiling.a 66.89 MB 67.97 MB +1.61% (+1.08 MB) ⚠️
/x86_64-alpine-linux-musl/lib/libdatadog_profiling.so 8.22 MB 8.40 MB +2.21% (+186.83 KB) ⚠️
/x86_64-alpine-linux-musl/lib/libdatadog_profiling.so.debug 23.21 MB 23.63 MB +1.78% (+424.66 KB) ⚠️
x86_64-unknown-linux-gnu
Artifact Baseline Commit Change
/x86_64-unknown-linux-gnu/lib/libdatadog_profiling.a 67.85 MB 68.97 MB +1.65% (+1.12 MB) ⚠️
/x86_64-unknown-linux-gnu/lib/libdatadog_profiling.so 8.11 MB 8.28 MB +2.11% (+175.71 KB) ⚠️
/x86_64-unknown-linux-gnu/lib/libdatadog_profiling.so.debug 20.85 MB 21.28 MB +2.07% (+443.86 KB) ⚠️

@github-actions github-actions bot added profiling Relates to the profiling* modules. ci-build labels Apr 11, 2025
@ganeshnj ganeshnj changed the title feat(data-pipeline): logging ffi feat(data-pipeline): Cross-Language Logging Integration Apr 14, 2025
@ganeshnj ganeshnj marked this pull request as ready for review April 14, 2025 12:04
@ganeshnj ganeshnj requested review from a team as code owners April 14, 2025 12:04
@ganeshnj ganeshnj requested a review from a team as a code owner April 14, 2025 12:04
@morrisonlevi
Copy link
Contributor

morrisonlevi commented Apr 14, 2025

The symbol prefixes I know are already in use are:

  • ddog_prof_*
  • ddog_crasht_*
  • ddog_trace_exporter_*
  • ddog_sidecar_*
  • ddog_telemetry_*

Can we name this ddog_log_* instead of ddlog_*?

@ganeshnj
Copy link
Contributor Author

The symbol prefixes I know are already in use are:

  • ddog_prof_*
  • ddog_crasht_*
  • ddog_trace_exporter_*
  • ddog_sidecar_*
  • ddog_telemetry_*

Can we name this ddog_log_* instead of ddlog_*?

actually this threw me off a few times, currently we have all sort of prefixes depending on the context (crate name vs dir name vs rust type name vs ffi method names)

do you mean anything specific like FFI methods or in general?

I agree that atleast ffi methods should be ddog_log_ since this is only way to namespace them.

@morrisonlevi
Copy link
Contributor

morrisonlevi commented Apr 15, 2025

There are conventions for the full name too, but they are less standardized. I was specifically talking about the FFI symbol prefixes with this comment. Within a package, you should be consistent with the FFI casing, types, etc, but across packages, I want to be consistent with ddog_$package_*, where $package is some shortened name of the crate.

And also I would prefer datadog-log or log for the directory name, with datadog-log for the package name. The ddblah convention is something I'd personally avoid, there's just two-ish (and their FFI crates) following that instead of datadog-blah.

crate name: datadog-log and datadog-log-ffi
dir name: log and log-ffi
prefix: ddog_log_
@ganeshnj
Copy link
Contributor Author

There are conventions for the full name too,

A lot of cognitive load... but anyway I would stick to what we have already.

crate name: datadog-log and datadog-log-ffi
dir name: log and log-ffi
prefix: ddog_log_

@@ -0,0 +1,46 @@
// Copyright 2025-Present Datadog, Inc. https://www.datadoghq.com/
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you think there is any value in adding something for log-ffi to examples?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good call, a dumb example would be good for people understand the usage.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I didn't add its own example but updated the trace exporter which actually emits some logs

➜ ./examples/ffi/build/trace_exporter                                                                                               
ERROR :: Error deserializing trace from request body :: err: "Invalid format: Unable to read array len for trace count"
Operation failed with error: 18, reason: Invalid format: Unable to read array len for trace count
TRACE :: checkout waiting for idle connection: ("http", localhost:8126) :: 
TRACE :: Http::connect; scheme=Some("http"), host=Some("localhost"), port=Some(Port(8126)) :: 
TRACE :: checkout dropped for ("http", localhost:8126) :: 
ERROR :: Error while fetching /info :: err: client error (Connect)

@@ -0,0 +1,210 @@
# RFC: Cross-Language Logging Integration for libdatadog
Copy link
Contributor

Choose a reason for hiding this comment

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

Given that we may want to clarify the RFC a bit, do you maybe want to add this in a separate PR? (Or add it now and change it later, up to you)

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.

5 participants