Skip to main content
TracerProvider[F[_]] is the entry point of the tracing API. It provides access to Tracer instances for instrumenting your application.

Overview

The TracerProvider is responsible for creating and managing Tracer instances. Each tracer is associated with an instrumentation scope, typically identified by the library or package name.

Methods

get

name
String
required
The name of the instrumentation scope, such as the instrumentation library, package, or fully qualified class name
Returns: F[Tracer[F]] Creates a named Tracer instance.
val tracerProvider: TracerProvider[IO] = ???
val tracer: IO[Tracer[IO]] = tracerProvider.get("com.service.runtime")

tracer

name
String
required
The name of the instrumentation scope, such as the instrumentation library, package, or fully qualified class name
Returns: TracerBuilder[F] Creates a TracerBuilder for a named Tracer instance. The builder allows you to configure additional metadata such as version and schema URL.
val tracerProvider: TracerProvider[IO] = ???
val tracer: IO[Tracer[IO]] = tracerProvider
  .tracer("com.service.runtime")
  .withVersion("1.0.0")
  .withSchemaUrl("https://opentelemetry.io/schema/v1.1.0")
  .get

liftTo

G[_]
Type Parameter
required
The target effect type with a MonadCancelThrow instance
Returns: TracerProvider[G] Modifies the context F using an implicit KindTransformer from F to G. This allows you to transform the provider to work with a different effect type. Requirements:
  • Implicit MonadCancelThrow[F]
  • Implicit MonadCancelThrow[G]
  • Implicit KindTransformer[F, G]

Companion Object

apply

Returns: TracerProvider[F] Summons an implicit TracerProvider[F] instance from the context.
val provider = TracerProvider[IO]

noop

F[_]
Type Parameter
required
The effect type with an Applicative instance
Returns: TracerProvider[F] Creates a no-op implementation of the TracerProvider. Both the provider and the TracerBuilder it creates have no-op implementations.
val noopProvider: TracerProvider[IO] = TracerProvider.noop[IO]

Build docs developers (and LLMs) love