5
5
6
6
from mcp .server import FastMCP
7
7
8
- from ..client import GrafanaClient
8
+ from ..client import grafana_client
9
9
from ..grafana_types import (
10
10
DatasourceRef ,
11
11
DSQueryResponse ,
@@ -56,7 +56,7 @@ async def query_prometheus(
56
56
expr = expr , # type: ignore
57
57
intervalMs = interval_ms ,
58
58
)
59
- response = await GrafanaClient . for_current_request ().query (start , end , [query ])
59
+ response = await grafana_client . get ().query (start , end , [query ])
60
60
return DSQueryResponse .model_validate_json (response )
61
61
62
62
@@ -81,13 +81,11 @@ async def list_prometheus_metric_metadata(
81
81
82
82
A mapping from metric name to all available metadata for that metric.
83
83
"""
84
- response = (
85
- await GrafanaClient .for_current_request ().list_prometheus_metric_metadata (
86
- datasource_uid ,
87
- limit = limit ,
88
- limit_per_metric = limit_per_metric ,
89
- metric = metric ,
90
- )
84
+ response = await grafana_client .get ().list_prometheus_metric_metadata (
85
+ datasource_uid ,
86
+ limit = limit ,
87
+ limit_per_metric = limit_per_metric ,
88
+ metric = metric ,
91
89
)
92
90
return (
93
91
ResponseWrapper [dict [str , list [PrometheusMetricMetadata ]]]
@@ -146,7 +144,7 @@ async def list_prometheus_label_names(
146
144
end: Optionally, the end time of the time range to filter the results by.
147
145
limit: Optionally, the maximum number of results to return. Defaults to 100.
148
146
"""
149
- response = await GrafanaClient . for_current_request ().list_prometheus_label_names (
147
+ response = await grafana_client . get ().list_prometheus_label_names (
150
148
datasource_uid ,
151
149
matches = matches ,
152
150
start = start ,
@@ -176,7 +174,7 @@ async def list_prometheus_label_values(
176
174
end: Optionally, the end time of the query.
177
175
limit: Optionally, the maximum number of results to return. Defaults to 100.
178
176
"""
179
- response = await GrafanaClient . for_current_request ().list_prometheus_label_values (
177
+ response = await grafana_client . get ().list_prometheus_label_values (
180
178
datasource_uid ,
181
179
label_name ,
182
180
matches = matches ,
0 commit comments