Minor Changes
-
#5927
f4972edThanks @davidgoli! - Add protobuf protocol support for OTLP exportersThis introduces an
OtlpSerializationservice for choosing between JSON and Protobuf encoding.Breaking changes:
Otlp.layernow requires anOtlpSerializationlayer to be provided for
the desired encoding format.
JSON encoding:
import { Layer } from "effect" import { Otlp, OtlpSerialization } from "@effect/opentelemetry" // Option 1: Explicit JSON layer const layer = Otlp.layerJson({ baseUrl: "http://localhost:4318", resource: { serviceName: "my-service" } }) // Option 2: Use `layer` and provide OtlpSerialization JSON layer const layer = Otlp.layer({ baseUrl: "http://localhost:4318", resource: { serviceName: "my-service" } }).pipe(Layer.provide(OtlpSerialization.layerJson))
Protobuf encoding:
import { Otlp } from "@effect/opentelemetry" // Simply use layerProtobuf for protobuf encoding const layer = Otlp.layerProtobuf({ baseUrl: "http://localhost:4318", resource: { serviceName: "my-service" } })
-
#5952
4725a7eThanks @clayroach! - Make @opentelemetry/sdk-trace-node and @opentelemetry/sdk-trace-web required peer dependencies instead of optional. This fixes module resolution errors when importing from the main entry point.
Patch Changes
-
#5929
abdab5cThanks @schickling! - FixSpan.addEventto correctly handle the 2-argument overload with attributes.Previously, calling
span.addEvent("name", { foo: "bar" })would throwTypeError: {} is not iterablebecause the implementation incorrectly treated the attributes object as aTimeInput. The fix adds proper runtime type discrimination to distinguish betweenTimeInput(number, Date, or HrTime tuple) andAttributes(plain object). -
Updated dependencies [
7e925ea,118e7a4,d7e75d6,4860d1e]:- effect@3.19.15
- @effect/platform@0.94.2