Skip to content

Create BatchSpanProcessorBurstBenchmark.java - #8911

Open
adhamahmad wants to merge 1 commit into
open-telemetry:mainfrom
adhamahmad:add-batch-span-processor-burst-bench-mark
Open

adhamahmad wants to merge 1 commit into
open-telemetry:mainfrom
adhamahmad:add-batch-span-processor-burst-bench-mark

Conversation

@adhamahmad

Copy link
Copy Markdown
Contributor

Add JMH benchmark for BatchSpanProcessor burst absorption

Description

Part of #7508.

Follows the approach agreed in the issue: "Add a benchmark/test scenario that reproduces bursty high-throughput conditions and reports span drop behavior consistently" (agreed by @jack-berg).

Benchmark only: no production code or defaults change. It is a baseline for comparing opt-in alternatives later.

Changes

  • Add BatchSpanProcessorBurstBenchmark. Each operation produces a burst (6,000 spans) and calls forceFlush(); to ensure the accepted spans are fully processed before the next burst.
  • Simulate export latency (default 50 ms) with an exporter that completes asynchronously.
  • Parameterize burst size, maxQueueSize, maxExportBatchSize and exporter latency.
  • Report producedSpans, exportedSpans and droppedSpans as aux counters, updated during the measured operation. Drops come from the processor's internal telemetry (BatchSpanProcessorMetrics) and are checked against what the exporter completed; the benchmark fails if they disagree.

Testing

.\gradlew.bat --no-configuration-cache -PjmhIncludeSingleClass=BatchSpanProcessorBurstBenchmark :sdk:trace:jmh
.\gradlew.bat :sdk:trace:compileJmhJava :sdk:trace:checkstyleJmh

Per 6,000-span burst (aux counters are per-iteration totals, divided by bursts):

maxQueueSize Exported Dropped Time per burst
2048 (default) 2,560 3,440 (57%) ~293 ms
8192 6,000 0 ~672 ms

With the default queue, 57% of the burst is dropped. Increasing the queue to 8192 eliminates the drops for this workload, but requires draining all 6,000 spans rather than the 2,560 spans accepted with the default queue.

Environment: Windows, Temurin JDK 21.0.10. Absolute times are platform-dependent.

@adhamahmad
adhamahmad requested a review from a team as a code owner October 6, 2026 23:35
@opentelemetry-pr-dashboard

opentelemetry-pr-dashboard Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

Pull request dashboard status

Waiting on reviewers · refreshed 2026-10-07 00:02 UTC

Review the latest changes.

Status above doesn't look right?
  • Just replied or pushed? Anything around or after the refresh time above may not be picked up yet — give it a few minutes.
  • Anything look wrong? Report it with what you expected; it helps us improve the dashboard.

@codecov

codecov Bot commented Oct 6, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.12%. Comparing base (59581d4) to head (c20ade2).

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #8911      +/-   ##
============================================
- Coverage     91.13%   91.12%   -0.02%     
+ Complexity    10703    10702       -1     
============================================
  Files          1007     1007              
  Lines         28918    28918              
  Branches       3702     3702              
============================================
- Hits          26355    26351       -4     
  Misses         1736     1736              
- Partials        827      831       +4     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

This branch has not been deployed

No deployments
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