File tree Expand file tree Collapse file tree
docs/apidiffs/current_vs_latest
main/java/io/opentelemetry/sdk/trace/export
test/java/io/opentelemetry/sdk/trace/export Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22
33## Unreleased
44
5+ ### SDK
6+
7+ #### Traces
8+
9+ * Add ` BatchSpanProcessor.create(SpanExporter) ` convenience factory to mirror
10+ ` SimpleSpanProcessor.create(SpanExporter) `
11+ ([ #8561 ] ( https://github.com/open-telemetry/opentelemetry-java/issues/8561 ) )
12+
513## Version 1.63.0 (2026-06-05)
614
715### API
Original file line number Diff line number Diff line change 11Comparing source compatibility of opentelemetry-sdk-trace-1.64.0-SNAPSHOT.jar against opentelemetry-sdk-trace-1.63.0.jar
2- No changes.
2+ *** MODIFIED CLASS: PUBLIC FINAL io.opentelemetry.sdk.trace.export.BatchSpanProcessor (not serializable)
3+ === CLASS FILE FORMAT VERSION: 52.0 <- 52.0
4+ +++ NEW METHOD: PUBLIC(+) STATIC(+) io.opentelemetry.sdk.trace.export.BatchSpanProcessor create(io.opentelemetry.sdk.trace.export.SpanExporter)
Original file line number Diff line number Diff line change 55
66package io .opentelemetry .sdk .trace .export ;
77
8+ import static java .util .Objects .requireNonNull ;
9+
810import io .opentelemetry .api .metrics .MeterProvider ;
911import io .opentelemetry .context .Context ;
1012import io .opentelemetry .sdk .common .CompletableResultCode ;
@@ -54,6 +56,24 @@ public final class BatchSpanProcessor implements SpanProcessor {
5456 private final Worker worker ;
5557 private final AtomicBoolean isShutdown = new AtomicBoolean (false );
5658
59+ /**
60+ * Returns a new {@link BatchSpanProcessor} with default configuration which batches spans
61+ * exported by the SDK then pushes them to the {@code spanExporter}.
62+ *
63+ * <p>This is a convenience method equivalent to {@code
64+ * BatchSpanProcessor.builder(spanExporter).build()}. Use {@link #builder(SpanExporter)} if you
65+ * need to customize the configuration.
66+ *
67+ * @param spanExporter the {@link SpanExporter} to which the Spans are pushed.
68+ * @return a new {@link BatchSpanProcessor}.
69+ * @throws NullPointerException if the {@code spanExporter} is {@code null}.
70+ * @since 1.64.0
71+ */
72+ public static BatchSpanProcessor create (SpanExporter spanExporter ) {
73+ requireNonNull (spanExporter , "spanExporter" );
74+ return builder (spanExporter ).build ();
75+ }
76+
5777 /**
5878 * Returns a new Builder for {@link BatchSpanProcessor}.
5979 *
Original file line number Diff line number Diff line change @@ -104,6 +104,21 @@ void builderDefaults() {
104104 TimeUnit .MILLISECONDS .toNanos (BatchSpanProcessorBuilder .DEFAULT_EXPORT_TIMEOUT_MILLIS ));
105105 }
106106
107+ @ Test
108+ void createDefaults () {
109+ BatchSpanProcessor processor =
110+ BatchSpanProcessor .create (new WaitingSpanExporter (0 , CompletableResultCode .ofSuccess ()));
111+ assertThat (processor ).isNotNull ();
112+ processor .shutdown ().join (10 , TimeUnit .SECONDS );
113+ }
114+
115+ @ Test
116+ void createNull () {
117+ assertThatThrownBy (() -> BatchSpanProcessor .create (null ))
118+ .isInstanceOf (NullPointerException .class )
119+ .hasMessage ("spanExporter" );
120+ }
121+
107122 @ Test
108123 void builderInvalidConfig () {
109124 assertThatThrownBy (
You can’t perform that action at this time.
0 commit comments