Skip to content

Feat/observability otel#155

Merged
BimaAdi merged 6 commits into
pyconid:devfrom
nizarfadlan:feat/observability-otel
Jun 7, 2026
Merged

Feat/observability otel#155
BimaAdi merged 6 commits into
pyconid:devfrom
nizarfadlan:feat/observability-otel

Conversation

@nizarfadlan

Copy link
Copy Markdown
Collaborator

Ringkasan

Menambahkan OpenTelemetry Collector untuk mengirim traces dan metrics ke Datadog, serta memperbaiki korelasi antara log dan trace.

Close #148

Perubahan

  • otel-collector-config.yaml — konfigurasi collector (OTLP receiver, Datadog exporter, memory limiter, batch processor)
  • docker-compose.otel.yaml — compose file terpisah untuk collector
  • docker-compose.yaml — normalisasi newline di akhir file
  • .env.example — placeholder DD_API_KEY dan DD_SITE
  • main.py — request logging middleware dengan trace/span ID dari active span context
  • core/log.py — prioritas trace/span ID (requestTraceIDotelTraceID → fallback span), uvicorn.access ditekan ke WARNING

Deployment

Collector dijalankan terpisah:

docker compose -f docker-compose.otel.yaml up -d

Env yang dibutuhkan: DD_API_KEY, opsional DD_SITE.

Log aplikasi tetap stdout JSON, belum diekspor via OTLP.

nizarfadlan and others added 6 commits June 6, 2026 19:29
Added OpenTelemetry support to the application, including metrics and tracing.
New telemetry configuration options have been added to the settings.
Logging has been enhanced to redact sensitive information, and various routes
have been instrumented to track payment and streaming events.

Also updated dependencies in requirements.txt to include OpenTelemetry packages.
- Introduced a new otel_collector service in docker-compose.yaml
- Added environment variables for Datadog integration
- Created otel-collector-config.yaml for OpenTelemetry configuration
- Implemented middleware to log request details including method, path,
  status code, and duration.
- Enhanced JsonFormatter to include OpenTelemetry trace and span IDs.
- Updated OpenTelemetry collector image version in docker-compose.
- Added memory limiter processor to the OpenTelemetry collector config.
Added support for capturing request trace and span IDs in the logging
middleware. This allows for better observability and tracing of requests
through the application, improving debugging and monitoring capabilities.
This commit introduces a new service for the OpenTelemetry collector in the
docker-compose setup. It includes configuration for the collector, environment
variables, and logging options to enhance observability in the application.
@nizarfadlan nizarfadlan changed the base branch from main to dev June 7, 2026 09:40
@BimaAdi BimaAdi merged commit 180674d into pyconid:dev Jun 7, 2026
4 checks passed
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.

Datadog telemetry

3 participants