Skip to content

Commit

Permalink
Supabase integration
Browse files Browse the repository at this point in the history
  • Loading branch information
Kyle-Neale committed Dec 25, 2024
1 parent aa9bd4e commit 4e8d004
Show file tree
Hide file tree
Showing 30 changed files with 3,392 additions and 0 deletions.
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
1 change: 1 addition & 0 deletions supabase/assets/dashboards/supabase_overview.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Please build an out-of-the-box dashboard for your integration following our best practices here: https://datadoghq.dev/integrations-core/guidelines/dashboards/#best-practices
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 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/1.added
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Initial Release

Check failure on line 1 in supabase/changelog.d/1.added

View workflow job for this annotation

GitHub Actions / run / Check PR

Your changelog entry has the wrong PR number. To fix this please run: mv supabase/changelog.d/1.added supabase/changelog.d/19307.added
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']
58 changes: 58 additions & 0 deletions supabase/datadog_checks/supabase/check.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# (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
124 changes: 124 additions & 0 deletions supabase/datadog_checks/supabase/config_models/defaults.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
# (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>


def instance_allow_redirects():
return True


def instance_auth_type():
return 'basic'


def instance_cache_metric_wildcards():
return True


def instance_cache_shared_labels():
return True


def instance_collect_counters_with_distributions():
return False


def instance_collect_histogram_buckets():
return True


def instance_disable_generic_tags():
return False


def instance_empty_default_hostname():
return False


def instance_enable_health_service_check():
return True


def instance_histogram_buckets_as_distributions():
return False


def instance_ignore_connection_errors():
return False


def instance_kerberos_auth():
return 'disabled'


def instance_kerberos_delegate():
return False


def instance_kerberos_force_initiate():
return False


def instance_log_requests():
return False


def instance_min_collection_interval():
return 15


def instance_non_cumulative_histogram_buckets():
return False


def instance_persist_connections():
return False


def instance_request_size():
return 16


def instance_skip_proxy():
return False


def instance_tag_by_endpoint():
return True


def instance_telemetry():
return False


def instance_timeout():
return 10


def instance_tls_ignore_warning():
return False


def instance_tls_use_host_header():
return False


def instance_tls_verify():
return True


def instance_use_latest_spec():
return False


def instance_use_legacy_auth_encoding():
return True


def instance_use_process_start_time():
return False
Loading

0 comments on commit 4e8d004

Please sign in to comment.