OpenTelemetry
Correlate logs with active trace and span IDs
Install the optional peer dependency:
bun add @opentelemetry/api
Import from the logixlysia/otel subpath:
import { Elysia } from 'elysia'
import logixlysia from 'logixlysia'
import { injectTraceContext } from 'logixlysia/otel'
const plugin = logixlysia()
const app = new Elysia()
.use(plugin)
.onRequest(({ request, store }) => {
injectTraceContext(store.logger, request)
})
.get('/', () => 'ok')
When an active span exists, trace_id and span_id are merged into the request context bag and appear on the access log, or on the custom log line that replaces the access line. Logixlysia does not start an OpenTelemetry SDK—you bring your own tracer provider and instrumentation.