feat(opentelemetry): expose OtlpExporter as public API
Summary
Exposes the internal OTLP exporter as OtlpExporter.make() to allow building custom multi-endpoint tracers or composing multiple exporters without copying internal code.
Motivation
When building applications that need to send traces to multiple backends (e.g., Honeycomb + Axiom + Sentry), the current options are:
- Use
NodeSdkwith multipleSpanProcessors (requires@opentelemetry/sdk-trace-base) - Copy the internal exporter code
Exposing the exporter allows Effect-native multi-endpoint tracing without any OpenTelemetry SDK dependencies:
import { OtlpExporter, OtlpResource } from "@effect/opentelemetry"
const makeMultiExporter = (endpoints: Array<EndpointConfig>) =>
Effect.gen(function*() {
const exporters = yield* Effect.forEach(endpoints, e =>
OtlpExporter.make({
url: e.url,
headers: e.headers,
label: e.name,
exportInterval: "5 seconds",
maxBatchSize: 100,
body: (spans) => ({ resourceSpans: [{ scopeSpans: [{ spans }] }] }),
shutdownTimeout: "3 seconds"
})
)
return {
push: (data: unknown) => exporters.forEach(e => e.push(data))
}
})
Changes
- Added
src/OtlpExporter.ts- public module re-exporting the internal exporter with proper JSDoc documentation - Updated
src/index.ts- addedOtlpExporterexport - Added changeset
Test Plan
- [x] Existing tests pass (no behavioral changes)
- [ ] Would be good to add a test for the new public API
🤖 Generated with Claude Code
🦋 Changeset detected
Latest commit: 41e5623a893fb287938bfd54eb78d69e1131879b
The changes in this PR will be included in the next version bump.
This PR includes changesets to release 1 package
| Name | Type |
|---|---|
| @effect/opentelemetry | Minor |
Not sure what this means? Click here to learn what changesets are.
Click here if you're a maintainer who wants to add another changeset to this PR