Skip to content
// EFFECT DAYS 2026

OtlpSerialization unstable

Serializes OTLP payloads into HTTP request bodies.

Signal exporters build trace, metric, and log data structures in memory. This module provides the service that turns those structures into JSON or protobuf HTTP bodies before they are posted to an OTLP collector.

3 exports Since v4.0.0 Source

Layers

layerJson

unstable
Since v4.0.0

Provides OtlpSerialization using OTLP/HTTP JSON bodies.

Details

NaN, Infinity and -Infinity are written as the strings OTLP/JSON expects, not as null. bytesValue data is written as a base64 string.

Signature

declare const layerJson: Layer<OtlpSerialization, never, never>
Since v4.0.0

Provides OtlpSerialization using protobuf-encoded OTLP bodies with the application/x-protobuf content type.

Signature

declare const layerProtobuf: Layer<OtlpSerialization, never, never>

Services

Since v4.0.0

Service for serializing OTLP traces, metrics, and logs into HTTP request bodies.

Signature

declare class OtlpSerialization extends Shape<"effect/observability/OtlpSerialization", {
readonly logs: (data: LogsData) => HttpBody;
readonly metrics: (data: MetricsData) => HttpBody;
readonly traces: (data: TraceData) => HttpBody;
}, this> {
constructor(_: never);
}