mirror of
https://git.selfprivacy.org/SelfPrivacy/selfprivacy-rest-api.git
synced 2024-11-22 04:01:27 +00:00
fix: bugs
This commit is contained in:
parent
ab4920dd3a
commit
36c685eaf2
|
@ -8,6 +8,7 @@ DEFAULT_SUBDOMAINS = {
|
||||||
"pleroma": "social",
|
"pleroma": "social",
|
||||||
"roundcube": "roundcube",
|
"roundcube": "roundcube",
|
||||||
"testservice": "test",
|
"testservice": "test",
|
||||||
|
"prometheus": "",
|
||||||
}
|
}
|
||||||
|
|
||||||
RESERVED_SUBDOMAINS = [
|
RESERVED_SUBDOMAINS = [
|
||||||
|
|
|
@ -124,22 +124,35 @@ 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]:
|
||||||
return list(
|
if response["resultType"] == "vector":
|
||||||
map(
|
return list(
|
||||||
lambda x: MonitoringMetric(
|
map(
|
||||||
id=MonitoringQueries._clean_slice_id(
|
lambda x: MonitoringMetric(
|
||||||
x["metric"][id_key], clean_id=clean_id
|
id=MonitoringQueries._clean_slice_id(
|
||||||
|
x["metric"][id_key], clean_id=clean_id
|
||||||
|
),
|
||||||
|
values=[MonitoringQueries._prometheus_value_to_monitoring_value(x["value"])],
|
||||||
),
|
),
|
||||||
values=list(
|
response["result"],
|
||||||
map(
|
)
|
||||||
MonitoringQueries._prometheus_value_to_monitoring_value,
|
)
|
||||||
x["values"],
|
else:
|
||||||
)
|
return list(
|
||||||
),
|
map(
|
||||||
),
|
lambda x: MonitoringMetric(
|
||||||
response["result"],
|
id=MonitoringQueries._clean_slice_id(
|
||||||
|
x["metric"][id_key], clean_id=clean_id
|
||||||
|
),
|
||||||
|
values=list(
|
||||||
|
map(
|
||||||
|
MonitoringQueries._prometheus_value_to_monitoring_value,
|
||||||
|
x["values"],
|
||||||
|
)
|
||||||
|
),
|
||||||
|
),
|
||||||
|
response["result"],
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _calculate_offset_and_duration(
|
def _calculate_offset_and_duration(
|
||||||
|
@ -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"
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue