diff --git a/supabase/assets/dashboards/supabase_overview.json b/supabase/assets/dashboards/supabase_overview.json index e9e23301af626..eac5ccdf59ebc 100644 --- a/supabase/assets/dashboards/supabase_overview.json +++ b/supabase/assets/dashboards/supabase_overview.json @@ -1 +1,77 @@ -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 \ No newline at end of file +{ + "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" +} \ No newline at end of file diff --git a/supabase/assets/service_checks.json b/supabase/assets/service_checks.json index e45d06c14adcc..f1b12843fedde 100644 --- a/supabase/assets/service_checks.json +++ b/supabase/assets/service_checks.json @@ -26,7 +26,7 @@ "host", "endpoint" ], - "name": "Supabase OpenMetrics endpoint health", + "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`." } ] \ No newline at end of file diff --git a/supabase/changelog.d/1.added b/supabase/changelog.d/19307.added similarity index 100% rename from supabase/changelog.d/1.added rename to supabase/changelog.d/19307.added diff --git a/supabase/datadog_checks/supabase/check.py b/supabase/datadog_checks/supabase/check.py index c9b36faf1944e..5e1cd85b581eb 100644 --- a/supabase/datadog_checks/supabase/check.py +++ b/supabase/datadog_checks/supabase/check.py @@ -4,11 +4,10 @@ from typing import Any # noqa: F401 from datadog_checks.base import ConfigurationError, OpenMetricsBaseCheckV2 # noqa: F401 -from .config_models import ConfigMixin +from .config_models import ConfigMixin from .metrics import RENAME_LABELS_MAP, STORAGE_API_METRICS, SUPABASE_METRICS - ( PRIVILEGED_METRICS_NAMESPACE, STORAGE_API_METRICS_NAMESPACE, @@ -17,6 +16,7 @@ 'supabase.storage_api', ] + class SupabaseCheck(OpenMetricsBaseCheckV2, ConfigMixin): DEFAULT_METRIC_LIMIT = 0 @@ -31,11 +31,10 @@ 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`." + "Must specify at least one of the following:" "`privileged_metrics_endpoint` or `storage_api_endpoint`." ) if privileged_metrics_endpoint: @@ -55,4 +54,4 @@ def generate_config(self, endpoint, namespace, metrics): 'rename_labels': RENAME_LABELS_MAP, } config.update(self.instance) - return config \ No newline at end of file + return config diff --git a/supabase/datadog_checks/supabase/metrics.py b/supabase/datadog_checks/supabase/metrics.py index 32d836ae65237..7902d907fc7dd 100644 --- a/supabase/datadog_checks/supabase/metrics.py +++ b/supabase/datadog_checks/supabase/metrics.py @@ -6,35 +6,35 @@ # https://argo-cd.readthedocs.io/en/stable/operator-manual/metrics/ PRIVELEGED_METRICS = { 'auth_users_user_count': 'auth_users.user_count', - 'db_sql_connection_closed_max_idle_time': 'db.sql.connection_closed_max_idle_time', # COUNTER - 'db_sql_connection_closed_max_idle': 'db.sql.connection_closed_max_idle', # COUNTER - 'db_sql_connection_closed_max_lifetime': 'db.sql.connection_closed_max_lifetime', # COUNTER + 'db_sql_connection_closed_max_idle_time': 'db.sql.connection_closed_max_idle_time', + 'db_sql_connection_closed_max_idle': 'db.sql.connection_closed_max_idle', + 'db_sql_connection_closed_max_lifetime': 'db.sql.connection_closed_max_lifetime', 'db_sql_connection_max_open': 'db.sql.connection_max_open', 'db_sql_connection_open': 'db.sql.connection_open', - 'db_sql_connection_wait_duration_milliseconds': 'db.sql.connection_wait_duration', # COUNTER - 'db_sql_connection_wait': 'db.sql.connection_wait', # COUNTER - 'db_transmit_bytes': 'db.transmit_bytes', # COUNTER - 'http_server_response_size_bytes': 'http.server.response_size_bytes', # COUNTER - 'http_status_codes': 'http.status_codes', # COUNTER - 'node_cpu_guest_seconds': 'node.cpu.guest_seconds', # COUNTER - 'node_cpu_seconds': 'node.cpu.seconds', # COUNTER - 'node_disk_discard_time_seconds': 'node.disk.discard_time_seconds', # COUNTER - 'node_disk_discarded_sectors': 'node.disk.discarded_sectors', # COUNTER - 'node_disk_discards_completed': 'node.disk.discards_completed', # COUNTER - 'node_disk_discards_merged': 'node.disk.discards_merged', # COUNTER - 'node_disk_flush_requests_time_seconds': 'node.disk.flush_requests_time_seconds', # COUNTER - 'node_disk_flush_requests': 'node.disk.flush_requests', # COUNTER + 'db_sql_connection_wait_duration_milliseconds': 'db.sql.connection_wait_duration', + 'db_sql_connection_wait': 'db.sql.connection_wait', + 'db_transmit_bytes': 'db.transmit_bytes', + 'http_server_response_size_bytes': 'http.server.response_size_bytes', + 'http_status_codes': 'http.status_codes', + 'node_cpu_guest_seconds': 'node.cpu.guest_seconds', + 'node_cpu_seconds': 'node.cpu.seconds', + 'node_disk_discard_time_seconds': 'node.disk.discard_time_seconds', + 'node_disk_discarded_sectors': 'node.disk.discarded_sectors', + 'node_disk_discards_completed': 'node.disk.discards_completed', + 'node_disk_discards_merged': 'node.disk.discards_merged', + 'node_disk_flush_requests_time_seconds': 'node.disk.flush_requests_time_seconds', + 'node_disk_flush_requests': 'node.disk.flush_requests', 'node_disk_io_now': 'node.disk.io_now', - 'node_disk_io_time_seconds': 'node.disk.io_time_seconds', # COUNTER - 'node_disk_io_time_weighted_seconds': 'node.disk.io_time_weighted_seconds', # COUNTER - 'node_disk_read_bytes': 'node.disk.read_bytes', # COUNTER - 'node_disk_read_time_seconds': 'node.disk.read_time_seconds', # COUNTER - 'node_disk_reads_completed': 'node.disk.reads_completed', # COUNTER - 'node_disk_reads_merged': 'node.disk.reads_merged', # COUNTER - 'node_disk_write_time_seconds': 'node.disk.write_time_seconds', # COUNTER - 'node_disk_writes_completed': 'node.disk.writes_completed', # COUNTER - 'node_disk_writes_merged': 'node.disk.writes_merged', # COUNTER - 'node_disk_written_bytes': 'node.disk.written_bytes', # COUNTER + 'node_disk_io_time_seconds': 'node.disk.io_time_seconds', + 'node_disk_io_time_weighted_seconds': 'node.disk.io_time_weighted_seconds', + 'node_disk_read_bytes': 'node.disk.read_bytes', + 'node_disk_read_time_seconds': 'node.disk.read_time_seconds', + 'node_disk_reads_completed': 'node.disk.reads_completed', + 'node_disk_reads_merged': 'node.disk.reads_merged', + 'node_disk_write_time_seconds': 'node.disk.write_time_seconds', + 'node_disk_writes_completed': 'node.disk.writes_completed', + 'node_disk_writes_merged': 'node.disk.writes_merged', + 'node_disk_written_bytes': 'node.disk.written_bytes', 'node_filesystem_avail_bytes': 'node.filesystem.available_bytes', 'node_filesystem_device_error': 'node.filesystem.device_error', 'node_filesystem_files': 'node.filesystem.files', @@ -93,155 +93,156 @@ 'node_memory_VmallocUsed_bytes': 'node.memory.vm_alloc_used_bytes', 'node_memory_WritebackTmp_bytes': 'node.memory.writeback_tmp_bytes', 'node_memory_Writeback_bytes': 'node.memory.writeback_bytes', - 'node_network_receive_bytes': 'node.network.receive_bytes', # COUNTER - 'node_network_receive_compressed': 'node.network.receive_compressed', # COUNTER - 'node_network_receive_drop': 'node.network.receive_drop', # COUNTER - 'node_network_receive_errs': 'node.network.receive_errors', # COUNTER - 'node_network_receive_fifo': 'node.network.receive_fifo', # COUNTER - 'node_network_receive_frame': 'node.network.receive_frame', # COUNTER - 'node_network_receive_multicast': 'node.network.receive_multicast', # COUNTER - 'node_network_receive_packets': 'node.network.receive_packets', # COUNTER - 'node_network_transmit_bytes': 'node.network.transmit_bytes', # COUNTER - 'node_network_transmit_carrier': 'node.network.transmit_carrier', # COUNTER - 'node_network_transmit_colls':'node.network.transmit_colls', # COUNTER - 'node_network_transmit_compressed': 'node.network.transmit_compressed', # COUNTER - 'node_network_transmit_drop': 'node.network.transmit_drop', # COUNTER - 'node_network_transmit_errs': 'node.network.transmit_errors', # COUNTER - 'node_network_transmit_fifo': 'node.network.transmit_fifo', # COUNTER - 'node_network_transmit_packets': 'node.network.transmit_packets', # COUNTER + 'node_network_receive_bytes': 'node.network.receive_bytes', + 'node_network_receive_compressed': 'node.network.receive_compressed', + 'node_network_receive_drop': 'node.network.receive_drop', + 'node_network_receive_errs': 'node.network.receive_errors', + 'node_network_receive_fifo': 'node.network.receive_fifo', + 'node_network_receive_frame': 'node.network.receive_frame', + 'node_network_receive_multicast': 'node.network.receive_multicast', + 'node_network_receive_packets': 'node.network.receive_packets', + 'node_network_transmit_bytes': 'node.network.transmit_bytes', + 'node_network_transmit_carrier': 'node.network.transmit_carrier', + 'node_network_transmit_colls': 'node.network.transmit_colls', + 'node_network_transmit_compressed': 'node.network.transmit_compressed', + 'node_network_transmit_drop': 'node.network.transmit_drop', + 'node_network_transmit_errs': 'node.network.transmit_errors', + 'node_network_transmit_fifo': 'node.network.transmit_fifo', + 'node_network_transmit_packets': 'node.network.transmit_packets', 'node_scrape_collector_duration_seconds': 'node.scrape.collector_duration_seconds', 'node_scrape_collector_success': 'node.scrape.collector_success', - 'node_vmstat_oom_kill': 'node.vmstat.oom_kill', # UNTYPED - 'node_vmstat_pgfault': 'node.vmstat.pgfault', # UNTYPED - 'node_vmstat_pgmajfault': 'node.vmstat.pgmajfault', # UNTYPED - 'node_vmstat_pgpgin': 'node.vmstat.pgpgin', # UNTYPED - 'node_vmstat_pgpgout': 'node.vmstat.pgpgout', # UNTYPED - 'node_vmstat_pswpin': 'node.vmstat.pswpin', # UNTYPED - 'node_vmstat_pswpout': 'node.vmstat.pswpout', # UNTYPED + 'node_vmstat_oom_kill': 'node.vmstat.oom_kill', # UNTYPED + 'node_vmstat_pgfault': 'node.vmstat.pgfault', # UNTYPED + 'node_vmstat_pgmajfault': 'node.vmstat.pgmajfault', # UNTYPED + 'node_vmstat_pgpgin': 'node.vmstat.pgpgin', # UNTYPED + 'node_vmstat_pgpgout': 'node.vmstat.pgpgout', # UNTYPED + 'node_vmstat_pswpin': 'node.vmstat.pswpin', # UNTYPED + 'node_vmstat_pswpout': 'node.vmstat.pswpout', # UNTYPED 'pg_database_size_bytes': 'pg_database_size.bytes', 'pg_database_size_mb': 'pg_database_size.mb', 'pg_exporter_last_scrape_duration_seconds': 'pg_exporter.last_scrape_duration_seconds', 'pg_exporter_last_scrape_error': 'pg_exporter.last_scrape_error', - 'pg_exporter_scrapes': 'pg_exporter.scrapes', # COUNTER + 'pg_exporter_scrapes': 'pg_exporter.scrapes', 'pg_exporter_user_queries_load_error': 'pg_exporter.user_queries_load_error', - 'pg_ls_archive_statusdir_wal_pending_count': 'pg_ls.archive_statusdir_wal_pending_count', # COUNTER - 'pg_scrape_collector_duration_seconds': 'pg_scrape_collector.duration_seconds', # GAUGE + 'pg_ls_archive_statusdir_wal_pending_count': 'pg_ls.archive_statusdir_wal_pending_count', + 'pg_scrape_collector_duration_seconds': 'pg_scrape_collector.duration_seconds', # GAUGE 'pg_scrape_collector_success': 'pg_scrape_collector.success', 'pg_stat_activity_xact_runtime': 'pg_stat_activity.xact_runtime', - 'pg_stat_bgwriter_buffers_alloc': 'pg_stat_bgwriter.buffers_alloc', # COUNTER - 'pg_stat_bgwriter_buffers_backend_fsync': 'pg_stat_bgwriter.buffers_backend_fsync', # COUNTER - 'pg_stat_bgwriter_buffers_backend': 'pg_stat_bgwriter.buffers_backend', # COUNTER - 'pg_stat_bgwriter_buffers_checkpoint': 'pg_stat_bgwriter.buffers_checkpoint', # COUNTER - 'pg_stat_bgwriter_buffers_clean': 'pg_stat_bgwriter.buffers_clean', # COUNTER - 'pg_stat_bgwriter_checkpoint_sync_time': 'pg_stat_bgwriter.checkpoint_sync_time', # COUNTER - 'pg_stat_bgwriter_checkpoint_write_time': 'pg_stat_bgwriter.checkpoint_write_time', # COUNTER - 'pg_stat_bgwriter_checkpoints_req': 'pg_stat_bgwriter.checkpoints_req', # COUNTER - 'pg_stat_bgwriter_checkpoints_timed': 'pg_stat_bgwriter.checkpoints_timed', # COUNTER - 'pg_stat_bgwriter_maxwritten_clean': 'pg_stat_bgwriter.maxwritten_clean', # COUNTER - 'pg_stat_bgwriter_stats_reset': 'pg_stat_bgwriter.stats_reset', # COUNTER - 'pg_stat_database_blks_hit': 'pg_stat_database.blks_hit', # COUNTER - 'pg_stat_database_blks_read': 'pg_stat_database.blks_read', # COUNTER - 'pg_stat_database_conflicts_confl_bufferpin': 'pg_stat_database_conflicts.confl_bufferpin', # COUNTER - 'pg_stat_database_conflicts_confl_deadlock': 'pg_stat_database_conflicts.confl_deadlock', # COUNTER - 'pg_stat_database_conflicts_confl_lock': 'pg_stat_database_conflicts.confl_lock', # COUNTER - 'pg_stat_database_conflicts_confl_snapshot': 'pg_stat_database_conflicts.confl_snapshot', # COUNTER - 'pg_stat_database_conflicts_confl_tablespace': 'pg_stat_database_conflicts.confl_tablespace', # COUNTER - 'pg_stat_database_conflicts': 'pg_stat_database.conflicts', # COUNTER - 'pg_stat_database_deadlocks': 'pg_stat_database.deadlocks', # COUNTER - 'pg_stat_database_most_recent_reset': 'pg_stat_database.most_recent_reset', # COUNTER + 'pg_stat_bgwriter_buffers_alloc': 'pg_stat_bgwriter.buffers_alloc', + 'pg_stat_bgwriter_buffers_backend_fsync': 'pg_stat_bgwriter.buffers_backend_fsync', + 'pg_stat_bgwriter_buffers_backend': 'pg_stat_bgwriter.buffers_backend', + 'pg_stat_bgwriter_buffers_checkpoint': 'pg_stat_bgwriter.buffers_checkpoint', + 'pg_stat_bgwriter_buffers_clean': 'pg_stat_bgwriter.buffers_clean', + 'pg_stat_bgwriter_checkpoint_sync_time': 'pg_stat_bgwriter.checkpoint_sync_time', + 'pg_stat_bgwriter_checkpoint_write_time': 'pg_stat_bgwriter.checkpoint_write_time', + 'pg_stat_bgwriter_checkpoints_req': 'pg_stat_bgwriter.checkpoints_req', + 'pg_stat_bgwriter_checkpoints_timed': 'pg_stat_bgwriter.checkpoints_timed', + 'pg_stat_bgwriter_maxwritten_clean': 'pg_stat_bgwriter.maxwritten_clean', + 'pg_stat_bgwriter_stats_reset': 'pg_stat_bgwriter.stats_reset', + 'pg_stat_database_blks_hit': 'pg_stat_database.blks_hit', + 'pg_stat_database_blks_read': 'pg_stat_database.blks_read', + 'pg_stat_database_conflicts_confl_bufferpin': 'pg_stat_database_conflicts.confl_bufferpin', + 'pg_stat_database_conflicts_confl_deadlock': 'pg_stat_database_conflicts.confl_deadlock', + 'pg_stat_database_conflicts_confl_lock': 'pg_stat_database_conflicts.confl_lock', + 'pg_stat_database_conflicts_confl_snapshot': 'pg_stat_database_conflicts.confl_snapshot', + 'pg_stat_database_conflicts_confl_tablespace': 'pg_stat_database_conflicts.confl_tablespace', + 'pg_stat_database_conflicts': 'pg_stat_database.conflicts', + 'pg_stat_database_deadlocks': 'pg_stat_database.deadlocks', + 'pg_stat_database_most_recent_reset': 'pg_stat_database.most_recent_reset', 'pg_stat_database_num_backends': 'pg_stat_database.num_backends', - 'pg_stat_database_temp_bytes': 'pg_stat_database.temp_bytes', # COUNTER - 'pg_stat_database_temp_files': 'pg_stat_database.temp_files', # COUNTER - 'pg_stat_database_tup_deleted': 'pg_stat_database.tup_deleted', # COUNTER - 'pg_stat_database_tup_fetched': 'pg_stat_database.tup_fetched', # COUNTER - 'pg_stat_database_tup_inserted': 'pg_stat_database.tup_inserted', # COUNTER - 'pg_stat_database_tup_returned': 'pg_stat_database.tup_returned', # COUNTER - 'pg_stat_database_tup_updated': 'pg_stat_database.tup_updated', # COUNTER - 'pg_stat_database_xact_commit': 'pg_stat_database.xact_commit', # COUNTER - 'pg_stat_database_xact_rollback': 'pg_stat_database.xact_rollback', # COUNTER + 'pg_stat_database_temp_bytes': 'pg_stat_database.temp_bytes', + 'pg_stat_database_temp_files': 'pg_stat_database.temp_files', + 'pg_stat_database_tup_deleted': 'pg_stat_database.tup_deleted', + 'pg_stat_database_tup_fetched': 'pg_stat_database.tup_fetched', + 'pg_stat_database_tup_inserted': 'pg_stat_database.tup_inserted', + 'pg_stat_database_tup_returned': 'pg_stat_database.tup_returned', + 'pg_stat_database_tup_updated': 'pg_stat_database.tup_updated', + 'pg_stat_database_xact_commit': 'pg_stat_database.xact_commit', + 'pg_stat_database_xact_rollback': 'pg_stat_database.xact_rollback', 'pg_stat_replication_replay_lag': 'pg_stat_replication.replay_lag', 'pg_stat_replication_send_lag': 'pg_stat_replication.send_lag', - 'pg_stat_statements_total_queries': 'pg_stat_statements.total_queries', # COUNTER - 'pg_stat_statements_total_time_seconds': 'pg_stat_statements.total_time_seconds', # COUNTER + 'pg_stat_statements_total_queries': 'pg_stat_statements.total_queries', + 'pg_stat_statements_total_time_seconds': 'pg_stat_statements.total_time_seconds', 'pg_status_in_recovery': 'pg_status.in_recovery', 'pg_up': 'pg.up', 'pg_wal_size_mb': 'pg_wal.size', 'pgrst_db_pool_available': 'pgrst.db_pool.available_connections', 'pgrst_db_pool_max': 'pgrst.db_pool.max_connections', - 'pgrst_db_pool_timeouts': 'pgrst.db_pool.connection_timeouts', # COUNTER + 'pgrst_db_pool_timeouts': 'pgrst.db_pool.connection_timeouts', 'pgrst_db_pool_waiting': 'pgrst.db_pool.requests_waiting', - 'pgrst_schema_cache_loads': 'pgrst.schema_cache.loads', # COUNTER + 'pgrst_schema_cache_loads': 'pgrst.schema_cache.loads', 'pgrst_schema_cache_query_time_seconds': 'pgrst.schema_cache.query_time_seconds', 'physical_replication_lag_is_connected_to_primary': 'physical_replication_lag.is_connected_to_primary', 'physical_replication_lag_is_wal_replay_paused': 'physical_replication_lag.is_wal_replay_paused', 'physical_replication_lag_physical_replication_lag_seconds': 'physical_replication_lag.seconds', 'postgres_exporter_build_info': 'postgres_exporter.build_info', - 'postgres_exporter_config_last_reload_success_timestamp_seconds': 'postgres_exporter.config_last_reload_success_timestamp_seconds', + 'postgres_exporter_config_last_reload_success_timestamp_seconds': 'postgres_exporter.config_last_reload_success_timestamp_seconds', # noqa: E501 'postgres_exporter_config_last_reload_successful': 'postgres_exporter.config_last_reload_successful', - 'postgresql_restarts': 'postgresql.restarts', # COUNTER + 'postgresql_restarts': 'postgresql.restarts', 'process_runtime_go_mem_live_objects': 'process.runtime.go_mem_live_objects', 'promhttp_metric_handler_requests_in_flight': 'promhttp_metric_handler.requests_in_flight', - 'promhttp_metric_handler_requests_in_flight': 'promhttp_metric_handler.requests_in_flight', - 'promhttp_metric_handler_requests': 'promhttp_metric_handler.requests', # COUNTER + 'promhttp_metric_handler_requests': 'promhttp_metric_handler.requests', 'realtime_postgres_changes_client_subscriptions': 'realtime_postgres_changes.client_subscriptions', 'realtime_postgres_changes_subscriptions': 'realtime_postgres_changes.total_subscriptions', 'storage_storage_size_mb': 'storage.storage_size', - 'supabase_usage_metrics_user_queries': 'usage_metrics.user_queries', # COUNTER + 'supabase_usage_metrics_user_queries': 'usage_metrics.user_queries', } -STORAGE_API_METRICS = [{ - 'storage_api_upload_started': 'upload_started', - 'storage_api_upload_success': 'upload_success', - 'storage_api_database_query_performance': 'database_query_performance', - 'storage_api_queue_job_scheduled_time': 'queue.job_scheduled_time', - 'storage_api_qeue_job_scheduled': 'queue.job_scheduled', - 'storage_api_queue_job_completed': 'queue.job_completed', - 'storage_api_queue_job_retry_failed': 'queue.job_retry_failed', - 'storage_api_queue_job_error': 'queue.job_error', - 'storage_api_s3_upload_part': 's3_upload_part', - 'storage_api_db_pool': 'db_pool', - 'storage_api_db_connections': 'db_connections', - 'storage_api_http_pool_busy_sockets': 'http_pool.busy_sockets', - 'storage_api_http_pool_free_sockets': 'http_pool.free_sockets', - 'storage_api_http_pool_requests': 'http_pool.requests', - 'storage_api_http_pool_errors': 'http_pool.errors', - 'storage_api_http_request_duration_seconds': 'http_request.duration_seconds', - 'storage_api_process_cpu_user_seconds': 'process_cpu_user_seconds', - 'storage_api_process_cpu_system_seconds': 'process_cpu.system.seconds', - 'storage_api_process_start_time_seconds': { - 'name': 'process.uptime.seconds', - 'type': 'time_elapsed', - }, - 'storage_api_process_resident_memory_bytes': 'process.resident_memory.bytes', - 'storage_api_process_virtual_memory_bytes': 'process.virtual_memory.bytes', - 'storage_api_process_heap_bytes': 'process.heap_bytes', - 'storage_api_process_open_fds': 'process.open_fds', - 'storage_api_process_max_fds': 'process.max_fds', - 'storage_api_nodejs_eventloop_lag_seconds': 'nodejs.eventloop_lag.seconds', - 'storage_api_nodejs_eventloop_lag_min_seconds': 'nodejs_eventloop_lag.min_seconds', - 'storage_api_nodejs_eventloop_lag_max_seconds': 'nodejs.eventloop_lag.max_seconds', - 'storage_api_nodejs_eventloop_lag_mean_seconds': 'nodejs.eventloop_lag.mean_seconds', - 'storage_api_nodejs_eventloop_lag_stddev_seconds': 'nodejs.eventloop_lag.stddev_seconds', - 'storage_api_nodejs_eventloop_lag_p50_seconds': 'nodejs.eventloop_lag.p50_seconds', - 'storage_api_nodejs_eventloop_lag_p90_seconds': 'nodejs.eventloop_lag.p90_seconds', - 'storage_api_nodejs_eventloop_lag_p99_seconds': 'nodejs.eventloop_lag.p99_seconds', - 'storage_api_nodejs_active_resources': 'nodejs.active_resources', - 'storage_api_nodejs_active_resources_total': 'nodejs.active_resources.total', - 'storage_api_nodejs_active_handles': 'nodejs.active_handles', - 'storage_api_nodejs_active_handles_total': 'nodejs.active_handles.total', - 'storage_api_nodejs_active_requests': 'nodejs.active_requests', - 'storage_api_nodejs_active_requests_total': 'nodejs.active_requests.total', - 'storage_api_nodejs_heap_size_total_bytes': 'nodejs.heap_size.total_bytes', - 'storage_api_nodejs_heap_size_used_bytes': 'nodejs.heap_size.used_bytes', - 'storage_api_nodejs_external_memory_bytes': 'nodejs.external_memory.bytes', - 'storage_api_nodejs_heap_space_size_total_bytes': 'nodejs.heap_space_size.total_bytes', - 'storage_api_nodejs_heap_space_size_used_bytes': 'nodejs.heap_space_size.used_bytes', - 'storage_api_nodejs_heap_space_size_available_bytes': 'nodejs.heap_space_size.available_bytes', - 'storage_api_nodejs_version_info': 'nodejs.version_info', -}] +STORAGE_API_METRICS = [ + { + 'storage_api_upload_started': 'upload_started', + 'storage_api_upload_success': 'upload_success', + 'storage_api_database_query_performance': 'database_query_performance', + 'storage_api_queue_job_scheduled_time': 'queue.job_scheduled_time', + 'storage_api_qeue_job_scheduled': 'queue.job_scheduled', + 'storage_api_queue_job_completed': 'queue.job_completed', + 'storage_api_queue_job_retry_failed': 'queue.job_retry_failed', + 'storage_api_queue_job_error': 'queue.job_error', + 'storage_api_s3_upload_part': 's3_upload_part', + 'storage_api_db_pool': 'db_pool', + 'storage_api_db_connections': 'db_connections', + 'storage_api_http_pool_busy_sockets': 'http_pool.busy_sockets', + 'storage_api_http_pool_free_sockets': 'http_pool.free_sockets', + 'storage_api_http_pool_requests': 'http_pool.requests', + 'storage_api_http_pool_errors': 'http_pool.errors', + 'storage_api_http_request_duration_seconds': 'http_request.duration_seconds', + 'storage_api_process_cpu_user_seconds': 'process_cpu_user_seconds', + 'storage_api_process_cpu_system_seconds': 'process_cpu.system.seconds', + 'storage_api_process_start_time_seconds': { + 'name': 'process.uptime.seconds', + 'type': 'time_elapsed', + }, + 'storage_api_process_resident_memory_bytes': 'process.resident_memory.bytes', + 'storage_api_process_virtual_memory_bytes': 'process.virtual_memory.bytes', + 'storage_api_process_heap_bytes': 'process.heap_bytes', + 'storage_api_process_open_fds': 'process.open_fds', + 'storage_api_process_max_fds': 'process.max_fds', + 'storage_api_nodejs_eventloop_lag_seconds': 'nodejs.eventloop_lag.seconds', + 'storage_api_nodejs_eventloop_lag_min_seconds': 'nodejs_eventloop_lag.min_seconds', + 'storage_api_nodejs_eventloop_lag_max_seconds': 'nodejs.eventloop_lag.max_seconds', + 'storage_api_nodejs_eventloop_lag_mean_seconds': 'nodejs.eventloop_lag.mean_seconds', + 'storage_api_nodejs_eventloop_lag_stddev_seconds': 'nodejs.eventloop_lag.stddev_seconds', + 'storage_api_nodejs_eventloop_lag_p50_seconds': 'nodejs.eventloop_lag.p50_seconds', + 'storage_api_nodejs_eventloop_lag_p90_seconds': 'nodejs.eventloop_lag.p90_seconds', + 'storage_api_nodejs_eventloop_lag_p99_seconds': 'nodejs.eventloop_lag.p99_seconds', + 'storage_api_nodejs_active_resources': 'nodejs.active_resources', + 'storage_api_nodejs_active_resources_total': 'nodejs.active_resources.total', + 'storage_api_nodejs_active_handles': 'nodejs.active_handles', + 'storage_api_nodejs_active_handles_total': 'nodejs.active_handles.total', + 'storage_api_nodejs_active_requests': 'nodejs.active_requests', + 'storage_api_nodejs_active_requests_total': 'nodejs.active_requests.total', + 'storage_api_nodejs_heap_size_total_bytes': 'nodejs.heap_size.total_bytes', + 'storage_api_nodejs_heap_size_used_bytes': 'nodejs.heap_size.used_bytes', + 'storage_api_nodejs_external_memory_bytes': 'nodejs.external_memory.bytes', + 'storage_api_nodejs_heap_space_size_total_bytes': 'nodejs.heap_space_size.total_bytes', + 'storage_api_nodejs_heap_space_size_used_bytes': 'nodejs.heap_space_size.used_bytes', + 'storage_api_nodejs_heap_space_size_available_bytes': 'nodejs.heap_space_size.available_bytes', + 'storage_api_nodejs_version_info': 'nodejs.version_info', + } +] RENAME_LABELS_MAP = { 'version': 'component_version', } -SUPABASE_METRICS = [{**DEFAULT_GO_METRICS, **PRIVELEGED_METRICS}] \ No newline at end of file +SUPABASE_METRICS = [{**DEFAULT_GO_METRICS, **PRIVELEGED_METRICS}] diff --git a/supabase/manifest.json b/supabase/manifest.json index fe15d5ce5582c..bac1f886e296f 100644 --- a/supabase/manifest.json +++ b/supabase/manifest.json @@ -43,7 +43,7 @@ } }, "dashboards": { - "": "assets/dashboards/.json" + "Supabase Overview": "assets/dashboards/supabase_overview.json" }, "monitors": {}, "saved_views": {} diff --git a/supabase/tests/common.py b/supabase/tests/common.py index 55908e4917030..adea022e18fcf 100644 --- a/supabase/tests/common.py +++ b/supabase/tests/common.py @@ -288,4 +288,4 @@ def get_fixture_path(filename): 'supabase.storage_api.process.virtual_memory.bytes', 'supabase.storage_api.process_cpu.system.seconds.count', 'supabase.storage_api.process_cpu_user_seconds.count', -] \ No newline at end of file +] diff --git a/supabase/tests/conftest.py b/supabase/tests/conftest.py index 16b7ed8da8df4..ccaed8fc65b94 100644 --- a/supabase/tests/conftest.py +++ b/supabase/tests/conftest.py @@ -27,4 +27,4 @@ def dd_environment(): @pytest.fixture def instance(): - return copy.deepcopy(MOCKED_INSTANCE) \ No newline at end of file + return copy.deepcopy(MOCKED_INSTANCE) diff --git a/supabase/tests/test_e2e.py b/supabase/tests/test_e2e.py index 0a37d001f08d0..3357d5a6d148f 100644 --- a/supabase/tests/test_e2e.py +++ b/supabase/tests/test_e2e.py @@ -10,4 +10,4 @@ def test_e2e_openmetrics_v2(dd_agent_check): aggregator.assert_service_check('supabase.openmetrics.health', ServiceCheck.OK, count=1) aggregator.assert_service_check('supabase.storage_api.openmetrics.health', ServiceCheck.OK, count=1) - assert_service_checks(aggregator) \ No newline at end of file + assert_service_checks(aggregator) diff --git a/supabase/tests/test_unit.py b/supabase/tests/test_unit.py index ea05dba262ce3..774eec9646831 100644 --- a/supabase/tests/test_unit.py +++ b/supabase/tests/test_unit.py @@ -7,7 +7,15 @@ from datadog_checks.dev.utils import get_metadata_metrics from datadog_checks.supabase import SupabaseCheck -from .common import PRIVILEGED_METRICS_NAMESPACE, STORAGE_API_METRICS_NAMESPACE, PRIVILEGED_METRICS_INSTANCE, STORAGE_API_INSTANCE, STORAGE_API_METRICS, PRIVILEGED_METRICS, get_fixture_path +from .common import ( + PRIVILEGED_METRICS, + PRIVILEGED_METRICS_INSTANCE, + PRIVILEGED_METRICS_NAMESPACE, + STORAGE_API_INSTANCE, + STORAGE_API_METRICS, + STORAGE_API_METRICS_NAMESPACE, + get_fixture_path, +) @pytest.mark.parametrize( @@ -17,7 +25,9 @@ (STORAGE_API_METRICS_NAMESPACE, STORAGE_API_INSTANCE, STORAGE_API_METRICS, 'storage_api_metrics.txt'), ], ) -def test_check_mock_supabase_openmetrics(dd_run_check, instance, aggregator, fixture_name, metrics, mock_http_response, namespace): +def test_check_mock_supabase_openmetrics( + dd_run_check, instance, aggregator, fixture_name, metrics, mock_http_response, namespace +): mock_http_response(file_path=get_fixture_path(fixture_name)) check = SupabaseCheck('supabase', {}, [instance]) dd_run_check(check) @@ -30,6 +40,7 @@ def test_check_mock_supabase_openmetrics(dd_run_check, instance, aggregator, fix aggregator.assert_metrics_using_metadata(get_metadata_metrics()) aggregator.assert_service_check(f'{namespace}.openmetrics.health', ServiceCheck.OK) + def test_empty_instance(dd_run_check): with pytest.raises( Exception, @@ -37,4 +48,3 @@ def test_empty_instance(dd_run_check): ): check = SupabaseCheck('supabase', {}, [{}]) dd_run_check(check) -