OtlpJsonEncoder

zio.blocks.telemetry.otel.OtlpJsonEncoder

Minimal OTLP JSON encoder for traces, metrics, and logs.

Encodes telemetry data into OTLP JSON format (protobuf JSON mapping) without external JSON library dependencies. Uses StringBuilder internally.

Encoding rules follow the protobuf JSON mapping:

  • bytes (traceId, spanId) → lowercase hex strings
  • int64/uint64 → quoted string numbers
  • enums → integer numbers
  • field names → camelCase

Attributes

Source
OtlpJsonEncoder.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Type members

Types

Attributes

Source
OtlpJsonEncoder.scala

Value members

Concrete methods

def encodeLogs(logs: Seq[LogRecord], resource: Resource, scope: InstrumentationScope): Array[Byte]

Attributes

Source
OtlpJsonEncoder.scala
def encodeMetrics(metrics: Seq[NamedMetric], resource: Resource, scope: InstrumentationScope): Array[Byte]

Attributes

Source
OtlpJsonEncoder.scala
def encodeTraces(spans: Seq[SpanData], resource: Resource, scope: InstrumentationScope): Array[Byte]

Attributes

Source
OtlpJsonEncoder.scala

Concrete fields

val NamedMetric: NamedMetric.type

Attributes

Source
OtlpJsonEncoder.scala