fix: bugs

This commit is contained in:
Inex Code 2024-07-29 18:58:55 +03:00
parent ab4920dd3a
commit 36c685eaf2
2 changed files with 29 additions and 15 deletions

View file

@ -8,6 +8,7 @@ DEFAULT_SUBDOMAINS = {
"pleroma": "social", "pleroma": "social",
"roundcube": "roundcube", "roundcube": "roundcube",
"testservice": "test", "testservice": "test",
"prometheus": "",
} }
RESERVED_SUBDOMAINS = [ RESERVED_SUBDOMAINS = [

View file

@ -124,6 +124,19 @@ class MonitoringQueries:
def _prometheus_response_to_monitoring_metrics( def _prometheus_response_to_monitoring_metrics(
response: dict, id_key: str, clean_id: bool = False response: dict, id_key: str, clean_id: bool = False
) -> List[MonitoringMetric]: ) -> List[MonitoringMetric]:
if response["resultType"] == "vector":
return list(
map(
lambda x: MonitoringMetric(
id=MonitoringQueries._clean_slice_id(
x["metric"][id_key], clean_id=clean_id
),
values=[MonitoringQueries._prometheus_value_to_monitoring_value(x["value"])],
),
response["result"],
)
)
else:
return list( return list(
map( map(
lambda x: MonitoringMetric( lambda x: MonitoringMetric(
@ -400,6 +413,6 @@ class MonitoringQueries:
return MonitoringMetrics( return MonitoringMetrics(
metrics=MonitoringQueries._prometheus_response_to_monitoring_metrics( metrics=MonitoringQueries._prometheus_response_to_monitoring_metrics(
data, "directon" data, "direction"
) )
) )