Skip to content

ph telemetry

Philip Helger edited this page May 18, 2026 · 1 revision

Vendor-neutral tracing abstraction. Provides a thin span API plus a ServiceLoader-based SPI for plugging in a concrete backend (OpenTelemetry, Jaeger, Zipkin, etc.). If no implementation is registered, a built-in no-op tracer is used so callers can write tracing code unconditionally.

Highlights:

  • Telemetry - static facade for starting spans; lazily resolves the SPI implementation and falls back to a no-op tracer when none is registered
  • ITelemetrySpan - fluent span API with typed attribute setters, exception recording, and OK/ERROR status
  • ITelemetryTracerSPI - SPI interface to be implemented and registered via META-INF/services by a backend module
  • ETelemetrySpanKind - mirrors OpenTelemetry's SpanKind (INTERNAL, CLIENT, SERVER, PRODUCER, CONSUMER)
  • Telemetry.withSpan (name, kind, body) - convenience that starts a span, records exceptions on it, and ends it in a finally block

Maven usage

Add the following to your pom.xml to use this artifact:

<dependency>
  <groupId>com.helger.commons</groupId>
  <artifactId>ph-telemetry</artifactId>
  <version>x.y.z</version>
</dependency>

Note: this module was introduced to ph-commons in v12.2.6.

Clone this wiki locally