zio.blocks.telemetry

Members list

Packages

Type members

Classlikes

object AlwaysOffSampler extends Sampler

A sampler that always drops every span.

A sampler that always drops every span.

Attributes

Source
Sampler.scala
Supertypes
trait Sampler
class Object
trait Matchable
class Any
Self type
object AlwaysOnSampler extends Sampler

A sampler that always records and samples every span.

A sampler that always records and samples every span.

Attributes

Source
Sampler.scala
Supertypes
trait Sampler
class Object
trait Matchable
class Any
Self type
sealed trait AttributeKey[A]

Type-safe key for attribute storage. Each key is bound to a specific value type A.

Type-safe key for attribute storage. Each key is bound to a specific value type A.

AttributeKey instances are created via factory methods on the companion object, which enforce type consistency between key and value.

Type parameters

A

The type of values this key maps to

Attributes

Companion
object
Source
AttributeKey.scala
Supertypes
class Object
trait Matchable
class Any
object AttributeKey

Attributes

Companion
trait
Source
AttributeKey.scala
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
sealed trait AttributeType

Discriminator for AttributeKey type safety. Determines the expected value type for an attribute.

Discriminator for AttributeKey type safety. Determines the expected value type for an attribute.

Attributes

Companion
object
Source
AttributeType.scala
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object BooleanType
object DoubleSeqType
object DoubleType
object LongSeqType
object LongType
object StringSeqType
object StringType
Show all
object AttributeType

Attributes

Companion
trait
Source
AttributeType.scala
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
sealed trait AttributeValue

Represents the value of an attribute. Each variant corresponds to an AttributeType discriminator.

Represents the value of an attribute. Each variant corresponds to an AttributeType discriminator.

This sealed ADT mirrors OpenTelemetry's AnyValue protobuf message, which supports strings, booleans, 64-bit integers, doubles, and arrays of these types.

Attributes

Companion
object
Source
AttributeValue.scala
Supertypes
class Object
trait Matchable
class Any
Known subtypes
class BooleanValue
class DoubleValue
class LongSeqValue
class LongValue
class StringValue
Show all

Attributes

Companion
trait
Source
AttributeValue.scala
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type

Zero-allocation visitor for iterating over Attributes without boxing primitives.

Zero-allocation visitor for iterating over Attributes without boxing primitives.

Each visit* method is called with the raw unboxed value. Seq variants have default no-op implementations since they are rare.

Attributes

Source
AttributeVisitor.scala
Supertypes
class Object
trait Matchable
class Any
object Attributes

Attributes

Companion
class
Source
Attributes.scala
Supertypes
class Object
trait Matchable
class Any
Self type
Attributes.type
final class Attributes

An immutable collection of typed key-value attribute pairs.

An immutable collection of typed key-value attribute pairs.

Backed by parallel arrays with dual-slot storage: primitive values (Long, Double, Boolean) are stored unboxed in a Long array, while String values use a separate String array. A Byte type discriminator array selects the slot. Seq values use a separate AnyRef array for rare cases.

This design eliminates AttributeValue boxing for the common primitive cases, reducing GC pressure on hot paths.

Attributes

Companion
object
Source
Attributes.scala
Supertypes
class Object
trait Matchable
class Any
final class BoundCounter

Attributes

Source
Counter.scala
Supertypes
class Object
trait Matchable
class Any
final class BoundGauge

Attributes

Source
Gauge.scala
Supertypes
class Object
trait Matchable
class Any
final class BoundHistogram

Attributes

Source
Histogram.scala
Supertypes
class Object
trait Matchable
class Any
final class BoundUpDownCounter

Attributes

Source
UpDownCounter.scala
Supertypes
class Object
trait Matchable
class Any
case object BuildInfo

This object was generated by sbt-buildinfo.

This object was generated by sbt-buildinfo.

Attributes

Source
BuildInfo.scala
Supertypes
trait Singleton
trait Product
trait Mirror
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
Self type
BuildInfo.type

Console log processor — triggers the fast ConsoleLogEmitter in Logger. Uses a format that writes directly from raw values, bypassing LogRecord. Format: "2026-03-31T17:30:00.123Z INFO [MyClass.method:42] message {key=val}"

Console log processor — triggers the fast ConsoleLogEmitter in Logger. Uses a format that writes directly from raw values, bypassing LogRecord. Format: "2026-03-31T17:30:00.123Z INFO [MyClass.method:42] message {key=val}"

When a LogRecord is passed via emit() (e.g. via bridges/adapters), delegates to StdoutLogRecordProcessor to ensure full formatting with attributes and stacktrace.

Attributes

Source
ConsoleLogRecordProcessor.scala
Supertypes
class Object
trait Matchable
class Any

Attributes

Companion
trait
Source
ContextStorage.scala
Supertypes
class Object
trait Matchable
class Any
Self type
sealed trait ContextStorage[A]

Scoped context storage for propagating values through call stacks.

Scoped context storage for propagating values through call stacks.

Only two operations:

  • get(): read the current value
  • scoped(): run a block with a different value, automatically restored after

No set() — context is immutable outside scoped blocks. This aligns with JDK 25's ScopedValue semantics and prevents context leaks.

Attributes

See also

docs/adr/0001-scoped-context-no-set.md

Companion
object
Source
ContextStorage.scala
Supertypes
class Object
trait Matchable
class Any
final class Counter

Attributes

Companion
object
Source
Counter.scala
Supertypes
class Object
trait Matchable
class Any
object Counter

Attributes

Companion
class
Source
Counter.scala
Supertypes
class Object
trait Matchable
class Any
Self type
Counter.type
final class CounterBuilder

Builder for Counter instruments.

Builder for Counter instruments.

Attributes

Source
Meter.scala
Supertypes
class Object
trait Matchable
class Any
object Gauge

Attributes

Companion
class
Source
Gauge.scala
Supertypes
class Object
trait Matchable
class Any
Self type
Gauge.type
final class Gauge

Attributes

Companion
object
Source
Gauge.scala
Supertypes
class Object
trait Matchable
class Any
final class GaugeBuilder

Builder for Gauge instruments.

Builder for Gauge instruments.

Attributes

Source
Meter.scala
Supertypes
class Object
trait Matchable
class Any
final case class GaugeDataPoint(attributes: Attributes, timeNanos: Long, value: Double)

A data point for gauge metrics.

A data point for gauge metrics.

Value parameters

attributes

attributes identifying this time series

timeNanos

epoch nanoseconds when this value was observed

value

the current gauge value

Attributes

Source
MetricData.scala
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
final class Histogram

Attributes

Companion
object
Source
Histogram.scala
Supertypes
class Object
trait Matchable
class Any
object Histogram

Attributes

Companion
class
Source
Histogram.scala
Supertypes
class Object
trait Matchable
class Any
Self type
Histogram.type
final class HistogramBuilder

Builder for Histogram instruments.

Builder for Histogram instruments.

Attributes

Source
Meter.scala
Supertypes
class Object
trait Matchable
class Any
final case class HistogramDataPoint(attributes: Attributes, startTimeNanos: Long, timeNanos: Long, count: Long, sum: Double, min: Double, max: Double, bucketCounts: Array[Long], boundaries: Array[Double])

A data point for histogram metrics.

A data point for histogram metrics.

Value parameters

attributes

attributes identifying this time series

boundaries

upper exclusive boundaries for each bucket

bucketCounts

counts for each bucket (length = boundaries.length + 1)

count

total number of recorded values

max

maximum recorded value

min

minimum recorded value

startTimeNanos

epoch nanoseconds when the aggregation period started

sum

sum of all recorded values

timeNanos

epoch nanoseconds when this snapshot was taken

Attributes

Source
MetricData.scala
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
final case class InstrumentationScope(name: String, version: Option[String] = ..., attributes: Attributes = ...)

Identifies the library/component that produced telemetry.

Identifies the library/component that produced telemetry.

An InstrumentationScope represents a logical grouping of telemetry signals from a specific library or instrumentation. It typically includes the library name and optional version information.

Attributes

Source
InstrumentationScope.scala
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

JSON format compatible with OTLP log data model: {"timeUnixNano":...,"severityNumber":...,"severityText":"INFO","body":{"stringValue":"message"},"attributes":[...]}

JSON format compatible with OTLP log data model: {"timeUnixNano":...,"severityNumber":...,"severityText":"INFO","body":{"stringValue":"message"},"attributes":[...]}

Attributes

Source
LogFormatter.scala
Supertypes
trait LogFormatter
class Object
trait Matchable
class Any
Self type
final class LabeledCounter

A counter with pre-declared label names. Label values are validated at runtime to match the expected arity.

A counter with pre-declared label names. Label values are validated at runtime to match the expected arity.

Value parameters

counter

the underlying counter instrument

labelNames

the declared label names, in order

Attributes

Source
LabeledInstruments.scala
Supertypes
class Object
trait Matchable
class Any
final class LabeledGauge

A gauge with pre-declared label names. Label values are validated at runtime to match the expected arity.

A gauge with pre-declared label names. Label values are validated at runtime to match the expected arity.

Value parameters

gauge

the underlying gauge instrument

labelNames

the declared label names, in order

Attributes

Source
LabeledInstruments.scala
Supertypes
class Object
trait Matchable
class Any
final class LabeledHistogram

A histogram with pre-declared label names. Label values are validated at runtime to match the expected arity.

A histogram with pre-declared label names. Label values are validated at runtime to match the expected arity.

Value parameters

histogram

the underlying histogram instrument

labelNames

the declared label names, in order

Attributes

Source
LabeledInstruments.scala
Supertypes
class Object
trait Matchable
class Any
trait LogEnrichment[A]

Attributes

Companion
object
Source
LogEnrichment.scala
Supertypes
class Object
trait Matchable
class Any
object LogEnrichment

Attributes

Companion
trait
Source
LogEnrichment.scala
Supertypes
class Object
trait Matchable
class Any
Self type
trait LogFormatter

Stateless log formatter. Appends formatted output to a StringBuilder. Formatters are singletons — no per-instance state, zero allocation. The StringBuilder is owned and pooled by the emitter.

Stateless log formatter. Appends formatted output to a StringBuilder. Formatters are singletons — no per-instance state, zero allocation. The StringBuilder is owned and pooled by the emitter.

Attributes

Source
LogFormatter.scala
Supertypes
class Object
trait Matchable
class Any
Known subtypes
sealed trait LogMessage

Log message body — either a simple string or a structured template. Structured templates defer string construction until formatting.

Log message body — either a simple string or a structured template. Structured templates defer string construction until formatting.

Attributes

Companion
object
Source
LogRecord.scala
Supertypes
class Object
trait Matchable
class Any
Known subtypes
class Simple
class Templated
object LogMessage

Attributes

Companion
trait
Source
LogRecord.scala
Supertypes
class Object
trait Matchable
class Any
Self type
LogMessage.type
final case class LogRecord(timestampNanos: Long, observedTimestampNanos: Long, severity: Severity, severityText: String, body: LogMessage, attributes: Attributes, traceIdHi: Long, traceIdLo: Long, spanId: Long, traceFlags: Byte, resource: Resource, instrumentationScope: InstrumentationScope, throwable: Option[Throwable] = ...)

Represents an immutable log record with trace correlation support.

Represents an immutable log record with trace correlation support.

A LogRecord contains a log message, its severity level, timing information, and optional trace context for distributed tracing correlation. Trace fields use primitive sentinel values (0 = absent) instead of Option wrappers for zero allocation on the logging hot path.

Value parameters

attributes

Additional attributes/metadata associated with the log record

body

The log message body

instrumentationScope

The instrumentation scope (library/tool) that generated this log record

observedTimestampNanos

The time when the event was observed/recorded, in nanoseconds since Unix epoch

resource

The resource that generated this log record

severity

The severity level of the log record

severityText

The text representation of the severity level

spanId

Span ID as Long (0 means absent)

throwable

Optional throwable whose stack trace is deferred to export time

timestampNanos

The time when the event occurred, in nanoseconds since Unix epoch

traceFlags

Trace flags as Byte (0 means none/absent)

traceIdHi

High 64 bits of trace ID (0 with traceIdLo == 0 means absent)

traceIdLo

Low 64 bits of trace ID (0 with traceIdHi == 0 means absent)

Attributes

Companion
object
Source
LogRecord.scala
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object LogRecord

Attributes

Companion
class
Source
LogRecord.scala
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
LogRecord.type
final case class LogRecordBuilder(timestampNanos: Option[Long] = ..., observedTimestampNanos: Option[Long] = ..., severity: Severity = ..., body: LogMessage = ..., attributes: Attributes = ..., traceIdHi: Long = ..., traceIdLo: Long = ..., spanId: Long = ..., traceFlags: Byte = ..., resource: Resource = ..., instrumentationScope: InstrumentationScope = ...)

Immutable builder for constructing LogRecord instances with fluent API.

Immutable builder for constructing LogRecord instances with fluent API.

The builder provides sensible defaults for all fields:

  • timestamps default to current system time in nanoseconds
  • severity defaults to Info
  • severityText defaults to "INFO"
  • body defaults to empty string
  • attributes defaults to empty Attributes
  • trace fields default to 0 (absent)
  • resource defaults to Resource.empty
  • instrumentationScope defaults to InstrumentationScope with name "unknown"

Attributes

Source
LogRecord.scala
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Attributes

Companion
object
Source
LogRecordProcessor.scala
Supertypes
class Object
trait Matchable
class Any
Known subtypes

Attributes

Companion
trait
Source
LogRecordProcessor.scala
Supertypes
class Object
trait Matchable
class Any
Self type
object LogState

Attributes

Companion
class
Source
GlobalLogState.scala
Supertypes
class Object
trait Matchable
class Any
Self type
LogState.type
final class LogState

Attributes

Companion
object
Source
GlobalLogState.scala
Supertypes
class Object
trait Matchable
class Any
trait LogWriter

Writes formatted log output to a destination.

Writes formatted log output to a destination.

Attributes

Source
LogWriter.scala
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object NoopWriter
object StderrWriter
object StdoutWriter
final class Logger

Attributes

Source
Logger.scala
Supertypes
class Object
trait Matchable
class Any

Attributes

Companion
class
Source
LoggerProvider.scala
Supertypes
class Object
trait Matchable
class Any
Self type
final class LoggerProvider extends AutoCloseable

Attributes

Companion
object
Source
LoggerProvider.scala
Supertypes
class Object
trait Matchable
class Any
final class LoggerProviderBuilder

Attributes

Source
LoggerProvider.scala
Supertypes
class Object
trait Matchable
class Any
final case class Measurement(value: Double, attributes: Attributes)

A single measurement observation with a value and associated attributes.

A single measurement observation with a value and associated attributes.

Value parameters

attributes

attributes describing the measurement context

value

the measured value

Attributes

Source
MetricData.scala
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
final class Meter

A Meter creates and manages metric instruments for a given InstrumentationScope. All instruments created through a Meter are registered internally so the MetricReader can collect from them.

A Meter creates and manages metric instruments for a given InstrumentationScope. All instruments created through a Meter are registered internally so the MetricReader can collect from them.

Value parameters

instrumentationScope

the scope identifying the instrumentation library

Attributes

Source
Meter.scala
Supertypes
class Object
trait Matchable
class Any
final class MeterProvider extends AutoCloseable

Provides Meter instances keyed by instrumentation scope. A MeterProvider creates a shared MeterRegistry and MetricReader that collects from all meters.

Provides Meter instances keyed by instrumentation scope. A MeterProvider creates a shared MeterRegistry and MetricReader that collects from all meters.

Value parameters

resource

the resource describing the entity producing telemetry

Attributes

Companion
object
Source
MeterProvider.scala
Supertypes
class Object
trait Matchable
class Any
object MeterProvider

Attributes

Companion
class
Source
MeterProvider.scala
Supertypes
class Object
trait Matchable
class Any
Self type
final class MeterProviderBuilder

Builder for MeterProvider.

Builder for MeterProvider.

Attributes

Source
MeterProvider.scala
Supertypes
class Object
trait Matchable
class Any
object MetricData

Attributes

Companion
trait
Source
MetricData.scala
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
MetricData.type
sealed trait MetricData

Aggregated metric data collected from an instrument. Each variant holds a list of data points, one per unique attribute set observed.

Aggregated metric data collected from an instrument. Each variant holds a list of data points, one per unique attribute set observed.

Attributes

Companion
object
Source
MetricData.scala
Supertypes
class Object
trait Matchable
class Any
Known subtypes
class GaugeData
class SumData
trait MetricReader extends AutoCloseable

Reads and collects metric data from all registered instruments.

Reads and collects metric data from all registered instruments.

Attributes

Source
MetricReader.scala
Supertypes
class Object
trait Matchable
class Any
Known subtypes
final class MetricReaderImpl extends MetricReader

Default MetricReader implementation backed by a MeterProvider's meter registry.

Default MetricReader implementation backed by a MeterProvider's meter registry.

Attributes

Source
MetricReader.scala
Supertypes
trait MetricReader
class Object
trait Matchable
class Any
object NoopWriter extends LogWriter

Discards output. For benchmarking the formatting path.

Discards output. For benchmarking the formatting path.

Attributes

Source
LogWriter.scala
Supertypes
trait LogWriter
class Object
trait Matchable
class Any
Self type
NoopWriter.type

Callback used by asynchronous instruments to publish observed values during a collection cycle.

Callback used by asynchronous instruments to publish observed values during a collection cycle.

Attributes

Source
ObservableCallback.scala
Supertypes
class Object
trait Matchable
class Any

Attributes

Companion
class
Source
ObservableCounter.scala
Supertypes
class Object
trait Matchable
class Any
Self type
final class ObservableCounter

Attributes

Companion
object
Source
ObservableCounter.scala
Supertypes
class Object
trait Matchable
class Any

Attributes

Companion
class
Source
ObservableGauge.scala
Supertypes
class Object
trait Matchable
class Any
Self type
final class ObservableGauge

Attributes

Companion
object
Source
ObservableGauge.scala
Supertypes
class Object
trait Matchable
class Any

Attributes

Companion
object
Source
ObservableUpDownCounter.scala
Supertypes
class Object
trait Matchable
class Any

Attributes

Companion
class
Source
ObservableUpDownCounter.scala
Supertypes
class Object
trait Matchable
class Any
Self type
final case class ParentBasedSampler(root: Sampler) extends Sampler

A sampler that delegates to the parent span's sampling decision.

A sampler that delegates to the parent span's sampling decision.

If no parent exists, delegates to the provided root sampler. If a parent exists, the decision follows the parent's sampled flag.

Value parameters

root

the sampler to use when there is no parent span

Attributes

Source
Sampler.scala
Supertypes
trait Serializable
trait Product
trait Equals
trait Sampler
class Object
trait Matchable
class Any
Show all
final class PlatformExecutor

Attributes

Companion
object
Source
PlatformExecutor.scala
Supertypes
class Object
trait Matchable
class Any

Attributes

Companion
class
Source
PlatformExecutor.scala
Supertypes
class Object
trait Matchable
class Any
Self type
final case class Resource(attributes: Attributes)

Describes the entity producing telemetry (service, container, host, etc.).

Describes the entity producing telemetry (service, container, host, etc.).

Resources are immutable wrappers around Attributes that identify the application/service generating the telemetry data. A Resource typically includes semantic attributes like service.name, service.version, and deployment environment.

Attributes

Companion
object
Source
Resource.scala
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object Resource

Attributes

Companion
class
Source
Resource.scala
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
Resource.type
trait Sampler

A sampler decides whether a span should be recorded and/or sampled.

A sampler decides whether a span should be recorded and/or sampled.

Samplers are invoked during span creation to determine the sampling decision for the new span.

Attributes

Source
Sampler.scala
Supertypes
class Object
trait Matchable
class Any
Known subtypes
sealed trait SamplingDecision

Represents a sampling decision made by a Sampler.

Represents a sampling decision made by a Sampler.

Attributes

Companion
object
Source
Sampler.scala
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object Drop
object RecordOnly

Attributes

Companion
trait
Source
Sampler.scala
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
final case class SamplingResult(decision: SamplingDecision, attributes: Attributes, traceState: String)

The result of a sampling decision, including the decision itself, any additional attributes to add to the span, and the trace state.

The result of a sampling decision, including the decision itself, any additional attributes to add to the span, and the trace state.

Value parameters

attributes

additional attributes to add to the span

decision

the sampling decision

traceState

the trace state string to propagate

Attributes

Source
Sampler.scala
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
sealed trait Severity

Represents the severity/log level of a log record with 24 levels grouped in 6 categories: Trace (1-4), Debug (5-8), Info (9-12), Warn (13-16), Error (17-20), Fatal (21-24).

Represents the severity/log level of a log record with 24 levels grouped in 6 categories: Trace (1-4), Debug (5-8), Info (9-12), Warn (13-16), Error (17-20), Fatal (21-24).

Each severity level has a numeric value and a text representation.

Attributes

Companion
object
Source
Severity.scala
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object Debug
object Debug2
object Debug3
object Debug4
object Error
object Error2
object Error3
object Error4
object Fatal
object Fatal2
object Fatal3
object Fatal4
object Info
object Info2
object Info3
object Info4
object Trace
object Trace2
object Trace3
object Trace4
object Warn
object Warn2
object Warn3
object Warn4
Show all
object Severity

Attributes

Companion
trait
Source
Severity.scala
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
Severity.type
final case class SourceLocation(filePath: String, namespace: String, methodName: String, lineNumber: Int)

Attributes

Source
SourceLocation.scala
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
trait Span

A mutable, thread-safe span representing a unit of work in a trace.

A mutable, thread-safe span representing a unit of work in a trace.

Spans are created via SpanBuilder and track attributes, events, and status throughout their lifetime. Once end() is called, the span stops recording and all mutating methods become no-ops.

Attributes

Companion
object
Source
Span.scala
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object NoOp
object Span

Attributes

Companion
trait
Source
Span.scala
Supertypes
class Object
trait Matchable
class Any
Self type
Span.type
object SpanBuilder

Attributes

Companion
class
Source
SpanBuilder.scala
Supertypes
class Object
trait Matchable
class Any
Self type
final class SpanBuilder

Fluent builder for creating spans.

Fluent builder for creating spans.

Configured via chained method calls, then startSpan() creates the recording span. The builder creates a new SpanId and inherits the TraceId from the parent context (or generates a new one for root spans).

Attributes

Companion
object
Source
SpanBuilder.scala
Supertypes
class Object
trait Matchable
class Any
object SpanContext

Attributes

Companion
class
Source
SpanContext.scala
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
final case class SpanContext(traceIdHi: Long, traceIdLo: Long, spanId: SpanId, traceFlags: TraceFlags, traceState: String, isRemote: Boolean)

Represents an OpenTelemetry SpanContext - the propagatable part of a span.

Represents an OpenTelemetry SpanContext - the propagatable part of a span.

The trace ID is inlined as two Long fields (traceIdHi, traceIdLo) for zero heap allocation. SpanId and TraceFlags are AnyVal types, also zero-alloc.

Value parameters

isRemote

whether this context originates from a remote parent

spanId

the span identifier

traceFlags

the trace flags (sampled flag, etc.)

traceIdHi

the high 64 bits of the trace identifier

traceIdLo

the low 64 bits of the trace identifier

traceState

the trace state string (vendor-specific tracing headers)

Attributes

Companion
object
Source
SpanContext.scala
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
final case class SpanData(name: String, kind: SpanKind, spanContext: SpanContext, parentSpanContext: SpanContext, startTimeNanos: Long, endTimeNanos: Long, attributes: Attributes, events: List[SpanEvent], links: List[SpanLink], status: SpanStatus, resource: Resource, instrumentationScope: InstrumentationScope)

Immutable snapshot of span data for export.

Immutable snapshot of span data for export.

Created by calling toSpanData on a Span. Contains all information collected during the span's lifetime.

Value parameters

attributes

attributes set on the span

endTimeNanos

epoch nanoseconds when the span ended

events

events recorded during the span

instrumentationScope

the instrumentation scope that created this span

kind

the span kind

links

links to other spans

name

the span name

parentSpanContext

the parent span's context (invalid if root span)

resource

the resource producing this span

spanContext

the span's own context

startTimeNanos

epoch nanoseconds when the span started

status

the span's completion status

Attributes

Source
SpanData.scala
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
final case class SpanEvent(name: String, timestampNanos: Long, attributes: Attributes)

An event associated with a span, capturing a point-in-time occurrence.

An event associated with a span, capturing a point-in-time occurrence.

Value parameters

attributes

attributes associated with this event

name

human-readable name of the event

timestampNanos

epoch nanoseconds when the event occurred

Attributes

Source
SpanData.scala
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
final class SpanId(val value: Long) extends AnyVal

Represents an OpenTelemetry SpanId - a 64-bit identifier for a span.

Represents an OpenTelemetry SpanId - a 64-bit identifier for a span.

Implemented as an AnyVal for zero heap allocation when used as a field in a case class.

Value parameters

value

the span ID as a 64-bit long

Attributes

Companion
object
Source
SpanId.scala
Supertypes
class AnyVal
trait Matchable
class Any
object SpanId

Attributes

Companion
class
Source
SpanId.scala
Supertypes
class Object
trait Matchable
class Any
Self type
SpanId.type
object SpanKind

Attributes

Companion
trait
Source
SpanKind.scala
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
SpanKind.type
sealed trait SpanKind

Represents the kind of span - distinguishes the type of span based on its relationship in a trace.

Represents the kind of span - distinguishes the type of span based on its relationship in a trace.

Follows OpenTelemetry span kind specification.

Attributes

Companion
object
Source
SpanKind.scala
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object Client
object Consumer
object Internal
object Producer
object Server
final case class SpanLink(spanContext: SpanContext, attributes: Attributes)

A link to another span, used to represent causal relationships across traces.

A link to another span, used to represent causal relationships across traces.

Value parameters

attributes

attributes associated with this link

spanContext

the context of the linked span

Attributes

Source
SpanData.scala
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Receives span lifecycle events from a Tracer.

Receives span lifecycle events from a Tracer.

Processors can export spans, buffer them, or perform in-memory inspection.

Attributes

Companion
object
Source
SpanProcessor.scala
Supertypes
class Object
trait Matchable
class Any
object SpanProcessor

Attributes

Companion
trait
Source
SpanProcessor.scala
Supertypes
class Object
trait Matchable
class Any
Self type
sealed trait SpanStatus

Represents the completion status of a span.

Represents the completion status of a span.

Follows OpenTelemetry span status specification.

Attributes

Companion
object
Source
SpanStatus.scala
Supertypes
class Object
trait Matchable
class Any
Known subtypes
class Error
object Ok
object Unset
object SpanStatus

Attributes

Companion
trait
Source
SpanStatus.scala
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
SpanStatus.type
object StderrWriter extends LogWriter

Writes to System.err (stderr).

Writes to System.err (stderr).

Attributes

Source
LogWriter.scala
Supertypes
trait LogWriter
class Object
trait Matchable
class Any
Self type
object StdoutWriter extends LogWriter

Writes to System.out (stdout).

Writes to System.out (stdout).

Attributes

Source
LogWriter.scala
Supertypes
trait LogWriter
class Object
trait Matchable
class Any
Self type
final case class SumDataPoint(attributes: Attributes, startTimeNanos: Long, timeNanos: Long, value: Long)

A data point for sum-based metrics (Counter, UpDownCounter).

A data point for sum-based metrics (Counter, UpDownCounter).

Value parameters

attributes

attributes identifying this time series

startTimeNanos

epoch nanoseconds when the aggregation period started

timeNanos

epoch nanoseconds when this snapshot was taken

value

the aggregated sum value

Attributes

Source
MetricData.scala
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Human-readable text format: "2026-03-31T17:30:00.123Z INFO [MyClass.method:42] message {key=val}"

Human-readable text format: "2026-03-31T17:30:00.123Z INFO [MyClass.method:42] message {key=val}"

Attributes

Source
LogFormatter.scala
Supertypes
trait LogFormatter
class Object
trait Matchable
class Any
Self type
object TraceFlags

Attributes

Companion
class
Source
TraceFlags.scala
Supertypes
class Object
trait Matchable
class Any
Self type
TraceFlags.type
final class TraceFlags(val byte: Byte) extends AnyVal

Represents OpenTelemetry trace flags - a single byte where bit 0 represents the sampled flag.

Represents OpenTelemetry trace flags - a single byte where bit 0 represents the sampled flag.

Implemented as an AnyVal for zero heap allocation when used as a field in a case class.

Value parameters

byte

the underlying byte value

Attributes

Companion
object
Source
TraceFlags.scala
Supertypes
class AnyVal
trait Matchable
class Any
object TraceId

Utility object for OpenTelemetry TraceId operations.

Utility object for OpenTelemetry TraceId operations.

TraceId is a 128-bit identifier represented as two Long values (hi and lo). Instead of wrapping them in a case class, the hi/lo values are inlined directly into SpanContext for zero heap allocation.

Attributes

Source
TraceId.scala
Supertypes
class Object
trait Matchable
class Any
Self type
TraceId.type
final class Tracer

Creates spans within a single instrumentation scope.

Creates spans within a single instrumentation scope.

A tracer consults the configured sampler, manages parent context propagation, and notifies registered span processors as spans start and end.

Attributes

Source
Tracer.scala
Supertypes
class Object
trait Matchable
class Any
final class TracerProvider extends AutoCloseable

Factory for Tracer instances that share resource, sampler, processors, and context storage configuration.

Factory for Tracer instances that share resource, sampler, processors, and context storage configuration.

Attributes

Companion
object
Source
TracerProvider.scala
Supertypes
class Object
trait Matchable
class Any

Attributes

Companion
class
Source
TracerProvider.scala
Supertypes
class Object
trait Matchable
class Any
Self type
final class TracerProviderBuilder

Mutable builder for TracerProvider.

Mutable builder for TracerProvider.

Attributes

Source
TracerProvider.scala
Supertypes
class Object
trait Matchable
class Any
final class UpDownCounter

Attributes

Companion
object
Source
UpDownCounter.scala
Supertypes
class Object
trait Matchable
class Any
object UpDownCounter

Attributes

Companion
class
Source
UpDownCounter.scala
Supertypes
class Object
trait Matchable
class Any
Self type
final class UpDownCounterBuilder

Builder for UpDownCounter instruments.

Builder for UpDownCounter instruments.

Attributes

Source
Meter.scala
Supertypes
class Object
trait Matchable
class Any
object log

Attributes

Source
log.scala
Supertypes
class Object
trait Matchable
class Any
Self type
log.type
object metric

Global metrics entry point. Works without setup. Call install to wire production exporters.

Global metrics entry point. Works without setup. Call install to wire production exporters.

App code uses this directly. Library code should accept Meter via DI.

Attributes

Source
metric.scala
Supertypes
class Object
trait Matchable
class Any
Self type
metric.type
object trace

Global tracing entry point. Works without setup — stores spans in memory by default. Call install to wire production exporters.

Global tracing entry point. Works without setup — stores spans in memory by default. Call install to wire production exporters.

App code uses this directly. Library code should accept Tracer via DI.

Attributes

Source
trace.scala
Supertypes
class Object
trait Matchable
class Any
Self type
trace.type