Skip to content

Commit

Permalink
Disable upstream default exporter (for now) (#894)
Browse files Browse the repository at this point in the history
* prevent upstream default exporter from being configured (for now).

* spotless
  • Loading branch information
breedx-splk authored Aug 6, 2024
1 parent fe858e0 commit ee9a58e
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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) ->
Expand Down
Original file line number Diff line number Diff line change
@@ -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;

/*
* <p>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<SpanData> spans) {
return CompletableResultCode.ofSuccess();
}

@Override
public CompletableResultCode flush() {
return CompletableResultCode.ofSuccess();
}

@Override
public CompletableResultCode shutdown() {
return CompletableResultCode.ofSuccess();
}
}

0 comments on commit ee9a58e

Please sign in to comment.