Agentless Monitoring: Integrating Supabase Metrics with Grafana Cloud

The Power of Agentless Monitoring

Before we dive into the technicalities, let’s understand the core benefits of agentless monitoring. It’s like having a silent guardian for your application, one that doesn’t require the extra resources or management overhead that traditional agents do. This means less complexity, less maintenance overhead, and better accuracy in your monitoring.

TLDR; If you have a service exposing prometheus compatible endpoint, then you can scrape those metrics directly with services like Grafana Cloud without needing any intermediate agent.

Why Supabase and Grafana Cloud

Supabase is making waves as a top pick for developers needing a backend service, thanks to its solid PostgreSQL base and ease of use.

Grafana Cloud brings a lot to the table, with its easy-to-use features like drag-and-drop dashboards, smart alerts, and even some clever machine learning tricks to help you spot and fix problems before they blow up. In short, Grafana Cloud doesn’t just make monitoring simpler; it makes it smarter, helping developers keep their apps running smoothly and their users happy.

Pre-Requisites

Before we start, ensure you have an active Supabase project and a Grafana Cloud account. Once you’re set, the process is straightforward.

Metrics with Grafana Cloud

The Power of Agentless Monitoring

Before we dive into the technicalities, let’s understand the core benefits of agentless monitoring. It’s like having a silent guardian for your application, one that doesn’t require the extra resources or management overhead that traditional agents do. This means less complexity, less maintenance overhead, and better accuracy in your monitoring.

TLDR; If you have a service exposing Prometheus compatible endpoint, then you can scrape those metrics directly with services like Grafana Cloud without needing any intermediate agent.

Why Supabase and Grafana Cloud

Supabase is making waves as a top pick for developers needing a backend service, thanks to its solid PostgreSQL base and ease of use.

Grafana Cloud brings a lot to the table, with its easy-to-use features like drag-and-drop dashboards, smart alerts, and even some clever machine learning tricks to help you spot and fix problems before they blow up. In short, Grafana Cloud doesn’t just make monitoring simpler; it makes it smarter, helping developers keep their apps running smoothly and their users happy.

Pre-Requisites

Before we start, ensure you have an active Supabase project and a Grafana Cloud account. Once you’re set, the process is straightforward.

Accessing Supabase Metrics

Each project hosted on the Supabase platform comes with a Prometheus-compatible metrics endpoint, which can be used to gather insight into the health and status of your project.

Once you have created a project, navigate to the Settings > api to get the resources required to set up the monitoring. Now you’ll be able to see the project URL and with that, your project’s metrics endpoint will look like below.

https://.supabase.co/customer/v1/privileged/metrics

Access to the endpoint is secured via HTTP Basic Authentication; the username is service_role, while the password is the service role token as shown below.

For more details refer to Supabase docs.

Integrating Supabase Metrics with Grafana Cloud

Open your Grafana Cloud interface and follow the steps below:

Step 1: Click the left hamburger icon and go to Connections. Now click Add New Connection and click on the Metrics Endpoint integration as shown below.

Step 2: Enter the Scrape job name as supabase-metrics(or whatever you like). Now, enter the URL & credentials below and click Test Connection:

The credentials should look like this:

Scrape Job URL: https://gqwtyiinnrzayndiu.supabase.co//customer/v1/privileged/metrics
Basic Username: service_role
Basic Password: 

>NOTE: The password is the one which you get after clicking reveal button near the service_role label. If >you provide the value of JWT Secret as Basic Password, it will not work.

Once the connection is established, first click Save Scrape Job and then click Install. This will create a scrape job and start scraping the metrics from the specified Supabase project endpoint. If everything goes well, your interface should look like the below:

Creating The Dashboard

With the data source connected, you can now create dashboards.

Step 1: Go to Dashboards either by clicking the View Dashboards button or open the hamburger menu and click on Dashboards. Click on New button.

Step 2: You can now either create your own custom dashboard or you may import the existing dashboard either using the URL or copy-pasting the JSON. We’ll follow the latter approach here.

Step 3: Copy the dashboard from Supabase’s grafana-agent-fly-example repository on GitHub, paste in the text box below Import via dashboard JSON model and click Load.

Step 4: On the next page, click Import. You may keep other fields as default or change as per your requirement.

If everything goes well, you’ll see this beautiful dashboard which will help you observe several critical supabase metrics.

>NOTE: The above dashboard shall not be taken as a candidate for your production use. Check the JSON and identify the metrics carefully as per your production requirement. The dashboard used here is for reference purpose only.

We can further enhance the power of this monitoring system by including enterprise plugins like Grafana Enterprise Metrics(GEM) which is a commercial offering based on the open-source project Grafana Mimir. The commercial offering allows you to access a highly scalable, simple, and reliable Metrics cluster within Grafana Cloud offering advanced data querying and long-term data analysis capabilities.

Blog Pundits:  Sanjeev Pandey and Sandeep Rawat

OpsTree is an End-to-End DevOps Solution Provider

Connect with Us

Leave a Reply