Interface Tracer

All Known Implementing Classes:
OtlpTracer

public interface Tracer

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).

  • Method Summary

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

    • open

      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(Tracer).
      Returns:
      false when the configuration turned tracing off, in which case the tracer is not installed and nothing was started
      Throws:
      IOException
    • startSpan

      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:
      parent - the local parent, or null
      traceparent - a remote parent's traceparent header, used when parent is null; null or malformed starts a new trace
      tracestate - the remote parent's tracestate, or null
    • flush

      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

      void shutdown(int timeoutMillis)
      Flushes, then stops the exporter.
    • 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

      void metrics(Map out)
      Adds this tracer's counters to a metrics snapshot.