Backend API. Server-side code: this runs in a Codename One backend, not in the app on the device.

public interface Tracer

Known subtypesOtlpTracer

Where spans come from and where they go.

The server is instrumented against this interface and nothing else, so a binary that installs no tracer carries no tracing implementation: the translator keeps a class only when something reaches it, and the one implementation, com.codename1.backend.otel.OtlpTracer, is reached only from the entry point the build generates for a project that asks for it (see @OpenTelemetry).

Methods

public abstract boolean open(Config config) throws IOExceptionReads the settings and starts whatever exports spans.
public abstract Span startSpan(String name, int kind, Span parent, String traceparent, String tracestate)A new span.
public abstract void flush(int timeoutMillis)Blocks until what has ended so far is exported, or the time runs out.
public abstract void shutdown(int timeoutMillis)Flushes, then stops the exporter.
public abstract HttpServer.Handler relay()The handler that relays client spans to the collector, or null when this deployment does not offer one.
public abstract void metrics(Map out)Adds this tracer’s counters to a metrics snapshot.

Method details

open

public abstract boolean open(Config config) throws IOException
Reads the settings and starts whatever exports spans. Called once, by Backend.Builder.start or by the application before Tracing.install.

Returns

false when the configuration turned tracing off, in which case the tracer is not installed and nothing was started

startSpan

public abstract Span startSpan(String name, int kind, Span parent, String traceparent, String tracestate)
A new span. Never null: a span the sampler declines is a non-recording one that still carries its trace context.

Parameters

name String
Not documented.
kind int
Not documented.
parent Span
the local parent, or null
traceparent String
a remote parent’s traceparent header, used when parent is null; null or malformed starts a new trace
tracestate String
the remote parent’s tracestate, or null

flush

public abstract void flush(int timeoutMillis)
Blocks until what has ended so far is exported, or the time runs out. A Lambda host freezes the process between invocations, so a background exporter there only runs when something waits for it.

shutdown

public abstract void shutdown(int timeoutMillis)
Flushes, then stops the exporter.

relay

public abstract HttpServer.Handler relay()
The handler that relays client spans to the collector, or null when this deployment does not offer one. The builder puts it ahead of the routers.

metrics

public abstract void metrics(Map out)
Adds this tracer’s counters to a metrics snapshot.