Skip to content

[BENCHMARK] add SpanData recordable benchmark and unify common utils#4203

Merged
marcalff merged 8 commits into
open-telemetry:mainfrom
dbarker:add_span_data_recordable_benchmark
Jul 10, 2026
Merged

[BENCHMARK] add SpanData recordable benchmark and unify common utils#4203
marcalff merged 8 commits into
open-telemetry:mainfrom
dbarker:add_span_data_recordable_benchmark

Conversation

@dbarker

@dbarker dbarker commented Jul 1, 2026

Copy link
Copy Markdown
Member

Contributes to #4046

Changes

  • Adds common span recordable benchmark utils to test common
    • common data and helpers to test recording spans with varying numbers of attributes, events, and links
  • Adds a SpanData recordable benchmark.
  • Update OtlpRecordable benchmark use the common uitls

For significant contributions please make sure you have completed the following items:

  • CHANGELOG.md updated for non-trivial changes
  • Unit tests have been added
  • Changes in public API reviewed

…on. Update otlp recordable benchmark to match the SpanData benchmark
@codecov

codecov Bot commented Jul 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.78%. Comparing base (938eab8) to head (0f80782).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #4203      +/-   ##
==========================================
- Coverage   82.79%   82.78%   -0.00%     
==========================================
  Files         415      415              
  Lines       17452    17450       -2     
==========================================
- Hits        14447    14445       -2     
  Misses       3005     3005              
Files with missing lines Coverage Δ
sdk/src/trace/span_data.cc 98.42% <100.00%> (-0.04%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@dbarker dbarker marked this pull request as ready for review July 1, 2026 22:08
@dbarker dbarker requested a review from a team as a code owner July 1, 2026 22:08
// BM_PopulateRequest/span_count:512_median 26.3 us 26.3 us 5 items_per_second=19.4746M/s
// BM_PopulateRequest/span_count:512_stddev 0.078 us 0.077 us 5 items_per_second=56.7323k/s
// BM_PopulateRequest/span_count:512_cv 0.30 % 0.29 % 5 items_per_second=0.29%
// Load Average: 2.05, 1.65, 1.67

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Comparing SpanData to OtlpRecordable performance on the recording benchmark cases from this PR (otlp_recordable_benchmark/span_data_benchmark) shows that recording span attributes, events, and links into the SpanData recordable (backed by STL types) outperforms recording into OtlpRecordable (backed by the protobuf span type).

This is interesting because SpanData enforces attribute key uniqueness (OltpRecordable does not) and it can meet requirements for additional span Readable/ReadWriteSpan interfaces.


Benchmark OtlpRecordable mean (ns) SpanData mean (ns) % Difference CV Otlp CV SpanData
RecordMinimalSpan 362 341 −5.8% 0.49% 0.28%
RecordNominalSpan 638 581 −8.9% 1.26% 2.63%
RecordSpanWithAttributes/1 414 390 −5.8% 0.47% 1.07%
RecordSpanWithAttributes/10 880 705 −19.9% 1.46% 0.90%
RecordSpanWithAttributes/128 7293 7479 +2.6% 11.55% 2.53%
RecordSpanWithEvents/1 502 456 −9.2% 0.21% 0.63%
RecordSpanWithEvents/10 1705 1584 −7.1% 1.70% 1.54%
RecordSpanWithEvents/128 16750 16434 −1.9% 1.71% 1.28%
RecordSpanWithLinks/1 511 435 −14.9% 1.13% 0.49%
RecordSpanWithLinks/10 1784 1368 −23.3% 0.34% 1.63%
RecordSpanWithLinks/128 19515 15304 −21.6% 12.31% 6.08%

@marcalff marcalff left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, thanks for the benchmark utilities.

This will help a lot.

@marcalff

Copy link
Copy Markdown
Member

The only changes in production code is 2 lines in span_data.cc, which should improve performances.
Everything else is test code for benchmarks.
Assessment is low risk, merging now.

@marcalff marcalff merged commit 5c60fa8 into open-telemetry:main Jul 10, 2026
72 checks passed
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.

2 participants