Skip to content

feat: Add HTTP request metrics instrumentation#75

Draft
morgan-wowk wants to merge 1 commit intootel-api-tracingfrom
metrics-http-requests
Draft

feat: Add HTTP request metrics instrumentation#75
morgan-wowk wants to merge 1 commit intootel-api-tracingfrom
metrics-http-requests

Conversation

@morgan-wowk
Copy link
Collaborator

@morgan-wowk morgan-wowk commented Feb 2, 2026

Introduces OpenTelemetry metrics for tracking HTTP request counts and durations

This PR adds OpenTelemetry metrics support to the API server with:

  • A new metrics.py module that configures OpenTelemetry metrics collection
  • HTTP metrics middleware that automatically tracks request metrics
  • Integration with the existing FastAPI application

Metrics added:

  • http_requests_total: Counter tracking request volume by method, endpoint, and status code
  • http_request_duration_seconds: Histogram tracking request latency by method and endpoint

The implementation respects environment configuration with OTEL_EXPORTER_OTLP_ENDPOINT for the collector endpoint and APP_ENV for service naming. Metrics are exported on a 60-second interval to minimize performance impact.

Copy link
Collaborator Author

morgan-wowk commented Feb 2, 2026

Introduces OpenTelemetry metrics for tracking HTTP request counts and durations.

Metrics added:
- http_requests_total: Counter tracking request volume by method, endpoint, and status code
- http_request_duration_seconds: Histogram tracking request latency by method and endpoint

This provides visibility into API usage patterns, error rates, and performance characteristics.
Performance overhead: <0.01% per request.
@morgan-wowk morgan-wowk force-pushed the metrics-http-requests branch from 71b35de to 4b0797e Compare February 3, 2026 06:55
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