org.llm4s.trace.spi

Members list

Type members

Classlikes

A tracing backend: what one integration contributes to Tracing.create.

A tracing backend: what one integration contributes to Tracing.create.

Tracing.create builds the two backends that need nothing beyond core - NoOp and Console - itself, and hands every other TracingMode to the backend registered for it. Adding a backend is then adding a dependency, with no edit to core: the same arrangement slice 4 gave providers (#1131, #1133).

Implementations must be a plain class with a public no-arg constructor, '''not''' a Scala object: java.util.ServiceLoader instantiates the named class, and an object exposes its instance as a MODULE$ field instead.

class DatadogTracingBackend extends TracingBackend:
 val mode: TracingMode = TracingMode.Named("datadog")
 def create(settings: TracingSettings): Result[Tracing] =
   settings.extras.get("apiKey").toRight(ConfigurationError("llm4s.tracing.datadog.apiKey is not set"))
     .map(new DatadogTracing(_))

A backend's settings live under llm4s.tracing.<mode> and reach it as settings.extras: that block for the selected mode, flattened to strings. Ship their defaults and ${?VAR} bindings in the backend module's own reference.conf.

Declare the class in META-INF/services/org.llm4s.trace.spi.TracingBackend and TRACING_MODE=datadog selects it. A backend can also be registered explicitly through TracingBackends.of or TracingBackends.withBackend and passed to Tracing.fromSettings, which is the answer for a shaded fat jar whose services files did not survive.

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes
final class TracingBackends

The tracing backends Tracing.fromSettings can dispatch to, keyed by mode.

The tracing backends Tracing.fromSettings can dispatch to, keyed by mode.

Usually obtained from TracingBackends.discover, which reads META-INF/services/org.llm4s.trace.spi.TracingBackend entries off the classpath. When two backends claim the same mode the later registration wins, so an explicit withBackend replaces a discovered one.

Value parameters

discovered

whether this set came from classpath discovery rather than explicit registration.

failures

one line per service entry that could not be loaded, for diagnosing a missing backend; empty when discovery was clean or did not run.

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type