Telemetry

Metrics


In addition to the reports and charts built in to the Supabase dashboard, each project hosted on the Supabase platform comes with a Prometheus-compatible metrics endpoint, updated every minute, which can be used to gather insight into the health and status of your project.

You can use this endpoint to ingest data into your own monitoring and alerting infrastructure, as long as it is capable of scraping Prometheus-compatible endpoints, in order to set up custom rules beyond those supported by the Supabase dashboard.

Accessing the metrics endpoint

Your project's metrics endpoint is accessible at https://<project-ref>.supabase.co/customer/v1/privileged/metrics. Access to the endpoint is secured via HTTP Basic Auth; the username is service_role, while the password is the service role JWT available through the Supabase dashboard.


_10
> curl https://<project-ref>.supabase.co/customer/v1/privileged/metrics --user 'service_role:<service-role-jwt>'

Supabase Grafana

The pre-configured Supabase Grafana Dashboard is an advanced version of the Dashboard's Database Reports. It visualizes over 200 database performance and health metrics.

Supabase Grafana

Instructions are included in the README for deploying the repository using docker.

Using the metrics endpoint in production

To set up monitoring for your project, you will need two things:

  1. A datastore - a place to store the metrics coming from your Supabase project over time
  2. A dashboard - a place to visualize the state of your Supabase project for a defined period

Setting up a metrics datastore

One of the more well-known options is Prometheus and it is the tool used in this guide.

You can self-host Prometheus or choose a managed service to store your metrics. Some of the providers offering managed Prometheus are:

Follow the guides for the deployment option you choose

Adding a scrape job to Prometheus

For Prometheus, modify your prometheus.yaml file to add a Supabase job, and set the metrics_path, scheme, basic_auth and targets parameters. For example:


_13
scrape_configs:
_13
- job_name: "MySupabaseJob"
_13
metrics_path: "/customer/v1/privileged/metrics"
_13
scheme: https
_13
basic_auth:
_13
username: "service_role"
_13
password: "<your service_role JWT>"
_13
static_configs:
_13
- targets: [
_13
"<your Supabase Project ID>.supabase.co:443"
_13
]
_13
labels:
_13
group: "MyGroupLabel"

Setting up a dashboard

For this guide, we will be using Grafana.

You can self-host Grafana or many providers offer managed Grafana, some of which are listed below:

Follow the guides of the provider you choose to get Grafana up and running.

Adding a data source to Grafana

In the left-hand menu, select Data sources and click Add new data source.

Select Prometheus and enter the connection details for the Prometheus instance you have set up.

Under Interval behavior, set the scraping interval to 60s and test the data source. Once it has passed, save it.

Adding the Supabase dashboard

In the left-hand menu, select Dashboards and click New. From the drop-down, select Import.

Copy the raw file from our supabase-grafana repository and paste it (or upload the file).

Click Load and the dashboard will load from the project specified in your Prometheus job.

Monitoring your project

You can configure alerts from Prometheus or Grafana. The supabase-grafana repository has a selection of example alerts that can be configured.