Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Supabase integration #19307

Merged
merged 9 commits into from
Dec 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -582,6 +582,10 @@ coverage:
target: 75
flags:
- strimzi
Supabase:
target: 75
flags:
- supabase
Supervisord:
target: 75
flags:
Expand Down Expand Up @@ -1482,6 +1486,11 @@ flags:
paths:
- strimzi/datadog_checks/strimzi
- strimzi/tests
supabase:
carryforward: true
paths:
- supabase/datadog_checks/supabase
- supabase/tests
supervisord:
carryforward: true
paths:
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/config/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ integration/amazon_msk:
- amazon_msk/**/*
integration/ambari:
- ambari/**/*
integration/anthropic:
- anthropic/**/*
integration/anyscale:
- anyscale/**/*
integration/apache:
Expand Down Expand Up @@ -325,8 +327,6 @@ integration/kyverno:
- kyverno/**/*
integration/langchain:
- langchain/**/*
integration/anthropic:
- anthropic/**/*
integration/lastpass:
- lastpass/**/*
integration/lighttpd:
Expand Down Expand Up @@ -521,6 +521,8 @@ integration/streamnative:
- streamnative/**/*
integration/strimzi:
- strimzi/**/*
integration/supabase:
- supabase/**/*
integration/supervisord:
- supervisord/**/*
integration/suricata:
Expand Down
20 changes: 20 additions & 0 deletions .github/workflows/test-all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3454,6 +3454,26 @@ jobs:
minimum-base-package: ${{ inputs.minimum-base-package }}
pytest-args: ${{ inputs.pytest-args }}
secrets: inherit
jfe7ceb7:
uses: ./.github/workflows/test-target.yml
with:
job-name: Supabase
target: supabase
platform: linux
runner: '["ubuntu-22.04"]'
repo: "${{ inputs.repo }}"
python-version: "${{ inputs.python-version }}"
standard: ${{ inputs.standard }}
latest: ${{ inputs.latest }}
agent-image: "${{ inputs.agent-image }}"
agent-image-py2: "${{ inputs.agent-image-py2 }}"
agent-image-windows: "${{ inputs.agent-image-windows }}"
agent-image-windows-py2: "${{ inputs.agent-image-windows-py2 }}"
test-py2: ${{ inputs.test-py2 }}
test-py3: ${{ inputs.test-py3 }}
minimum-base-package: ${{ inputs.minimum-base-package }}
pytest-args: ${{ inputs.pytest-args }}
secrets: inherit
jf04a052:
uses: ./.github/workflows/test-target.yml
with:
Expand Down
4 changes: 4 additions & 0 deletions supabase/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# CHANGELOG - supabase

<!-- towncrier release notes start -->

60 changes: 60 additions & 0 deletions supabase/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Agent Check: supabase

## Overview

This check monitors [supabase][1] through the Datadog Agent.

Include a high level overview of what this integration does:
- What does your product do (in 1-2 sentences)?
- What value will customers get from this integration, and why is it valuable to them?
- What specific data will your integration monitor, and what's the value of that data?

## Setup

Follow the instructions below to install and configure this check for an Agent running on a host. For containerized environments, see the [Autodiscovery Integration Templates][3] for guidance on applying these instructions.

### Installation

The supabase check is included in the [Datadog Agent][2] package.
No additional installation is needed on your server.

### Configuration

1. Edit the `supabase.d/conf.yaml` file, in the `conf.d/` folder at the root of your Agent's configuration directory to start collecting your supabase performance data. See the [sample supabase.d/conf.yaml][4] for all available configuration options.

2. [Restart the Agent][5].

### Validation

[Run the Agent's status subcommand][6] and look for `supabase` under the Checks section.

## Data Collected

### Metrics

See [metadata.csv][7] for a list of metrics provided by this integration.

### Events

The supabase integration does not include any events.

### Service Checks

The supabase integration does not include any service checks.

See [service_checks.json][8] for a list of service checks provided by this integration.

## Troubleshooting

Need help? Contact [Datadog support][9].


[1]: **LINK_TO_INTEGRATION_SITE**
[2]: https://app.datadoghq.com/account/settings/agent/latest
[3]: https://docs.datadoghq.com/agent/kubernetes/integrations/
[4]: https://github.com/DataDog/integrations-core/blob/master/supabase/datadog_checks/supabase/data/conf.yaml.example
[5]: https://docs.datadoghq.com/agent/guide/agent-commands/#start-stop-and-restart-the-agent
[6]: https://docs.datadoghq.com/agent/guide/agent-commands/#agent-status-and-information
[7]: https://github.com/DataDog/integrations-core/blob/master/supabase/metadata.csv
[8]: https://github.com/DataDog/integrations-core/blob/master/supabase/assets/service_checks.json
[9]: https://docs.datadoghq.com/help/
28 changes: 28 additions & 0 deletions supabase/assets/configuration/spec.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Supabase
files:
- name: supabase.yaml
options:
- template: init_config
options:
- template: init_config/default
- template: instances
options:
- name: priviledged_metrics_endpoint
description: |
Endpoint exposing Supabase customer metrics
https://supabase.com/docs/guides/monitoring-troubleshooting/metrics#accessing-the-metrics-endpoint
value:
display_default: null
example: https://<project-ref>.supabase.co/customer/v1/privileged/metrics
type: string
- name: storage_api_endpoint
description: |
Endpoint exposing the S3 Storage API Prometheus metrics.
value:
display_default: null
example: http://%%host%%:5000/metrics
type: string
- template: instances/openmetrics
overrides:
openmetrics_endpoint.required: false
openmetrics_endpoint.hidden: true
77 changes: 77 additions & 0 deletions supabase/assets/dashboards/supabase_overview.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
{
"title": "Supabase Overview",
"description": "## Supabase\n",
"widgets": [
{
"id": 4717263751542750,
"definition": {
"title": "",
"banner_img": "/static/images/logos/supabase_large.svg",
"show_title": true,
"type": "group",
"layout_type": "ordered",
"widgets": [
{
"id": 5685022835071772,
"definition": {
"type": "note",
"content": "## Supabase\n",
"background_color": "white",
"font_size": "14",
"text_align": "left",
"vertical_align": "center",
"show_tick": false,
"tick_pos": "50%",
"tick_edge": "left",
"has_padding": true
},
"layout": {
"x": 0,
"y": 0,
"width": 3,
"height": 3
}
},
{
"id": 8921963557059570,
"definition": {
"type": "note",
"content": "",
"background_color": "white",
"font_size": "14",
"text_align": "center",
"vertical_align": "center",
"show_tick": false,
"tick_pos": "50%",
"tick_edge": "left",
"has_padding": true
},
"layout": {
"x": 3,
"y": 0,
"width": 3,
"height": 3
}
}
]
},
"layout": {
"x": 0,
"y": 0,
"width": 6,
"height": 6
}
}
],
"template_variables": [
{
"name": "host",
"prefix": "host",
"available_values": [],
"default": "*"
}
],
"layout_type": "ordered",
"notify_list": [],
"reflow_type": "fixed"
}
32 changes: 32 additions & 0 deletions supabase/assets/service_checks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
[
{
"agent_version": "7.62.0",
"integration": "Supabase",
"check": "supabase.openmetrics.health",
"statuses": [
"ok",
"critical"
],
"groups": [
"host",
"endpoint"
],
"name": "Supabase OpenMetrics endpoint health",
"description": "Returns `CRITICAL` if the Agent is unable to connect to the Supabase OpenMetrics endpoint, otherwise returns `OK`."
},
{
"agent_version": "7.62.0",
"integration": "Supabase",
"check": "supabase.storage_api.openmetrics.health",
"statuses": [
"ok",
"critical"
],
"groups": [
"host",
"endpoint"
],
"name": "Supabase Storage API OpenMetrics endpoint health",
"description": "Returns `CRITICAL` if the Agent is unable to connect to the Supabase Storage API OpenMetrics endpoint, otherwise returns `OK`."
}
]
1 change: 1 addition & 0 deletions supabase/changelog.d/19307.added
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Initial Release
4 changes: 4 additions & 0 deletions supabase/datadog_checks/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# (C) Datadog, Inc. 2024-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
__path__ = __import__('pkgutil').extend_path(__path__, __name__) # type: ignore
4 changes: 4 additions & 0 deletions supabase/datadog_checks/supabase/__about__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# (C) Datadog, Inc. 2024-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
__version__ = '0.0.1'
7 changes: 7 additions & 0 deletions supabase/datadog_checks/supabase/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# (C) Datadog, Inc. 2024-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
from .__about__ import __version__
from .check import SupabaseCheck

__all__ = ['__version__', 'SupabaseCheck']
57 changes: 57 additions & 0 deletions supabase/datadog_checks/supabase/check.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# (C) Datadog, Inc. 2024-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
from typing import Any # noqa: F401

from datadog_checks.base import ConfigurationError, OpenMetricsBaseCheckV2 # noqa: F401

from .config_models import ConfigMixin
from .metrics import RENAME_LABELS_MAP, STORAGE_API_METRICS, SUPABASE_METRICS

(
PRIVILEGED_METRICS_NAMESPACE,
STORAGE_API_METRICS_NAMESPACE,
) = [
'supabase',
'supabase.storage_api',
]


class SupabaseCheck(OpenMetricsBaseCheckV2, ConfigMixin):

DEFAULT_METRIC_LIMIT = 0

def __init__(self, name, init_config, instances=None):
super(SupabaseCheck, self).__init__(name, init_config, instances)
self.check_initializations.appendleft(self.parse_config)
# Use self.instance to read the check configuration
# self.url = self.instance.get("url")

def parse_config(self):
self.scraper_configs = []
privileged_metrics_endpoint = self.instance.get("privileged_metrics_endpoint")
storage_api_endpoint = self.instance.get("storage_api_endpoint")

if not privileged_metrics_endpoint and not storage_api_endpoint:
raise ConfigurationError(
"Must specify at least one of the following:" "`privileged_metrics_endpoint` or `storage_api_endpoint`."
)

if privileged_metrics_endpoint:
self.scraper_configs.append(
self.generate_config(privileged_metrics_endpoint, PRIVILEGED_METRICS_NAMESPACE, SUPABASE_METRICS)
)
if storage_api_endpoint:
self.scraper_configs.append(
self.generate_config(storage_api_endpoint, STORAGE_API_METRICS_NAMESPACE, STORAGE_API_METRICS)
)

def generate_config(self, endpoint, namespace, metrics):
config = {
'openmetrics_endpoint': endpoint,
'metrics': metrics,
'namespace': namespace,
'rename_labels': RENAME_LABELS_MAP,
}
config.update(self.instance)
return config
24 changes: 24 additions & 0 deletions supabase/datadog_checks/supabase/config_models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# (C) Datadog, Inc. 2024-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)

# This file is autogenerated.
# To change this file you should edit assets/configuration/spec.yaml and then run the following commands:
# ddev -x validate config -s <INTEGRATION_NAME>
# ddev -x validate models -s <INTEGRATION_NAME>

from .instance import InstanceConfig
from .shared import SharedConfig


class ConfigMixin:
_config_model_instance: InstanceConfig
_config_model_shared: SharedConfig

@property
def config(self) -> InstanceConfig:
return self._config_model_instance

@property
def shared_config(self) -> SharedConfig:
return self._config_model_shared
Loading
Loading