Annotation Type OpenTelemetry
Traces this server with OpenTelemetry.
Put it on any class in the backend module -- a controller is the natural
place. The build then wires a tracer into the entry point it generates, and
from then on every request, every outbound Web call and every Database
statement is a span, exported over OTLP/HTTP to the collector the deployment
names:
@OpenTelemetry(serviceName = "orders")
@RestController
public class OrderController { ... }
OTEL_EXPORTER_OTLP_ENDPOINT=https://collector.internal:4318 ./server
Nothing else changes. An incoming traceparent makes the request part of the
caller's trace -- which is how a Codename One app's own spans connect to the
server's -- and the W3C trace context is sent on every outbound request.
A project that would rather not touch its source can set
cn1.otel.enabled=true in application.properties instead; the effect is
the same.
THIS IS A BUILD-TIME SWITCH, and deliberately so. Without it the tracer is
never referenced, so the translator leaves it out of the binary entirely. With
it, the deployment still has the last word: OTEL_SDK_DISABLED=true turns
tracing off at start-up without a rebuild.
-
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionTheservice.namespans are reported under, unlessOTEL_SERVICE_NAMEorcn1.otel.service.namenames another.
-
Element Details
-
serviceName
String serviceNameTheservice.namespans are reported under, unlessOTEL_SERVICE_NAMEorcn1.otel.service.namenames another. Empty meansunknown_service, which is what every OpenTelemetry SDK reports when nobody said.- Default:
""
-