diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 5784ed08f27..e7e49919906 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -507,6 +507,7 @@ /packages/sql_input @elastic/obs-infraobs-integrations /packages/sql_server_input_otel @elastic/ecosystem /packages/squid @elastic/integration-experience +/packages/supabase @elastic/obs-infraobs-integrations /packages/stan @elastic/obs-infraobs-integrations /packages/statsd_input @elastic/obs-infraobs-integrations /packages/statsd_input_otel @elastic/ecosystem diff --git a/packages/supabase/_dev/build/docs/README.md b/packages/supabase/_dev/build/docs/README.md new file mode 100644 index 00000000000..39c08306ed4 --- /dev/null +++ b/packages/supabase/_dev/build/docs/README.md @@ -0,0 +1,77 @@ +# Supabase OpenTelemetry Integration + +Collect metrics from [Supabase](https://supabase.com) using the OpenTelemetry Prometheus receiver. + +## Overview + +This integration scrapes metrics from the Supabase Metrics API (Prometheus-compatible) using the OTel Collector's Prometheus receiver. All metrics are collected into a single data stream + +- **Metrics** (`supabase.metrics.otel`) — Infrastructure (CPU, memory, load, disk I/O, filesystem, network), PostgreSQL (size, connections, transactions, cache, WAL, replication, bgwriter, statements), Supavisor, PostgREST, Auth, Realtime, and Storage + +Metrics are stored with native OTel schema — no field renaming or custom mapping is applied. Raw Prometheus metric names are preserved under the `metrics.*` namespace. + +## Compatibility + +This integration requires a Supabase **Pro**, **Team**, or **Enterprise** plan. The Metrics API is not available on the Free tier. + +## Prerequisites + +| Requirement | Details | +|---|---| +| **Supabase plan** | Pro, Team, or Enterprise | +| **Elastic Stack** | 9.4.0+ | +| **Input package** | `prometheus_input_otel` (installed automatically as a dependency) | +| **Content package** | `supabase_otel` (installed automatically as a dependency) | + +## Setup + +1. **Get your Supabase credentials**: + - Go to your Supabase dashboard → **Settings** → **API** + - Copy the **Project URL** (e.g., `abcdefghijkl.supabase.co`) + - Copy the **service_role** key (under "Project API keys") + +2. **Add the integration in Kibana**: + - Go to **Management** → **Integrations** → search for "Supabase" + - Click **Add Supabase** + - Fill in: + - **Targets**: `.supabase.co:443` + - **Username**: `service_role` + - **Service Role Key**: paste your service_role JWT + +3. **Verify data**: + - Go to **Discover** and filter on `data_stream.dataset: "supabase.metrics.otel"` + +## Dashboards + +Kibana dashboards are provided by the **Supabase ** OpenTelemetry Assets package, which is installed automatically. The following dashboards are included: + +- **Node & Infrastructure** — CPU, memory, load, disk I/O, filesystem, network +- **Database & Postgres Health** — connections, transactions, cache hit ratio, WAL, replication, bgwriter +- **Services & API Health** — Supavisor, PostgREST, GoTrue Auth, Realtime, Storage + +## Metrics Reference + +Metrics are scraped from the Supabase Metrics API endpoint: + +``` +GET https://.supabase.co/customer/v1/privileged/metrics +``` + +Authentication uses HTTP Basic Auth with `service_role` as the username and the service_role JWT as the password. + +See the [Supabase Metrics documentation](https://supabase.com/docs/guides/telemetry/metrics) for full details on available metrics. + +### Metric Categories + +| Category | Prefix | Examples | +|---|---|---| +| Node / Infrastructure | `node_*` | `node_cpu_seconds_total`, `node_memory_MemAvailable_bytes`, `node_load5`, `node_disk_read_bytes_total` | +| PostgreSQL | `pg_*` | `pg_stat_database_xact_commit_total`, `pg_database_size_mb`, `pg_stat_bgwriter_buffers_alloc_total` | +| Supavisor | `supavisor_*` | `supavisor_connections_active`, `supavisor_pool_connections_idle`, `supavisor_client_queries_count_total` | +| PostgREST | `pgrst_*` | `pgrst_db_pool_available`, `pgrst_db_pool_timeouts_total`, `pgrst_schema_cache_query_time_seconds` | +| Auth (GoTrue) | `gotrue_*` | `gotrue_running`, `gotrue_compare_hash_and_password_completed_total` | +| Realtime | `realtime_*` | `realtime_postgres_changes_client_subscriptions` | +| Go Runtime | `go_*`, `process_*` | `go_goroutines`, `process_cpu_seconds_total`, `process_resident_memory_bytes` | +| HTTP | `http_*` | `http_server_request_duration_seconds_total`, `http_status_codes_total` | + +All metrics are stored under the `metrics.*` field namespace with their original Prometheus names (e.g., `metrics.node_load5`, `metrics.pg_stat_database_xact_commit_total`). diff --git a/packages/supabase/changelog.yml b/packages/supabase/changelog.yml new file mode 100644 index 00000000000..4df29ddcf6f --- /dev/null +++ b/packages/supabase/changelog.yml @@ -0,0 +1,6 @@ +# newer versions go on top +- version: "0.1.0" + changes: + - description: Initial release of the Supabase OTel integration for metrics collection via Prometheus receiver. + type: enhancement + link: https://github.com/elastic/integrations/pull/20130 diff --git a/packages/supabase/data_stream/metrics/fields/base-fields.yml b/packages/supabase/data_stream/metrics/fields/base-fields.yml new file mode 100644 index 00000000000..fc548bfce19 --- /dev/null +++ b/packages/supabase/data_stream/metrics/fields/base-fields.yml @@ -0,0 +1,16 @@ +- name: data_stream.type + type: constant_keyword + description: Data stream type. +- name: data_stream.dataset + type: constant_keyword + description: Data stream dataset. +- name: data_stream.namespace + type: constant_keyword + description: Data stream namespace. +- name: '@timestamp' + type: date + description: Event timestamp. +- name: scope.attributes.service_type #Adding this to satisfy the validator as elastic package validator needs atleast one dimension field by default. + type: keyword + dimension: true + description: Supabase service producing the metric. diff --git a/packages/supabase/data_stream/metrics/manifest.yml b/packages/supabase/data_stream/metrics/manifest.yml new file mode 100644 index 00000000000..8ec59a5d9c0 --- /dev/null +++ b/packages/supabase/data_stream/metrics/manifest.yml @@ -0,0 +1,10 @@ +title: "Supabase Metrics" +type: metrics +elasticsearch: + index_mode: time_series +streams: + - package: prometheus_input_otel + title: Supabase Metrics + description: > + All metrics from the Supabase Metrics API: infrastructure (CPU, memory, + disk, network), PostgreSQL, Supavisor, PostgREST, Auth, Realtime, and Storage. diff --git a/packages/supabase/docs/README.md b/packages/supabase/docs/README.md new file mode 100644 index 00000000000..39c08306ed4 --- /dev/null +++ b/packages/supabase/docs/README.md @@ -0,0 +1,77 @@ +# Supabase OpenTelemetry Integration + +Collect metrics from [Supabase](https://supabase.com) using the OpenTelemetry Prometheus receiver. + +## Overview + +This integration scrapes metrics from the Supabase Metrics API (Prometheus-compatible) using the OTel Collector's Prometheus receiver. All metrics are collected into a single data stream + +- **Metrics** (`supabase.metrics.otel`) — Infrastructure (CPU, memory, load, disk I/O, filesystem, network), PostgreSQL (size, connections, transactions, cache, WAL, replication, bgwriter, statements), Supavisor, PostgREST, Auth, Realtime, and Storage + +Metrics are stored with native OTel schema — no field renaming or custom mapping is applied. Raw Prometheus metric names are preserved under the `metrics.*` namespace. + +## Compatibility + +This integration requires a Supabase **Pro**, **Team**, or **Enterprise** plan. The Metrics API is not available on the Free tier. + +## Prerequisites + +| Requirement | Details | +|---|---| +| **Supabase plan** | Pro, Team, or Enterprise | +| **Elastic Stack** | 9.4.0+ | +| **Input package** | `prometheus_input_otel` (installed automatically as a dependency) | +| **Content package** | `supabase_otel` (installed automatically as a dependency) | + +## Setup + +1. **Get your Supabase credentials**: + - Go to your Supabase dashboard → **Settings** → **API** + - Copy the **Project URL** (e.g., `abcdefghijkl.supabase.co`) + - Copy the **service_role** key (under "Project API keys") + +2. **Add the integration in Kibana**: + - Go to **Management** → **Integrations** → search for "Supabase" + - Click **Add Supabase** + - Fill in: + - **Targets**: `.supabase.co:443` + - **Username**: `service_role` + - **Service Role Key**: paste your service_role JWT + +3. **Verify data**: + - Go to **Discover** and filter on `data_stream.dataset: "supabase.metrics.otel"` + +## Dashboards + +Kibana dashboards are provided by the **Supabase ** OpenTelemetry Assets package, which is installed automatically. The following dashboards are included: + +- **Node & Infrastructure** — CPU, memory, load, disk I/O, filesystem, network +- **Database & Postgres Health** — connections, transactions, cache hit ratio, WAL, replication, bgwriter +- **Services & API Health** — Supavisor, PostgREST, GoTrue Auth, Realtime, Storage + +## Metrics Reference + +Metrics are scraped from the Supabase Metrics API endpoint: + +``` +GET https://.supabase.co/customer/v1/privileged/metrics +``` + +Authentication uses HTTP Basic Auth with `service_role` as the username and the service_role JWT as the password. + +See the [Supabase Metrics documentation](https://supabase.com/docs/guides/telemetry/metrics) for full details on available metrics. + +### Metric Categories + +| Category | Prefix | Examples | +|---|---|---| +| Node / Infrastructure | `node_*` | `node_cpu_seconds_total`, `node_memory_MemAvailable_bytes`, `node_load5`, `node_disk_read_bytes_total` | +| PostgreSQL | `pg_*` | `pg_stat_database_xact_commit_total`, `pg_database_size_mb`, `pg_stat_bgwriter_buffers_alloc_total` | +| Supavisor | `supavisor_*` | `supavisor_connections_active`, `supavisor_pool_connections_idle`, `supavisor_client_queries_count_total` | +| PostgREST | `pgrst_*` | `pgrst_db_pool_available`, `pgrst_db_pool_timeouts_total`, `pgrst_schema_cache_query_time_seconds` | +| Auth (GoTrue) | `gotrue_*` | `gotrue_running`, `gotrue_compare_hash_and_password_completed_total` | +| Realtime | `realtime_*` | `realtime_postgres_changes_client_subscriptions` | +| Go Runtime | `go_*`, `process_*` | `go_goroutines`, `process_cpu_seconds_total`, `process_resident_memory_bytes` | +| HTTP | `http_*` | `http_server_request_duration_seconds_total`, `http_status_codes_total` | + +All metrics are stored under the `metrics.*` field namespace with their original Prometheus names (e.g., `metrics.node_load5`, `metrics.pg_stat_database_xact_commit_total`). diff --git a/packages/supabase/img/supabase-logo.svg b/packages/supabase/img/supabase-logo.svg new file mode 100644 index 00000000000..161f508ddf0 --- /dev/null +++ b/packages/supabase/img/supabase-logo.svg @@ -0,0 +1,24 @@ + + Supabase with OpenTelemetry + + + + + + + + + + + + + + + + + + + + + + diff --git a/packages/supabase/manifest.yml b/packages/supabase/manifest.yml new file mode 100644 index 00000000000..ca63dc9bf46 --- /dev/null +++ b/packages/supabase/manifest.yml @@ -0,0 +1,109 @@ +format_version: "3.6.2" +name: supabase +title: "Supabase" +version: 0.1.0 +source: + license: "Elastic-2.0" +description: >- + Collect metrics from Supabase using the OTel Prometheus receiver. + Covers infrastructure, PostgreSQL, Supavisor, PostgREST, Auth, + Realtime, and Storage metrics. +type: integration +categories: + - observability + - monitoring + - cloud + - opentelemetry +conditions: + kibana: + version: "^9.4.0" + elastic: + subscription: basic +icons: + - src: /img/supabase-logo.svg + title: Supabase logo + size: 256x256 + type: image/svg+xml +requires: + input: + - package: prometheus_input_otel + version: "0.1.1" + content: + - package: supabase_otel + version: "0.1.0" +policy_templates: + - name: supabase + title: Supabase Metrics + description: Collect metrics from Supabase's Prometheus-compatible Metrics API + data_streams: + - metrics + deployment_modes: + default: + enabled: true + agentless: + enabled: true + is_default: true + organization: observability + division: engineering + team: obs-infraobs-integrations + inputs: + - package: prometheus_input_otel + title: Supabase Metrics + description: Scrape Supabase metrics using the OTel Collector Prometheus receiver + vars: + - name: targets + type: text + title: Supabase Metrics Endpoint + required: true + multi: true + description: > + Supabase Metrics API endpoint in host:port format. + Use your project ref: .supabase.co:443 + default: + - ".supabase.co:443" + show_user: true + - name: scrape_interval + type: duration + title: Scrape Interval + required: false + description: How frequently to scrape the Supabase metrics endpoint. Supabase recommends once per minute. + default: 60s + show_user: true + - name: metrics_path + type: text + title: Metrics Path + required: false + description: The HTTP resource path to fetch metrics from Supabase. + default: /customer/v1/privileged/metrics + show_user: true + - name: scheme + type: select + title: Scheme + required: false + description: Protocol scheme. Supabase Metrics API requires HTTPS. + default: https + show_user: false + options: + - text: HTTPS + value: https + - text: HTTP + value: http + - name: username + type: text + title: Username + required: true + description: > + HTTP Basic Auth username for the Supabase Metrics API. + default: "service_role" + show_user: true + - name: password + type: password + title: Service Role Key + required: true + description: > + The service_role JWT key from the Supabase dashboard + (Settings > API > Project API keys > service_role). + show_user: true +owner: + type: elastic + github: elastic/obs-infraobs-integrations