Skip to content
Snippets Groups Projects

Draft: Added prometheus metrics

Closed Jan David Mol requested to merge add-prometheus-metrics into main
1 file
+ 10
0
Compare changes
  • Side-by-side
  • Inline
+ 10
0
@@ -8,6 +8,8 @@ from unittest.mock import patch, ANY, create_autospec
from minio import Minio
from prometheus_client.registry import REGISTRY
from lofar_stingray.writer import Block, Storage
@@ -17,6 +19,14 @@ class TestStorage(TestCase):
def setUp(self):
self.mock_minio = create_autospec(Minio)
# Clear all metrics to make sure we don't register the same one twice
# between tests (the library forbids it).
#
# Unfortunately, Metrics draw copies of prometheus_client.registry.REGISTRY,
# and that does not provide a public interface to query the registered collectors.
for collector in list(REGISTRY._collector_to_names.keys()):
REGISTRY.unregister(collector)
def test_create_bucket_if_not_exists(self):
"""Test if bucket is created if not exists"""
self.mock_minio.bucket_exists.return_value = False
Loading