Skip to content

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

Description

@jimbobbennett

What

SimpleSpanProcessor exposes both a create(SpanExporter) static factory and a builder(SpanExporter), but BatchSpanProcessor exposes only builder(SpanExporter) — there is no BatchSpanProcessor.create(SpanExporter). (Verified against opentelemetry-sdk-trace 1.61.0.)

Processor create(exporter) builder(exporter)
SimpleSpanProcessor
BatchSpanProcessor

Why it matters

The asymmetry is an easy trap: 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). We've hit this repeatedly (notably from LLM-assisted code, which over-generalizes the create() shortcut across the two processors). The correct form is BatchSpanProcessor.builder(exporter).build(), but the inconsistency costs a compile cycle each time.

Proposal

Add a BatchSpanProcessor.create(SpanExporter) convenience factory returning a default-configured processor (equivalent to builder(exporter).build()), mirroring SimpleSpanProcessor. Purely additive and backward-compatible; the builder stays for configuration.

Happy to open a PR if the team is open to it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions