diff --git a/splunk-otel-android/src/main/java/com/splunk/rum/RumInitializer.java b/splunk-otel-android/src/main/java/com/splunk/rum/RumInitializer.java index 46a734c1..3e293733 100644 --- a/splunk-otel-android/src/main/java/com/splunk/rum/RumInitializer.java +++ b/splunk-otel-android/src/main/java/com/splunk/rum/RumInitializer.java @@ -32,6 +32,7 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; import com.splunk.rum.internal.GlobalAttributesSupplier; +import com.splunk.rum.internal.NoOpSpanExporter; import com.splunk.rum.internal.UInt32QuadXorTraceIdRatioSampler; import io.opentelemetry.android.OpenTelemetryRum; import io.opentelemetry.android.OpenTelemetryRumBuilder; @@ -125,6 +126,9 @@ SplunkRum initialize(Looper mainLooper) { return tracerProviderBuilder.addSpanProcessor(batchSpanProcessor); }); + // Inhibit the upstream exporter because we add our own BatchSpanProcessor + otelRumBuilder.addSpanExporterCustomizer(x -> new NoOpSpanExporter()); + // Set span limits otelRumBuilder.addTracerProviderCustomizer( (tracerProviderBuilder, app) -> diff --git a/splunk-otel-android/src/main/java/com/splunk/rum/internal/NoOpSpanExporter.java b/splunk-otel-android/src/main/java/com/splunk/rum/internal/NoOpSpanExporter.java new file mode 100644 index 00000000..b3ead6c3 --- /dev/null +++ b/splunk-otel-android/src/main/java/com/splunk/rum/internal/NoOpSpanExporter.java @@ -0,0 +1,43 @@ +/* + * Copyright Splunk Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.splunk.rum.internal; + +import io.opentelemetry.sdk.common.CompletableResultCode; +import io.opentelemetry.sdk.trace.data.SpanData; +import io.opentelemetry.sdk.trace.export.SpanExporter; +import java.util.Collection; + +/* + *

This class is internal and is hence not for public use. Its APIs are unstable and can change + * at any time. + */ +public final class NoOpSpanExporter implements SpanExporter { + @Override + public CompletableResultCode export(Collection spans) { + return CompletableResultCode.ofSuccess(); + } + + @Override + public CompletableResultCode flush() { + return CompletableResultCode.ofSuccess(); + } + + @Override + public CompletableResultCode shutdown() { + return CompletableResultCode.ofSuccess(); + } +}