Package org.apache.juneau.rest.server.observation
juneau-rest-server — custom (non-request)
metrics + tracing around an arbitrary block of work.
Why explicit (no @Observed annotation)
Juneau has no method-interception / AOP substrate (no dynamic proxying of arbitrary beans, no
bytecode weaving, no annotation-processor agent). Rather than introduce one to support an
@Observed-style annotation, custom observations are explicit: application code wraps a
block in a try-with-resources over Observations#observe(String, String).
This is consistent with the framework's explicit-over-magic philosophy — the same reason the
curated dependency bundles register nothing automatically.
Reuses the request-path SPIs
Observations are recorded through the very same two SPIs the request path uses —
MetricsRecorder (via its non-request
record(name, tags, elapsed, error) default method) and
TracerHook (via its non-request startSpan(name)
default method) — and the same comma-separated metricName / metricTags model.
The shipped bridges (MicrometerMetricsRecorder, OtelTracerHook) override those default
methods; bridges that do not simply skip custom observations.
No-backend contract
When no backend is installed, Observations#observe(String, String)
returns Observation#NOOP — no timestamp taken,
no span opened, zero allocation beyond the try-with-resources scaffolding.
- Since:
- 10.0.0
-
ClassDescriptionHandle to one in-flight custom (non-request) observation.Static facade over an explicitly-installed default
Observerfor ergonomic custom (non-request) observations.