Package org.mockserver.telemetry
Class GenAiSpans
java.lang.Object
org.mockserver.telemetry.GenAiSpans
Static emit point for explicit GenAI semantic-convention spans describing the
LLM completions MockServer serves. A process-wide holder (like the metrics
gauges) so the action handler can record a span without threading a tracer
through its constructors.
No-op unless GenAiSpanExporter has installed a tracer (i.e. unless
mockserver.otelTracesEnabled is set). These are spans MockServer codes
deliberately — there is no auto-instrumentation. Fail-soft: any error while
recording is swallowed so telemetry never affects responses.
-
Method Summary
Modifier and TypeMethodDescriptionstatic booleanTrue if span emission is currently active.static voidrecordCompletion(Provider provider, String model, Completion completion) Emit one GenAI span for a served completion, following the OpenTelemetry GenAI semantic conventions (gen_ai.*).
-
Method Details
-
isEnabled
public static boolean isEnabled()True if span emission is currently active. -
recordCompletion
Emit one GenAI span for a served completion, following the OpenTelemetry GenAI semantic conventions (gen_ai.*). No-op when disabled.
-