Used BatchSpansProcessor instead of SimpleSpansProcessor
BatchSpansProcessor won't get blocked by the exporter.
Fixes
MODIFY
agent-bootstrap/src/main/java/io/opentelemetry/auto/bootstrap/instrumentation/java/concurrent/State.java
agent-bootstrap/src/main/java/io/opentelemetry/auto/bootstrap/instrumentation/java/concurrent/State.java
@@ -37,7 +37,7 @@ public class State {
public void setParentSpan(final Span parentSpan) {
final boolean result = parentSpanRef.compareAndSet(null, parentSpan);
- if (!result) {
+ if (!result && parentSpanRef.get() != parentSpan) {
log.debug(
"Failed to set parent span because another parent span is already set {}: new: {}, old: {}",
this,

MODIFY
agent-tooling/src/main/java/io/opentelemetry/auto/tooling/TracerInstaller.java
agent-tooling/src/main/java/io/opentelemetry/auto/tooling/TracerInstaller.java
@@ -22,7 +22,7 @@ import io.opentelemetry.sdk.OpenTelemetrySdk;
import io.opentelemetry.sdk.contrib.auto.config.SpanExporterFactory;
import io.opentelemetry.sdk.metrics.export.IntervalMetricReader;
import io.opentelemetry.sdk.metrics.export.MetricExporter;
-import io.opentelemetry.sdk.trace.export.SimpleSpansProcessor;
+import io.opentelemetry.sdk.trace.export.BatchSpansProcessor;
import io.opentelemetry.sdk.trace.export.SpanExporter;
import java.io.File;
import java.net.MalformedURLException;
@@ -71,7 +71,9 @@ public class TracerInstaller {
if (spanExporterFactory != null) {
final SpanExporter spanExporter = spanExporterFactory.fromConfig(config);
OpenTelemetrySdk.getTracerProvider()
- .addSpanProcessor(SimpleSpansProcessor.create(spanExporter));
+ .addSpanProcessor(
+ BatchSpansProcessor.create(
+ spanExporter, BatchSpansProcessor.Config.loadFromDefaultSources()));
log.info("Installed span exporter: " + spanExporter.getClass().getName());
} else {
log.warn("No matching providers in jar " + exporterJar);

MODIFY
smoke-tests/src/main/groovy/io/opentelemetry/smoketest/AbstractSmokeTest.groovy
smoke-tests/src/main/groovy/io/opentelemetry/smoketest/AbstractSmokeTest.groovy
@@ -70,6 +70,11 @@ abstract class AbstractSmokeTest extends Specification {
processBuilder.environment().put("JAVA_HOME", System.getProperty("java.home"))
processBuilder.environment().put("DD_API_KEY", API_KEY)
+ // Setting configuration variables of batch span processor through env vars
+ // This config is to immediately flush a batch of 1 span with delay of 10ms
+ processBuilder.environment().put("OTEL_BSP_MAX_EXPORT_BATCH", "1")
+ processBuilder.environment().put("OTEL_BSP_SCHEDULE_DELAY", "10")
+
processBuilder.redirectErrorStream(true)
logfile = new File("${buildDirectory}/reports/testProcess.${this.getClass().getName()}.log")
processBuilder.redirectOutput(ProcessBuilder.Redirect.to(logfile))

Used BatchSpansProcessor instead of SimpleSpansProcessor (#393)

BatchSpansProcessor won't get blocked by the exporter.

Fixes #368