Skip to content

feat: add OpenTelemetry instrumentation and dual log transport - #3

Open
bautrey wants to merge 1 commit into
mainfrom
feature/obs-standard-outbound
Open

feat: add OpenTelemetry instrumentation and dual log transport#3
bautrey wants to merge 1 commit into
mainfrom
feature/obs-standard-outbound

Conversation

@bautrey

@bautrey bautrey commented Feb 27, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add OTel SDK with auto-instrumentation (HTTP, Fastify, pino)
  • Create instrumentation.ts — loaded via --import before app code
  • Create lib/logger.ts — pino with dual transport (stdout + Grafana Cloud Loki)
  • Sensitive header redaction (authorization, cookie, set-cookie)
  • Health check filtering from traces
  • All gated on OTEL_EXPORTER_OTLP_ENDPOINT — zero impact when not set

Part of

Fortium Observability Standardization (PRD-OBS-001, Phase 2)

Post-merge action required

Set in Render dashboard:

  • OTEL_EXPORTER_OTLP_ENDPOINT — Grafana OTLP gateway URL
  • OTEL_EXPORTER_OTLP_HEADERS — Basic auth header
  • OTEL_SERVICE_NAME=outbound-api

Test plan

  • App starts without errors with OTEL_EXPORTER_OTLP_ENDPOINT set
  • App starts without errors without OTel env vars (local dev)
  • Traces appear in Grafana Tempo under {service_name="outbound-api"}
  • Logs appear in Grafana Loki under {service_name="outbound-api"}
  • Existing routes and scout jobs unaffected

🤖 Generated with Claude Code

Add observability stack following the Gateway API reference pattern:
- OTel SDK with auto-instrumentation for HTTP, Fastify, and pino
- pino-opentelemetry-transport for dual log output (stdout + Grafana Loki)
- Separate logger module with sensitive header redaction
- Health check endpoint filtering from traces
- Gated activation via OTEL_EXPORTER_OTLP_ENDPOINT env var

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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