Metrics API with Datadog
Datadog can ingest the Supabase Metrics API through its OpenMetrics integration or by proxying Prometheus data into Datadog’s time-series store. This guide covers both options so you can monitor database health alongside application metrics, logs, and traces in one place.
Datadog publishes a Supabase integration reference that uses the same Metrics API outlined here. That integration is managed by Datadog and is not officially supported by Supabase.
Prerequisites
- Supabase service role key (or another secret key) with Metrics API access.
- Datadog API/APP keys (for SaaS) and the Datadog Agent installed wherever you plan to run the scraper.
Option A: Datadog agent + OpenMetrics check
- Install the Datadog Agent on a host that can reach
https://<project-ref>.supabase.co. - Enable the OpenMetrics integration by creating
openmetrics.d/conf.yaml(Linux path:/etc/datadog-agent/conf.d/openmetrics.d/conf.yaml):
1234567891011121314init_config:instances: - openmetrics_endpoint: https://<project-ref>.supabase.co/customer/v1/privileged/metrics namespace: supabase metrics: - 'supabase_*' auth_type: basic username: service_role password: { { env "SUPABASE_SERVICE_ROLE_KEY" } } ssl_verify: true prometheus_timeout: 30 labels_mapper: project: project_ref- Restart the Datadog Agent (
sudo systemctl restart datadog-agent). - In Datadog, search for metrics with the
supabase.prefix. Create dashboards or notebooks to visualize CPU, IO, replication, and connection metrics.
Tuning tips
- Set
min_collection_interval: 60to match Supabase’s one-minute refresh cadence. - Use
labels_mapperto rename high-cardinality labels into shorter Datadog tag keys. - If you monitor multiple projects, duplicate the instance block with a unique
namespaceand tag each project (tags: ["supabase_project:<ref>"]).
Option B: Prometheus remote write into Datadog
If you already run Prometheus (self-hosted or managed), push scraped metrics into Datadog using the Prometheus Remote Write integration:
- Configure Prometheus with the Supabase scrape job (see the self-hosted guide).
- Add a
remote_writesection toprometheus.ymlthat targets Datadog’s endpoint:
123456remote_write: - url: https://api.datadoghq.com/api/v1/prometheus/write?api_key=<DD_API_KEY> write_relabel_configs: - source_labels: [job] target_label: datadog_namespace replacement: supabase- (Optional) Use Datadog’s Prometheus mapping profiles to convert metric/label names into Datadog-friendly conventions.
Dashboards and alerts
- Use the Datadog Dashboard Gallery to build widgets for CPU usage, tuple IO, replication lag, and connection saturation.
- Create monitors (for example,
avg(last_5m):supabase_pg_stat_database_xact_commit{project:<ref>} > 5e5) to detect runaway workloads. - Tag metrics with
env,service, orteamso you can slice Supabase telemetry the same way you slice application telemetry.
Troubleshooting
- 401 errors: rotate the service role key in Supabase and update the Datadog credentials.
- SSL errors: ensure the host trusts the standard certificate authorities used by
*.supabase.co. - High cardinality warnings: filter out labels such as
datnameorapplication_nameif you only need aggregate views.