Architecture
The observability stack consists of three main components:Components
Gateway Metrics
FastAPI application exposes Prometheus metrics at
/api/v1/metrics endpointPrometheus
Time-series database that scrapes and stores metrics every 15 seconds
Grafana
Visualization platform for creating dashboards and analyzing metrics
Metrics Endpoint
The gateway exposes Prometheus-formatted metrics at:- Cache hit/miss rates
- Provider performance and failures
- Request latency and throughput
- Rate limiting statistics
- Active request counts
Docker Compose Configuration
The observability stack is fully containerized and configured indocker-compose.yml:
Accessing the UIs
Prometheus UI
Prometheus UI
Access the Prometheus web interface at:Use the Prometheus UI to:
- Query metrics using PromQL
- Explore available metrics and labels
- Test alert expressions
- View scrape targets and their status
Grafana UI
Grafana UI
Access the Grafana web interface at:Default credentials:
- Username:
admin - Password:
admin
Anonymous access is enabled with Admin role for development convenience. Disable this in production by removing the
GF_AUTH_ANONYMOUS_ENABLED environment variable.Gateway Metrics Endpoint
Gateway Metrics Endpoint
View raw Prometheus metrics at:This returns metrics in Prometheus exposition format:
Prometheus Configuration
Prometheus is configured to scrape the gateway metrics endpoint every 15 seconds:prometheus.yml
The scrape interval of 15 seconds provides a good balance between metric granularity and resource usage. Adjust this value based on your monitoring requirements.
Data Retention
By default, Prometheus stores metrics with the following retention:- Time-based retention: 15 days
- Storage location:
/prometheus(inside container)
docker-compose.yml:
Next Steps
Explore Metrics
Learn about all available metrics, their types, and labels
Setup Grafana
Configure Grafana dashboards and visualizations