Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

docs: revamp metrics guide (#40984)

Steven Eubank54332ad78a70
diff --git a/apps/docs/app/guides/database/database-advisors/page.tsx b/apps/docs/app/guides/database/database-advisors/page.tsx
index 987979377ed..bba7532c3de 100644
--- a/apps/docs/app/guides/database/database-advisors/page.tsx
+++ b/apps/docs/app/guides/database/database-advisors/page.tsx
@@ -2,6 +2,7 @@ import { Octokit } from '@octokit/core'
import { capitalize } from 'lodash-es'
import rehypeSlug from 'rehype-slug'
import { Heading } from 'ui'
+import { Admonition } from 'ui-patterns'
import { GuideTemplate, newEditLink } from '~/features/docs/GuidesMdx.template'
import { genGuideMeta } from '~/features/docs/GuidesMdx.utils'
@@ -43,7 +44,18 @@ In the dashboard, navigate to [Security Advisor](https://supabase.com/dashboard/
const getBasename = (path: string) => path.split('/').at(-1)!.replace(/\.md$/, '')
const DatabaseAdvisorDocs = async () => {
- const { lints, lintsList } = await getLints()
+ let lints: Awaited<ReturnType<typeof getLints>>['lints'] = []
+ let lintsList: Awaited<ReturnType<typeof getLints>>['lintsList'] = []
+ let fetchError: Error | null = null
+
+ try {
+ const data = await getLints()
+ lints = data.lints
+ lintsList = data.lintsList
+ } catch (error) {
+ fetchError = error instanceof Error ? error : new Error('Unknown error fetching advisor docs')
+ console.error('[database-advisors] Failed to fetch advisor docs from GitHub', fetchError)
+ }
const options = {
mdxOptions: {
@@ -56,19 +68,40 @@ const DatabaseAdvisorDocs = async () => {
<GuideTemplate meta={meta} editLink={editLink}>
<MDXRemoteBase source={markdownIntro} />
<Heading tag="h2">Available checks</Heading>
- <Tabs listClassNames="flex flex-wrap gap-2 [&>button]:!m-0" queryGroup="lint">
- {lints.map((lint) => (
- <TabPanel
- key={lint.path}
- id={lint.path}
- label={capitalize(getBasename(lint.path).replace(/_/g, ' '))}
+
+ {fetchError ? (
+ <Admonition type="note" title="Couldn’t load the full Advisor library">
+ We fetch remediation guides straight from the <code>supabase/splinter</code> repository
+ during the build. GitHub timed out just now, so we’re showing the overview only.
+ <br />
+ <br />
+ You can check back in a few minutes or browse the
+ {` `}
+ <a
+ className="underline decoration-dashed underline-offset-2"
+ href="https://github.com/supabase/splinter/tree/main/docs"
+ target="_blank"
+ rel="noreferrer"
>
- <section id={getBasename(lint.path)}>
- <MDXRemoteBase source={lint.content} options={options} />
- </section>
- </TabPanel>
- ))}
- </Tabs>
+ latest Markdown on GitHub (opens in a new tab)
+ </a>
+ .
+ </Admonition>
+ ) : (
+ <Tabs listClassNames="flex flex-wrap gap-2 [&>button]:!m-0" queryGroup="lint">
+ {lints.map((lint) => (
+ <TabPanel
+ key={lint.path}
+ id={lint.path}
+ label={capitalize(getBasename(lint.path).replace(/_/g, ' '))}
+ >
+ <section id={getBasename(lint.path)}>
+ <MDXRemoteBase source={lint.content} options={options} />
+ </section>
+ </TabPanel>
+ ))}
+ </Tabs>
+ )}
</GuideTemplate>
)
}
diff --git a/apps/docs/components/MetricsStackCards.tsx b/apps/docs/components/MetricsStackCards.tsx
new file mode 100644
index 00000000000..19ba4b02ede
--- /dev/null
+++ b/apps/docs/components/MetricsStackCards.tsx
@@ -0,0 +1,116 @@
+import Link from 'next/link'
+import { Datadog, Grafana } from 'icons'
+import { Flame } from 'lucide-react'
+import type { ReactNode } from 'react'
+
+interface MetricsStackOption {
+ title: string
+ description: ReactNode
+ href: string
+ icon: ReactNode
+ iconColor: string
+ iconBg: string
+ badges: { label: string; variant: 'default' | 'community' }[]
+}
+
+const metricsStackOptions: MetricsStackOption[] = [
+ {
+ title: 'Grafana Cloud (SaaS)',
+ description: (
+ <>
+ Use Grafana Cloud’s managed Prometheus (works on Free + Pro tiers) and import the Supabase
+ dashboard without running any infrastructure.
+ </>
+ ),
+ href: '/guides/telemetry/metrics/grafana-cloud',
+ icon: <Grafana className="h-5 w-5" />,
+ iconColor: '#F05A28',
+ iconBg: 'rgba(240,90,40,0.1)',
+ badges: [
+ { label: 'Supabase guide', variant: 'default' },
+ { label: 'Community', variant: 'community' },
+ ],
+ },
+ {
+ title: 'Grafana + self-hosted Prometheus',
+ description: (
+ <>
+ Run Prometheus yourself following the official installation guidance and pair it with
+ Grafana plus our dashboard JSON and alert pack.
+ </>
+ ),
+ href: '/guides/telemetry/metrics/grafana-self-hosted',
+ icon: <Grafana className="h-5 w-5" />,
+ iconColor: '#F05A28',
+ iconBg: 'rgba(240,90,40,0.1)',
+ badges: [{ label: 'Supabase guide', variant: 'default' }],
+ },
+ {
+ title: 'Datadog',
+ description: (
+ <>
+ Scrape the Metrics API with the Datadog Agent or Prometheus remote write and monitor
+ Supabase alongside your app telemetry.
+ </>
+ ),
+ href: '/guides/telemetry/metrics/datadog',
+ icon: <Datadog className="h-5 w-5" />,
+ iconColor: '#632CA6',
+ iconBg: 'rgba(99,44,166,0.1)',
+ badges: [
+ { label: 'Supabase guide', variant: 'default' },
+ { label: 'Community', variant: 'community' },
+ ],
+ },
+ {
+ title: 'Vendor-agnostic / BYO Prometheus',
+ description: (
+ <>
+ Connect AWS AMP, Grafana Mimir, VictoriaMetrics, or any Prometheus-compatible SaaS with the
+ same scrape job pattern.
+ </>
+ ),
+ href: '/guides/telemetry/metrics/vendor-agnostic',
+ icon: <Flame className="h-5 w-5" strokeWidth={1.5} />,
+ iconColor: '#0BA678',
+ iconBg: 'rgba(11,166,120,0.1)',
+ badges: [{ label: 'Supabase guide', variant: 'default' }],
+ },
+]
+
+export function MetricsStackCards() {
+ return (
+ <div className="grid gap-4 not-prose md:grid-cols-2">
+ {metricsStackOptions.map((option) => (
+ <Link key={option.href} href={option.href} className="col-span-1 block h-full">
+ <div className="relative flex h-full flex-col gap-4 rounded-2xl border border-foreground/10 bg-surface-75/50 p-5 text-left transition duration-200 hover:border-foreground/30 hover:bg-surface-100">
+ <div className="flex items-center gap-3">
+ <span
+ className="flex h-10 w-10 items-center justify-center rounded-full text-base font-semibold"
+ style={{ color: option.iconColor, backgroundColor: option.iconBg }}
+ >
+ {option.icon}
+ </span>
+ <p className="text-base font-medium text-foreground">{option.title}</p>
+ </div>
+ <div className="text-sm text-foreground-light">{option.description}</div>
+ <div className="mt-auto flex flex-wrap gap-2">
+ {option.badges.map((badge) => (
+ <span
+ key={`${option.href}-${badge.label}`}
+ className={`inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-medium ${
+ badge.variant === 'community'
+ ? 'border-warning/40 text-warning'
+ : 'border-brand-500/50 text-brand'
+ }`}
+ >
+ {badge.label}
+ </span>
+ ))}
+ </div>
+ </div>
+ </Link>
+ ))}
+ </div>
+ )
+}
diff --git a/apps/docs/components/Navigation/NavigationMenu/NavigationMenu.constants.ts b/apps/docs/components/Navigation/NavigationMenu/NavigationMenu.constants.ts
index 92037e9c9c1..ad77891587d 100644
--- a/apps/docs/components/Navigation/NavigationMenu/NavigationMenu.constants.ts
+++ b/apps/docs/components/Navigation/NavigationMenu/NavigationMenu.constants.ts
@@ -2754,6 +2754,28 @@ export const telemetry: NavMenuConstant = {
{
name: 'Metrics',
url: '/guides/telemetry/metrics' as `/${string}`,
+ items: [
+ {
+ name: 'Overview',
+ url: '/guides/telemetry/metrics' as `/${string}`,
+ },
+ {
+ name: 'Grafana Cloud',
+ url: '/guides/telemetry/metrics/grafana-cloud' as `/${string}`,
+ },
+ {
+ name: 'Grafana self-hosted',
+ url: '/guides/telemetry/metrics/grafana-self-hosted' as `/${string}`,
+ },
+ {
+ name: 'Datadog',
+ url: '/guides/telemetry/metrics/datadog' as `/${string}`,
+ },
+ {
+ name: 'Vendor-agnostic setup',
+ url: '/guides/telemetry/metrics/vendor-agnostic' as `/${string}`,
+ },
+ ],
},
{
name: 'Sentry integration',
diff --git a/apps/docs/content/_partials/metrics_access.mdx b/apps/docs/content/_partials/metrics_access.mdx
new file mode 100644
index 00000000000..5f89bdef570
--- /dev/null
+++ b/apps/docs/content/_partials/metrics_access.mdx
@@ -0,0 +1,50 @@
+<Accordion
+ type="default"
+ openBehaviour="multiple"
+ chevronAlign="right"
+ justified
+ size="medium"
+ className="text-foreground-light mt-8 mb-6 [&>div]:space-y-4"
+>
+
+<AccordionItem
+header={<span className="text-foreground">What you can do with the Metrics API</span>}
+id="how-do-i-check-when-a-user-went-through-mfa"
+>
+
+Every Supabase project exposes a metrics feed at `https://<project-ref>.supabase.co/customer/v1/privileged/metrics`. Replace `<project-ref>` with the identifier from your project URL or from the dashboard sidebar.
+
+1. Copy your project reference and confirm the base URL using the helper below.
+
+ <ProjectConfigVariables variable="url" />
+
+2. Configure your collector to scrape once per minute. The endpoint already emits the full set of metrics on each request.
+3. Authenticate with HTTP Basic Auth:
+
+ - **Username**: `service_role`
+ - **Password**: a service role secret (JWT) from [**Project Settings > JWT** (opens in a new tab)](/dashboard/project/_/settings/jwt) or any other Secret API key from [**Project Settings > API keys** (opens in a new tab)](/dashboard/project/_/settings/api-keys)
+
+Testing locally is as simple as running `curl` with your service role secret:
+
+```bash
+curl <project-url>/customer/v1/privileged/metrics \
+ --user 'service_role:sb_secret_...'
+```
+
+You can provision long-lived automation tokens in two ways:
+
+- Create an account access token once at [**Account Settings > Access Tokens (opens in a new tab)**](/dashboard/account/tokens) and reuse it wherever you configure observability tooling.
+- **Optional**: programmatically exchange an access token for project API keys via the [Management API ](/docs/reference/api/management-projects-api-keys-retrieve').
+
+```bash
+# (Optional) Exchange an account access token for project API keys
+export SUPABASE_ACCESS_TOKEN="your-access-token"
+export PROJECT_REF="your-project-ref"
+
+curl -H "Authorization: Bearer $SUPABASE_ACCESS_TOKEN" \
+ "https://api.supabase.com/v1/projects/$PROJECT_REF/api-keys?reveal=true"
+```
+
+</AccordionItem>
+
+</Accordion>
diff --git a/apps/docs/content/guides/telemetry/metrics.mdx b/apps/docs/content/guides/telemetry/metrics.mdx
index 56644bbc252..5b37052a601 100644
--- a/apps/docs/content/guides/telemetry/metrics.mdx
+++ b/apps/docs/content/guides/telemetry/metrics.mdx
@@ -1,164 +1,42 @@
---
id: 'metrics'
-title: 'Metrics'
-description: 'Observability for your Supabase project'
+title: 'Metrics API'
+description: 'Export Supabase database metrics to any Prometheus-compatible tool'
---
-In addition to the reports and charts built in to the Supabase dashboard, each project hosted on the Supabase platform comes with a [Prometheus](https://prometheus.io/)-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.
-
-<Admonition type="note">
-
-The endpoint discussed in this article is in beta, and the metrics returned by it might evolve or be changed in the future to increase its utility.
-
-</Admonition>
+Every Supabase project exposes a [Prometheus](https://prometheus.io/)-compatible **Metrics API** endpoint that surfaces ~200 Postgres performance and health series. You can scrape it into any observability stack to power custom dashboards, alerting rules, or long-term retention that goes beyond what Supabase Studio provides out of the box.
<Admonition type="note">
-The endpoint discussed in this article is not available on self-hosted.
+The Metrics API is currently in beta. Metric names and labels might evolve as we expand the dataset, and the feature is not available in self-hosted Supabase instances.
</Admonition>
-## 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:
-
-- username: `service_role`
-- password: the `service_role` API key or any other secret API key, get these from [Supabase dashboard](/dashboard/project/_/settings/api-keys)
-
-You can also retrieve your service role key programmatically using the Management API:
-
-```bash
-# Get your access token from https://supabase.com/dashboard/account/tokens
-export SUPABASE_ACCESS_TOKEN="your-access-token"
-export PROJECT_REF="your-project-ref"
-
-# Get project API keys including service_role key
-curl -H "Authorization: Bearer $SUPABASE_ACCESS_TOKEN" \
- "https://api.supabase.com/v1/projects/$PROJECT_REF/api-keys?reveal=true"
-```
-
-<ProjectConfigVariables variable="url" />
-
-```shell
-curl <project-url>/customer/v1/privileged/metrics \
- --user 'service_role:sb_secret_...'
-```
-
-```shell
-curl <project-url>/customer/v1/privileged/metrics \
- --user 'service_role:<service-role-jwt>'
-```
-
-## Supabase Grafana
-
-The pre-configured [Supabase Grafana Dashboard](https://github.com/supabase/supabase-grafana/) is an advanced version of the [Dashboard's Database Reports](/dashboard/project/_/observability/database). It visualizes over 200 database performance and health metrics.
-
-![Supabase Grafana](/docs/img/guides/platform/supabase-grafana-prometheus.png)
-
-Instructions are included in the [README](https://github.com/supabase/supabase-grafana/blob/main/README.md) 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](https://prometheus.io/docs/introduction/overview/) and it is the tool used in this guide.
+## What you can do with the Metrics API
-You can [self-host](https://prometheus.io/docs/prometheus/latest/installation/) Prometheus or choose a managed service to store your metrics. Some of the providers offering managed Prometheus are:
+- Stream database CPU, IO, WAL, connection, and query stats into Prometheus-compatible systems.
+- Combine Supabase metrics with application signals in Grafana, Datadog, or any other observability vendor.
+- Reuse our [supabase-grafana dashboard JSON](https://github.com/supabase/supabase-grafana) to bootstrap over 200 ready-made charts.
+- Build your own alerting policies (right-sizing, saturation detection, index regression, and more).
-- [Digital Ocean](https://marketplace.digitalocean.com/apps/prometheus)
-- [AWS](https://aws.amazon.com/prometheus/)
-- [Grafana Cloud](https://grafana.com/products/cloud/metrics/)
+<$Partial path="metrics_access.mdx" />
-Follow the guides for the deployment option you choose
+## Choose your monitoring stack
-#### Adding a scrape job to Prometheus
+Pick the workflow that best matches your tooling. Each card opens a Supabase-authored guide, and some also include a “Community” pill when there’s an accompanying vendor integration reference.
-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:
+<MetricsStackCards />
-```yaml
-scrape_configs:
- - job_name: "MySupabaseJob"
- metrics_path: "/customer/v1/privileged/metrics"
- scheme: https
- basic_auth:
- username: "service_role"
- password: "<your service_role JWT>"
- static_configs:
- - targets: [
- "<your Supabase Project ID>.supabase.co:443"
- ]
- labels:
- group: "MyGroupLabel"
-```
+<img
+ src="/docs/img/guides/platform/supabase-grafana-prometheus.png"
+ alt="Supabase Grafana dashboard showcasing database metrics"
+ className="mt-8 rounded-lg border border-foreground/10 shadow-sm"
+/>
-**For Grafana Cloud users** instead of manually configuring `prometheus.yaml`, use a "Metrics Endpoint" instead:
+## Additional resources
-- In the left-hand menu, select **Connections** and click **Add new connection**.
-- Search for **Metrics Endpoint** and select it.
-- Click **Add new scrape job**.
-- Enter the details specified in [Accessing the metrics endpoint](/docs/guides/telemetry/metrics#accessing-the-metrics-endpoint).
-- Set the **scraping interval** to "60s".
-- Test the connection. Once it has passed, click **Save Scrape Job**.
-
-### Setting up a dashboard
-
-For this guide, we will be using [Grafana](https://grafana.com/docs/grafana/latest/introduction/).
-
-You can [self-host](https://grafana.com/docs/grafana/latest/setup-grafana/installation/) Grafana or many providers offer managed Grafana, some of which are listed below:
-
-- [DigitalOcean](https://marketplace.digitalocean.com/apps/grafana)
-- [AWS](https://aws.amazon.com/grafana/)
-- [Grafana Cloud](https://grafana.com/products/cloud/metrics/)
-
-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.
-
-**Grafana Cloud users** refer to [Grafana Cloud Prometheus connection details](/docs/guides/telemetry/metrics#grafana-cloud-prometheus).
-
-Name the datasource "prometheus" (if you use a different name, you need to modify the `dashboard.json` file when adding the dashboard).
-
-Under **Interval behavior**, set the **scraping interval** to 60s and test the data source. Once it has passed, save it.
-
-#### Grafana cloud Prometheus connection details [#grafana-cloud-prometheus]
-
-- Log into your [Grafana Cloud Portal](https://grafana.com/auth/sign-in/).
-- Under **Grafana Cloud stack** click **Details**.
-- Search for **Prometheus** and click **Details**.
-- The **Grafana Data Source settings** section contains the necessary connection details
- - "URL" (the format "https://UNIQUE_IDENTIFIER.grafana.net/api/prom")
- - "User" / "Password"
-
-### 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](https://raw.githubusercontent.com/supabase/supabase-grafana/refs/heads/main/grafana/dashboard.json) repository.
-
-- If your Prometheus data source is named "prometheus", paste the contents of the file (or upload the file).
-- If your Prometheus data source is **not named "prometheus"**, find all occurrences of `"uid": "prometheus"` and replace `prometheus` with your custom data source name.
-
-Click "Load" and the dashboard loads 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](https://github.com/supabase/supabase-grafana/blob/main/docs/example-alerts.md) that can be configured.
-
-<Admonition type="caution">
-
-Grafana Cloud has an unofficial integration for scraping Supabase metrics. See their [docs](https://grafana.com/docs/grafana-cloud/monitor-infrastructure/integrations/integration-reference/integration-supabase/) for instructions on how to configure it but note that it is not full-featured nor is it supported by Supabase.
-
-</Admonition>
+- [Supabase Grafana repository](https://github.com/supabase/supabase-grafana) for dashboard JSON and alert examples.
+- [Grafana Cloud’s Supabase integration doc](https://grafana.com/docs/grafana-cloud/monitor-infrastructure/integrations/integration-reference/integration-supabase/) (community-maintained, built on this Metrics API).
+- [Datadog’s Supabase integration doc](https://docs.datadoghq.com/integrations/supabase/) (community-maintained, built on this Metrics API).
+- [Log Drains ](/docs/guides/telemetry/log-drains) for exporting event-based telemetry alongside metrics.
+- [Query Performance report](/dashboard/project/_/observability/query-performance) for built-in visualizations based on the same underlying metrics.
diff --git a/apps/docs/content/guides/telemetry/metrics/datadog.mdx b/apps/docs/content/guides/telemetry/metrics/datadog.mdx
new file mode 100644
index 00000000000..8bcf3628ea1
--- /dev/null
+++ b/apps/docs/content/guides/telemetry/metrics/datadog.mdx
@@ -0,0 +1,83 @@
+---
+id: 'metrics-datadog'
+title: 'Metrics API with Datadog'
+description: 'Scrape Supabase metrics with the Datadog Agent or Prometheus integrations'
+---
+
+Datadog can ingest the Supabase Metrics API through its [OpenMetrics integration](https://docs.datadoghq.com/integrations/openmetrics/) 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.
+
+<Admonition type="note">
+
+Datadog publishes a [Supabase integration reference](https://docs.datadoghq.com/integrations/supabase/) that uses the same Metrics API outlined here. That integration is managed by Datadog and is not officially supported by Supabase.
+
+</Admonition>
+
+## 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.
+
+<$Partial path="metrics_access.mdx" />
+
+## Option A: Datadog agent + OpenMetrics check
+
+1. Install the Datadog Agent on a host that can reach `https://<project-ref>.supabase.co`.
+2. Enable the OpenMetrics integration by creating `openmetrics.d/conf.yaml` (Linux path: `/etc/datadog-agent/conf.d/openmetrics.d/conf.yaml`):
+
+```yaml
+init_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
+```
+
+3. Restart the Datadog Agent (`sudo systemctl restart datadog-agent`).
+4. 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: 60` to match Supabase’s one-minute refresh cadence.
+- Use `labels_mapper` to rename high-cardinality labels into shorter Datadog tag keys.
+- If you monitor multiple projects, duplicate the instance block with a unique `namespace` and tag each project (`tags: ["supabase_project:<ref>"]`).
+
+## Option B: Prometheus remote write into Datadog
+
+If you already run [Prometheus](https://prometheus.io/docs/prometheus/latest/installation/) (self-hosted or managed), push scraped metrics into Datadog using the [Prometheus Remote Write integration](https://docs.datadoghq.com/integrations/guide/prometheus_remote_write/):
+
+1. Configure Prometheus with the Supabase scrape job (see the [self-hosted guide](/guides/telemetry/metrics/grafana-self-hosted#1-deploy-prometheus)).
+2. Add a `remote_write` section to `prometheus.yml` that targets Datadog’s endpoint:
+
+```yaml
+remote_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
+```
+
+3. (Optional) Use [Datadog’s Prometheus mapping profiles](https://docs.datadoghq.com/integrations/guide/prometheus-metrics-map/) 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`, or `team` so 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 `datname` or `application_name` if you only need aggregate views.
+
+[← Back to the Metrics API landing](/guides/telemetry/metrics)
diff --git a/apps/docs/content/guides/telemetry/metrics/grafana-cloud.mdx b/apps/docs/content/guides/telemetry/metrics/grafana-cloud.mdx
new file mode 100644
index 00000000000..275fedf70a6
--- /dev/null
+++ b/apps/docs/content/guides/telemetry/metrics/grafana-cloud.mdx
@@ -0,0 +1,63 @@
+---
+id: 'metrics-grafana-cloud'
+title: 'Metrics API with Grafana Cloud'
+description: 'Use Grafana Cloud’s managed Prometheus to visualize Supabase metrics'
+---
+
+Grafana Cloud gives you a fully managed Prometheus endpoint plus hosted Grafana dashboards, which makes it the fastest way to explore the Supabase Metrics API without operating your own infrastructure.
+
+<Admonition type="note">
+
+Grafana maintains a [Supabase integration guide](https://grafana.com/docs/grafana-cloud/monitor-infrastructure/integrations/integration-reference/integration-supabase/) for Grafana Cloud. It runs on the same Metrics API documented here, but is community-maintained by Grafana, so feature coverage might differ from what Supabase officially supports.
+
+</Admonition>
+
+## Prerequisites
+
+- A Supabase project with access to the Metrics API (service role key or another secret key).
+- A Grafana Cloud account with Prometheus metrics enabled (Free or Pro tier).
+- A Grafana API token with the `metrics:write` and `metrics:read` scopes if you plan to push data manually.
+
+<$Partial path="metrics_access.mdx" />
+
+## 1. Create a Grafana Cloud stack
+
+1. Sign in to [Grafana Cloud](https://grafana.com/auth/sign-in).
+2. Create (or select) a stack that has **Prometheus Metrics** enabled (Free and Pro tiers both work for this guide).
+
+## 2. Configure the Supabase integration
+
+1. Navigate to **Connections → Add new connection → Supabase** inside Grafana Cloud.
+2. Provide:
+ - Your Supabase project ref (e.g. `abcd1234`).
+ - The Metrics API endpoint: `https://<project-ref>.supabase.co/customer/v1/privileged/metrics`.
+ - HTTP Basic Auth credentials (`service_role` / `service_role key`).
+3. Choose the scrape interval (1 minute recommended) and test the connection. Grafana Cloud will deploy an agent in the background that scrapes the Metrics API and forwards the data to Prometheus.
+
+If you prefer to reuse an existing Grafana Agent deployment, configure an [integration pipeline](https://grafana.com/docs/grafana-cloud/send-data/agent/integrations/integration-reference/integration-supabase/) with the same URL and credentials.
+
+## 3. Import the Supabase dashboard
+
+1. Open your Grafana Cloud dashboard list and click **New → Import**.
+2. Paste the raw contents of [`supabase-grafana/dashboard.json`](https://raw.githubusercontent.com/supabase/supabase-grafana/refs/heads/main/grafana/dashboard.json).
+3. When prompted for the datasource, choose the Prometheus instance that receives the Supabase metrics.
+
+This dashboard includes 200+ charts grouped by CPU, IO, connections, replication, WAL, and bloat indicators.
+
+<img
+ src="/docs/img/guides/platform/supabase-grafana-prometheus.png"
+ alt="Supabase Grafana dashboard showcasing database metrics"
+ className="mt-6 rounded-lg border border-foreground/10 shadow-sm"
+/>
+
+## 4. Configure alerts (optional)
+
+The [`docs/example-alerts.md`](https://github.com/supabase/supabase-grafana/blob/main/docs/example-alerts.md) file contains suggested alert rules (disk saturation, long-running queries, replication lag, etc.). Import the alert rules into Grafana Cloud’s Alerting UI or translate them into Grafana Cloud’s managed alert rule format.
+
+## 5. Troubleshooting
+
+- Metrics missing? Ensure the Grafana Cloud agent can reach `https://<project-ref>.supabase.co` and that the selected service role key is still valid.
+- 401 errors? Rotate the service role key from the [API settings page](/dashboard/project/_/settings/api-keys) and update the Grafana Cloud credentials.
+- Long scrape durations? Reduce label cardinality in your Grafana queries or lower the time range to focus on recent data.
+
+[← Back to the Metrics API landing](/guides/telemetry/metrics)
diff --git a/apps/docs/content/guides/telemetry/metrics/grafana-self-hosted.mdx b/apps/docs/content/guides/telemetry/metrics/grafana-self-hosted.mdx
new file mode 100644
index 00000000000..ba6c02670ef
--- /dev/null
+++ b/apps/docs/content/guides/telemetry/metrics/grafana-self-hosted.mdx
@@ -0,0 +1,84 @@
+---
+id: 'metrics-grafana-self-hosted'
+title: 'Metrics API with Prometheus & Grafana (self-hosted)'
+description: 'Deploy Prometheus and Grafana yourself to monitor Supabase metrics'
+---
+
+Self-hosting [Prometheus](https://prometheus.io/docs/prometheus/latest/installation/) and Grafana gives you full control over retention, alert routing, and dashboards. The Supabase Metrics API slots into any standard Prometheus scrape job, so you can run everything locally, on a VM, or inside Kubernetes.
+
+<$Partial path="metrics_access.mdx" />
+
+<Admonition type="note">
+
+Grafana also documents a [Supabase integration reference](https://grafana.com/docs/grafana-cloud/monitor-infrastructure/integrations/integration-reference/integration-supabase/). While it targets Grafana Cloud, the scrape and agent settings apply equally to self-hosted clusters and offer a community-maintained companion to this guide.
+
+</Admonition>
+
+## Architecture
+
+1. **Prometheus** scrapes `https://<project-ref>.supabase.co/customer/v1/privileged/metrics` every minute using HTTP Basic Auth.
+2. **Grafana** reads from Prometheus and renders dashboards/alerts.
+3. (Optional) **Alertmanager** or your preferred system sends notifications when Prometheus rules fire.
+
+## 1. Deploy Prometheus
+
+Install [Prometheus](https://prometheus.io/docs/prometheus/latest/installation/) using your preferred method (Docker, Helm, binaries). Then add a Supabase-specific job to `prometheus.yml`:
+
+```yaml
+scrape_configs:
+ - job_name: 'supabase'
+ scrape_interval: 60s
+ metrics_path: /customer/v1/privileged/metrics
+ scheme: https
+ basic_auth:
+ username: service_role
+ password: '<service-role key or JWT>'
+ static_configs:
+ - targets:
+ - '<project-ref>.supabase.co:443'
+ labels:
+ project: '<project-ref>'
+```
+
+<Admonition type="tip">
+
+- Keep the scrape interval at 60 seconds to match Supabase’s refresh cadence.
+- If you run Prometheus behind a proxy, make sure it can establish outbound HTTPS connections to `*.supabase.co`.
+- Store secrets (service role key) with your secret manager or inject them via environment variables.
+
+</Admonition>
+
+## 2. Deploy Grafana
+
+Install Grafana (Docker image, Helm chart, or packages) and connect it to Prometheus:
+
+1. In Grafana, go to **Connections → Data sources → Add data source**.
+2. Choose **Prometheus**, set the URL to your Prometheus endpoint (for example `http://prometheus:9090`), and click **Save & test**.
+
+## 3. Import Supabase dashboards
+
+1. Go to **Dashboards → New → Import**.
+2. Paste the contents of [`supabase-grafana/dashboard.json`](https://raw.githubusercontent.com/supabase/supabase-grafana/refs/heads/main/grafana/dashboard.json).
+3. Select your Prometheus datasource when prompted.
+
+You now have over 200 production-ready panels covering CPU, IO, WAL, replication, index bloat, and query throughput.
+
+<img
+ src="/docs/img/guides/platform/supabase-grafana-prometheus.png"
+ alt="Supabase Grafana dashboard showcasing database metrics"
+ className="mt-6 rounded-lg border border-foreground/10 shadow-sm"
+/>
+
+## 4. Configure alerting
+
+- Import the sample rules from [`docs/example-alerts.md`](https://github.com/supabase/supabase-grafana/blob/main/docs/example-alerts.md) into Prometheus or Grafana Alerting.
+- Tailor thresholds (for example, disk utilization, long-running transactions, connection saturation) to your project’s size.
+- Route notifications via Alertmanager, Grafana OnCall, PagerDuty, or any other supported destination.
+
+## 5. Operating tips
+
+- **Multiple projects:** add one scrape job per project ref so you can separate metrics and labels cleanly.
+- **Right-sizing guidance:** pair the dashboards with Supabase’s [Query Performance report](/dashboard/project/_/observability/query-performance) and [Advisors](/dashboard/project/_/observability/database) to decide when to optimize vs upgrade.
+- **Security:** rotate the service role key on a regular cadence and update the Prometheus config accordingly.
+
+[← Back to the Metrics API landing](/guides/telemetry/metrics)
diff --git a/apps/docs/content/guides/telemetry/metrics/vendor-agnostic.mdx b/apps/docs/content/guides/telemetry/metrics/vendor-agnostic.mdx
new file mode 100644
index 00000000000..0b766eb3ea3
--- /dev/null
+++ b/apps/docs/content/guides/telemetry/metrics/vendor-agnostic.mdx
@@ -0,0 +1,72 @@
+---
+id: 'metrics-vendor-agnostic'
+title: 'Vendor-agnostic Metrics API setup'
+description: 'Connect Supabase metrics to any Prometheus-compatible platform'
+---
+
+The Supabase Metrics API is intentionally vendor-agnostic. Any collector that can scrape a Prometheus text endpoint over HTTPS can ingest the data. This guide explains the moving pieces so you can adapt them to AWS Managed Prometheus, Grafana Mimir, VictoriaMetrics, Thanos, or any other system.
+
+<$Partial path="metrics_access.mdx" />
+
+## Components
+
+- **Collector** – Prometheus, Grafana Agent, VictoriaMetrics agent, Mimir scraper, etc.
+- **Long-term store (optional)** – Managed Prometheus, Thanos, Mimir, VictoriaMetrics.
+- **Visualization/alerting** – Grafana, Datadog, New Relic, custom code.
+
+## 1. Define the scrape job
+
+No matter which collector you use, you need to hit the Metrics API once per minute with HTTP Basic Auth:
+
+```yaml
+- job_name: supabase
+ scrape_interval: 60s
+ metrics_path: /customer/v1/privileged/metrics
+ scheme: https
+ basic_auth:
+ username: service_role
+ password: '<service-role key or JWT>'
+ static_configs:
+ - targets:
+ - '<project-ref>.supabase.co:443'
+ labels:
+ project: '<project-ref>'
+```
+
+### Collector-specific notes
+
+- **Grafana Agent / Alloy:** use the [`prometheus.scrape` component](https://grafana.com/docs/grafana-cloud/monitor-infrastructure/integrations/integration-reference/integration-supabase/#manual-configuration) with the same parameters.
+- **AWS Managed Prometheus (AMP):** deploy the Grafana Agent or AWS Distro for OpenTelemetry (ADOT) in your VPC, then remote-write the scraped metrics into AMP.
+- **VictoriaMetrics / Mimir:** reuse the same scrape block; configure remote-write or retention rules as needed.
+
+## 2. Secure the credentials
+
+- Store the service role key in your secret manager (AWS Secrets Manager, GCP Secret Manager, Vault, etc.).
+- Rotate the key periodically via [Project Settings → API keys](/dashboard/project/_/settings/api-keys) and update your collector.
+- If you need to give observability vendors access without exposing the service role key broadly, create a dedicated service key for metrics-only automation.
+
+## 3. Downstream dashboards
+
+- Import the [Supabase Grafana dashboard](https://github.com/supabase/supabase-grafana) regardless of where Grafana is hosted.
+- For other tools, group metrics by categories (CPU, IO, WAL, replication, connections) and recreate the visualizations that matter most to your team.
+- Tag or relabel series with `project`, `env`, or `team` labels to make multi-project views easier.
+
+<img
+ src="/docs/img/guides/platform/supabase-grafana-prometheus.png"
+ alt="Supabase Grafana dashboard showcasing database metrics"
+ className="mt-6 rounded-lg border border-foreground/10 shadow-sm"
+/>
+
+## 4. Alerts and automation
+
+- Start with the [example alert rules](https://github.com/supabase/supabase-grafana/blob/main/docs/example-alerts.md) and adapt thresholds for your workload sizes.
+- Pipe alerts into PagerDuty, Slack, Opsgenie, or any other compatible target.
+- Combine Metrics API data with log drains, Query Performance, and Advisors to build right-sizing playbooks.
+
+## 5. Multi-project setups
+
+- Create one scrape job per project ref so you can control sampling individually.
+- If you run many projects, consider templating the scrape jobs via Helm, Terraform, or the Grafana Agent Operator.
+- Use label joins (`project`, `instance_class`, `org`) to aggregate across tenants or environments.
+
+[← Back to the Metrics API landing](/guides/telemetry/metrics)
diff --git a/apps/docs/features/docs/MdxBase.shared.tsx b/apps/docs/features/docs/MdxBase.shared.tsx
index e332d72fd8a..5826c493b38 100644
--- a/apps/docs/features/docs/MdxBase.shared.tsx
+++ b/apps/docs/features/docs/MdxBase.shared.tsx
@@ -14,6 +14,7 @@ import { CostWarning } from '~/components/AuthSmsProviderConfig/AuthSmsProviderC
import ButtonCard from '~/components/ButtonCard'
import { Extensions } from '~/components/Extensions'
import { JwtGenerator } from '~/components/JwtGenerator'
+import { MetricsStackCards } from '~/components/MetricsStackCards'
import { NavData } from '~/components/NavData'
import { Price } from '~/components/Price'
import { ProjectConfigVariables } from '~/components/ProjectConfigVariables'
@@ -55,6 +56,7 @@ const components = {
JwtGenerator,
Link,
McpConfigPanel,
+ MetricsStackCards,
NamedCodeBlock,
NavData,
ProjectConfigVariables,
diff --git a/supa-mdx-lint/Rule001HeadingCase.toml b/supa-mdx-lint/Rule001HeadingCase.toml
index e046d71d57f..3d226c92e55 100644
--- a/supa-mdx-lint/Rule001HeadingCase.toml
+++ b/supa-mdx-lint/Rule001HeadingCase.toml
@@ -46,7 +46,7 @@ may_uppercase = [
"Cron",
"Cron Jobs?",
"Data API",
- "DataDog",
+ "Datadog",
"Dart",
"Dashboard",
"Database Functions?",
@@ -91,6 +91,7 @@ may_uppercase = [
"Google",
"Google Workspace",
"Grafana",
+ "Grafana Cloud",
"GraphQL",
"Heroku",
"Homebrew",
@@ -133,6 +134,7 @@ may_uppercase = [
"Mailpit",
"Management API",
"Marketplace",
+ "Metrics API",
"Mixpeek",
"Mixpeek Embed",
"Model Context Protocol",
@@ -149,6 +151,7 @@ may_uppercase = [
"OpenAI",
"OpenID Connect",
"Open ID Connect",
+ "OpenMetrics",
"OrbStack",
"OrioleDB",
"PGAudit",
diff --git a/supa-mdx-lint/Rule003Spelling.toml b/supa-mdx-lint/Rule003Spelling.toml
index c8d32266ab1..3abdb024156 100644
--- a/supa-mdx-lint/Rule003Spelling.toml
+++ b/supa-mdx-lint/Rule003Spelling.toml
@@ -77,6 +77,7 @@ allow_list = [
"[Ii]dempotency",
"[KMG]bps",
"[KMG]iB",
+ "[Kk]ubernetes",
"[Ll]iveness",
"LogEvent",
"[Mm]atryoshka",
@@ -129,6 +130,7 @@ allow_list = [
"[Tt]imebox(ed)?",
"[Tt]odos?",
"[Tt]radeoffs?",
+ "[Tt]unneled",
"UncaughtException",
"[Uu]nlink(ing|s|ed)?",
"[Uu]pserts?",
@@ -138,6 +140,8 @@ allow_list = [
"[Ww]ebhooks?",
"WorkerMemoryUsed",
"Airbyte",
+ "Alertmanager",
+ "AWS Distro for OpenTelemetry",
"AndroidX",
"AppleAuthentication",
"Astro",
@@ -164,7 +168,7 @@ allow_list = [
"Colab",
"DBeaver",
"Database Functions?",
- "DataDog",
+ "Datadog",
"Deadpool",
"DDoS",
"Deno",
@@ -196,6 +200,7 @@ allow_list = [
"GoTrue",
"Golang",
"Grafana",
+ "Grafana OnCall",
"GraphQL",
"Groonga",
"HackerOne",
@@ -253,9 +258,12 @@ allow_list = [
"OneLogin",
"OpenAI",
"OpenID",
+ "OpenMetrics",
+ "Opsgenie",
"OrbStack",
"OrioleDB",
"OpenTelemetry",
+ "PagerDuty",
"PGAudit",
"PGroonga",
"PgBouncer",
@@ -284,6 +292,7 @@ allow_list = [
"RedwoodJS",
"Refine",
"Roboflow",
+ "SaaS",
"SDKs",
"SQLAlchemy",
"SQLModel",
@@ -302,11 +311,11 @@ allow_list = [
"Supabase",
"Remapper",
"TextLocal",
+ "Thanos",
"TimescaleDB",
"tmux",
"Transformers.js",
"tsquery",
- "[Tt]unneled",
"Twilio",
"Undici",
"UnionPay",
@@ -318,6 +327,7 @@ allow_list = [
"VSCode",
"Vecs",
"Vercel",
+ "VictoriaMetrics",
"Vite",
"Vonage",
"Vue",