Repository navigation
Description
What version of Effect is running?
4.1.1 (same code on main at 6b70da9)
What steps can reproduce the bug?
Otlp.layerFromConfig installs no exporter unless OTEL_TRACES_EXPORTER, OTEL_METRICS_EXPORTER
or OTEL_LOGS_EXPORTER is set to otlp. With only an endpoint and a service name, the setup the
OpenTelemetry docs show, the layer builds and nothing is sent. The signal layerFromConfigs in
OtlpTracer, OtlpLogger and OtlpMetrics behave the same.
npm install [email protected]
OTEL_EXPORTER_OTLP_ENDPOINT=http://127.0.0.1:14318 OTEL_SERVICE_NAME=repro node repro.mjs// repro.mjs
import * as Http from "node:http"
import { Effect, Layer, Metric } from "effect"
import { FetchHttpClient } from "effect/http"
import { Otlp, OtlpExporter, OtlpSerialization } from "effect/observability"
const received = []
const server = Http.createServer((request, response) => {
received.push(`${request.method} ${request.url}`)
request.resume()
request.on("end", () => response.end("{}"))
})
await new Promise((resolve) => server.listen(14318, "127.0.0.1", resolve))
await Effect.runPromise(
Effect.gen(function*() {
yield* Effect.log("hello")
yield* Metric.update(Metric.counter("repro_counter"), 1)
yield* Effect.void.pipe(Effect.withSpan("repro-span"))
yield* (yield* OtlpExporter.Flusher).flush
}).pipe(
Effect.provide(
Otlp.layerFromConfig().pipe(
Layer.provide(OtlpSerialization.layerJson),
Layer.provide(FetchHttpClient.layer)
)
)
)
)
server.close()
console.log(`requests received: ${received.length}`)
for (const line of received) console.log(` ${line}`)What is the expected behavior?
Logs, metrics and traces are exported. The OpenTelemetry spec defaults all three
OTEL_*_EXPORTER variables to otlp
(spec).
The JS Node SDK
(create-from-env.ts)
and Go's autoexport
(signal.go)
export with the same variables.
What do you see instead?
requests received: 0
Adding OTEL_TRACES_EXPORTER=otlp gives POST /v1/traces only. Nothing logs a warning.
Additional information
The default is [] in
internal/otlpEnv.ts#L33-L36,
and each signal checks exporters.includes("otlp")
(OtlpTracer.ts#L182).
It dates from Effect-TS/effect-smol#2325 and no test asserts it. The JSDoc doesn't mention the
requirement.
Changing the default to ["otlp"] fixes it. none keeps working through the existing check.
Users who set an endpoint but relied on the missing variable to keep export off would start
exporting, and would set OTEL_*_EXPORTER=none instead. I can open a PR.
I investigated this with an AI coding agent, Claude Code. The agent read the Effect sources,
wrote the repro, and ran it. I reviewed the analysis before filing.
Activity