Skip to content

Commit c6aef7e

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent bf77008 commit c6aef7e

4 files changed

Lines changed: 9 additions & 15 deletions

File tree

examples/prometheus_exporter_example.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""Demonstration of Prometheus metrics exporter for cachier.
22
3-
This example shows how to export cachier metrics to Prometheus for monitoring.
4-
The exporter can work with or without the prometheus_client library.
3+
This example shows how to export cachier metrics to Prometheus for monitoring. The exporter can work with or without the
4+
prometheus_client library.
55
66
"""
77

src/cachier/exporters/base.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
class MetricsExporter(metaclass=abc.ABCMeta):
1414
"""Abstract base class for metrics exporters.
1515
16-
Exporters collect metrics from cached functions and export them to
17-
monitoring systems like Prometheus, StatsD, CloudWatch, etc.
16+
Exporters collect metrics from cached functions and export them to monitoring systems like Prometheus, StatsD,
17+
CloudWatch, etc.
1818
1919
"""
2020

src/cachier/exporters/prometheus.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,7 @@ def __init__(
8686
self._setup_collector()
8787

8888
def _setup_collector(self) -> None:
89-
"""Set up a custom collector to pull metrics from registered
90-
functions.
91-
"""
89+
"""Set up a custom collector to pull metrics from registered functions."""
9290
if not self._prom_client:
9391
return
9492

@@ -103,9 +101,7 @@ def _setup_collector(self) -> None:
103101
return
104102

105103
class CachierCollector:
106-
"""Custom Prometheus collector that pulls metrics from registered
107-
functions.
108-
"""
104+
"""Custom Prometheus collector that pulls metrics from registered functions."""
109105

110106
def __init__(self, exporter):
111107
self.exporter = exporter
@@ -371,8 +367,8 @@ def _generate_text_metrics(self) -> str:
371367
def start(self) -> None:
372368
"""Start the Prometheus exporter.
373369
374-
If prometheus_client is available, starts the HTTP server. Otherwise,
375-
provides a simple HTTP server for text format metrics.
370+
If prometheus_client is available, starts the HTTP server. Otherwise, provides a simple HTTP server for text
371+
format metrics.
376372
377373
"""
378374
if self._prom_client:

tests/test_exporters.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,7 @@ def test_metrics_exporter_interface():
121121

122122
@pytest.mark.memory
123123
def test_prometheus_exporter_with_prometheus_client_fallback():
124-
"""Test PrometheusExporter with use_prometheus_client=True falls back
125-
gracefully.
126-
"""
124+
"""Test PrometheusExporter with use_prometheus_client=True falls back gracefully."""
127125

128126
# When prometheus_client is not available, it should fall back to text mode
129127
@cachier(backend="memory", enable_metrics=True)

0 commit comments

Comments
 (0)