Skip to content

Commit 6e91a65

Browse files
committed
Added function to inspect contents of the prometheus gauges and counters that have been set up
1 parent e3ec1ae commit 6e91a65

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/murfey/server/api/__init__.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1987,12 +1987,17 @@ def update_current_gain_ref(
19871987
def inspect_prometheus_metrics(
19881988
metric_name: str,
19891989
):
1990+
"""
1991+
A debugging endpoint that returns the current contents of any Prometheus
1992+
gauges and counters that have been set up thus far.
1993+
"""
1994+
19901995
# Extract the Prometheus metric defined in the Prometheus module
19911996
metric: Optional[Counter | Gauge] = getattr(prom, metric_name, None)
19921997
if metric is None or not isinstance(metric, (Counter, Gauge)):
19931998
raise LookupError("No matching metric was found")
19941999

1995-
# Print out contents
2000+
# Package contents into dict and return
19962001
results = {}
19972002
if hasattr(metric, "_metrics"):
19982003
for i, (label_tuple, sub_metric) in enumerate(metric._metrics.items()):

0 commit comments

Comments
 (0)