github Effect-TS/effect @effect/opentelemetry@0.61.0

Minor Changes

  • #5927 f4972ed Thanks @davidgoli! - Add protobuf protocol support for OTLP exporters

    This introduces an OtlpSerialization service for choosing between JSON and Protobuf encoding.

    Breaking changes:

    • Otlp.layer now requires an OtlpSerialization layer 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 4725a7e Thanks @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 abdab5c Thanks @schickling! - Fix Span.addEvent to correctly handle the 2-argument overload with attributes.

    Previously, calling span.addEvent("name", { foo: "bar" }) would throw TypeError: {} is not iterable because the implementation incorrectly treated the attributes object as a TimeInput. The fix adds proper runtime type discrimination to distinguish between TimeInput (number, Date, or HrTime tuple) and Attributes (plain object).

  • Updated dependencies [7e925ea, 118e7a4, d7e75d6, 4860d1e]:

    • effect@3.19.15
    • @effect/platform@0.94.2

Don't miss a new effect release

NewReleases is sending notifications on new releases.