Skip to content

Add BatchSpanProcessor.create(SpanExporter) to match SimpleSpanProcessor#8564

Open
jimbobbennett wants to merge 1 commit into
open-telemetry:mainfrom
jimbobbennett:batch-span-processor-create
Open

Add BatchSpanProcessor.create(SpanExporter) to match SimpleSpanProcessor#8564
jimbobbennett wants to merge 1 commit into
open-telemetry:mainfrom
jimbobbennett:batch-span-processor-create

Conversation

@jimbobbennett

@jimbobbennett jimbobbennett commented Jul 2, 2026

Copy link
Copy Markdown

What

Adds a BatchSpanProcessor.create(SpanExporter) convenience factory returning a default-configured processor (equivalent to builder(exporter).build()), mirroring the existing SimpleSpanProcessor.create(SpanExporter).

Why

SimpleSpanProcessor exposes both create(SpanExporter) and builder(SpanExporter), but BatchSpanProcessor only exposed builder(SpanExporter). Since SimpleSpanProcessor.create(exporter) compiles, it's natural to assume BatchSpanProcessor.create(exporter) does too — but it fails with cannot find symbol: method create(SpanExporter). This is purely additive and backward-compatible; the builder stays for configuration.

Fixes #8561

Details

  • New create(SpanExporter) static factory with @since 1.64.0 Javadoc.
  • Null-check on the exporter, mirroring SimpleSpanProcessor.
  • Tests: createDefaults() and createNull().
  • CHANGELOG entry and regenerated docs/apidiffs/current_vs_latest/opentelemetry-sdk-trace.txt.

@jimbobbennett jimbobbennett requested a review from a team as a code owner July 2, 2026 19:18
@linux-foundation-easycla

linux-foundation-easycla Bot commented Jul 2, 2026

Copy link
Copy Markdown

CLA Signed
The committers listed above are authorized under a signed CLA.

  • ✅ login: jimbobbennett / name: Jim Bennett (4e459b3)

@otelbot otelbot Bot added the api-change Changes to public API surface area label Jul 2, 2026
@otelbot

otelbot Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

⚠️ API changes detected — additional maintainer review required

@jack-berg @jkwatson

This PR modifies the public API surface area of the following module(s):

  • opentelemetry-sdk-trace

Please review the changes in docs/apidiffs/current_vs_latest/ carefully before approving.

@jimbobbennett

Copy link
Copy Markdown
Author

/easycla

`SimpleSpanProcessor` exposes both `create(SpanExporter)` and
`builder(SpanExporter)`, but `BatchSpanProcessor` only exposed
`builder(SpanExporter)`. This asymmetry is an easy trap: since
`SimpleSpanProcessor.create(exporter)` compiles, it's natural to assume
`BatchSpanProcessor.create(exporter)` does too.

Add a `create(SpanExporter)` factory to `BatchSpanProcessor` returning a
default-configured processor (equivalent to `builder(exporter).build()`),
mirroring `SimpleSpanProcessor`. Purely additive and backward-compatible.

Fixes open-telemetry#8561
@codecov

codecov Bot commented Jul 2, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.96%. Comparing base (2626179) to head (4e459b3).

Additional details and impacted files
@@            Coverage Diff            @@
##               main    #8564   +/-   ##
=========================================
  Coverage     90.96%   90.96%           
- Complexity    10207    10209    +2     
=========================================
  Files          1013     1013           
  Lines         27160    27162    +2     
  Branches       3182     3182           
=========================================
+ Hits          24706    24709    +3     
  Misses         1730     1730           
+ Partials        724      723    -1     

☔ 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api-change Changes to public API surface area

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Consistency: add BatchSpanProcessor.create(SpanExporter) to match SimpleSpanProcessor

1 participant