Skip to content

Sprint 3 batch 3: OpenTelemetry tracing (opt-in)#131

Merged
keysersoft merged 1 commit into
mainfrom
keysersoft/otel
May 3, 2026
Merged

Sprint 3 batch 3: OpenTelemetry tracing (opt-in)#131
keysersoft merged 1 commit into
mainfrom
keysersoft/otel

Conversation

@keysersoft

Copy link
Copy Markdown
Contributor

Boots a NodeSDK with auto-instrumentations for http/express/pg/mysql/redis when OTEL_EXPORTER_OTLP_ENDPOINT is set. No-op otherwise. fs spans and /health ignored to keep noise out of the stream. Service identity attaches via standard service.name/service.version/deployment.environment.name semconv keys.

main.ts calls startTracing() before NestFactory.create so the instrumentations register before NestJS pulls in the modules they wrap.

Verified: backend 554/555, tsc clean.

src/tracing.ts boots a NodeSDK with auto-instrumentations for
http/express/pg/mysql/redis when OTEL_EXPORTER_OTLP_ENDPOINT is set;
otherwise it's a no-op so the default install ships nothing.

Auto-instrumentations:
  - fs spans disabled (one per file read on cold start = noise)
  - http instrumentation ignores /health to keep liveness probes out
    of the trace stream

Service identity attaches service.name / service.version /
deployment.environment.name from env (OTEL_SERVICE_NAME etc.) with
sensible defaults from npm_package_version + NODE_ENV.

main.ts calls startTracing() before NestFactory.create so the
instrumentations register before any of NestJS pulls in the modules
they wrap.

Sentry continues to work in parallel — operators who set both
SENTRY_DSN and OTEL_EXPORTER_OTLP_ENDPOINT get errors in Sentry and
traces in their OTLP collector.
@keysersoft
keysersoft merged commit 0b1e42a into main May 3, 2026
8 of 9 checks passed
@keysersoft
keysersoft deleted the keysersoft/otel branch May 12, 2026 08:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant