Skip to content

Instantly share code, notes, and snippets.

@LikeTheSalad
LikeTheSalad / OTelAndroidInitialization.java
Created February 15, 2024 10:45
Configuring the OpenTelemetry Android lib (for its version `0.3.0`)
// This is to enable the exporting of spans using OTLP over GRPC.
// The dependency "io.opentelemetry:opentelemetry-exporter-otlp" needs to be present in the
// host project in order to make this work, more info on this dependency in the OTel Java repo: https://github.com/open-telemetry/opentelemetry-java
Function<SpanExporter, SpanExporter> spanExporterCustomizer = new Function<>() {
@Override
public SpanExporter apply(SpanExporter spanExporter) {
return OtlpGrpcSpanExporter.builder()
.setEndpoint("https://my.server.endpoint")
.build();
}