David Tovar Caballero
David Tovar Caballero

Reputation: 43

OpenTelemetry java manual instrumentation without exporter

Currently I am trying to POC OpenTelemetry for a web project (war) and upon reading lots of different documentations I still don't have a proper grasp on some issues, wonder if someone could help pointing out in right direction?

Basically:

1) Is it possible to have OpenTelemetry without any exporter?

I have used the config to do this (OTEL_TRACES_EXPORTER=none, OTEL_METRICS_EXPORTER=none). Would not having any exporter "work"?

2) Do I need to have a span processor in the SdkTracerProvider for Otel to work?

When building the SdkTracerProvider, I wonder if I MUST set a spanProcessor (like BatchSpanProcessor with LoggingSpanExporter) or if since I don't want to use a exporter, just not set a spanProcessor?

To be honest what I am trying to achieve is:

Not sure if this is something that is possible.

Upvotes: 2

Views: 4389

Answers (1)

Gaurang
Gaurang

Reputation: 221

I'm able to achieve what you are trying to achieve using below command and latest java agent and Log4j. I'm not seeing any export error and can see trace-id and span id in logs.

java -javaagent:opentelemetry-javaagent.jar \
-Dotel.traces.exporter=none \
-Dotel.metrics.exporter=none \
-Dotel.resource.attributes=service.name=Test-service \
-jar spring-app-0.0.1-SNAPSHOT.jar

Followed Document available here.

https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/main/docs/logger-mdc-instrumentation.md

I'm not sure of MDC part whether it works with manual instrumentation as in the above doc it is mentioned about java agent.

Upvotes: 2

Related Questions