Commit 5c46d1c3 authored by Andrey Vertiprahov's avatar Andrey Vertiprahov
Browse files

Merge branch 'fix-avs-chreportdatasource' into 'master'

Fix ts field on CHTableReportDataSource.

See merge request !5450
parents 8ef10a8e 5f0c3075
Pipeline #32152 passed with stages
in 73 minutes and 49 seconds
...@@ -404,6 +404,7 @@ class CHTableReportDataSource(ReportDataSource): ...@@ -404,6 +404,7 @@ class CHTableReportDataSource(ReportDataSource):
CHUNK_SIZE = 5000 CHUNK_SIZE = 5000
TABLE_NAME = None TABLE_NAME = None
object_field = "sa.ManagedObject" object_field = "sa.ManagedObject"
ts_field = "ts"
def get_client(self): def get_client(self):
if not hasattr(self, "_client"): if not hasattr(self, "_client"):
...@@ -476,7 +477,7 @@ class CHTableReportDataSource(ReportDataSource): ...@@ -476,7 +477,7 @@ class CHTableReportDataSource(ReportDataSource):
"q_select": select or [], "q_select": select or [],
"q_group": group or [], "q_group": group or [],
"q_where": [ "q_where": [
f"(date >= toDate({ts_from_date})) AND (ts >= toDateTime({ts_from_date}) AND ts <= toDateTime({ts_to_date})) %s", # objectids_filter f"(date >= toDate({ts_from_date})) AND ({self.ts_field} >= toDateTime({ts_from_date}) AND {self.ts_field} <= toDateTime({ts_to_date})) %s", # objectids_filter
], ],
} }
......
...@@ -12,6 +12,8 @@ from .base import CHTableReportDataSource, ReportField ...@@ -12,6 +12,8 @@ from .base import CHTableReportDataSource, ReportField
class ReportInterfaceMetrics(CHTableReportDataSource): class ReportInterfaceMetrics(CHTableReportDataSource):
name = "reportinterfacemetrics" name = "reportinterfacemetrics"
description = "Query Metrics from Interface table" description = "Query Metrics from Interface table"
object_field = "managed_object"
CHUNK_SIZE = 1500
TABLE_NAME = "noc.interface" TABLE_NAME = "noc.interface"
FIELDS = [ FIELDS = [
...@@ -61,6 +63,13 @@ class ReportInterfaceMetrics(CHTableReportDataSource): ...@@ -61,6 +63,13 @@ class ReportInterfaceMetrics(CHTableReportDataSource):
unit="BIT/S", unit="BIT/S",
metric_name="round(quantile(0.90)(load_in), 0)", metric_name="round(quantile(0.90)(load_in), 0)",
), ),
ReportField(
name="load_in_avg",
label="Load In (Average)",
description="",
unit="BIT/S",
metric_name="round(avg(load_in), 0)",
),
ReportField( ReportField(
name="load_in_p", name="load_in_p",
label="Load In (% Bandwith)", label="Load In (% Bandwith)",
...@@ -75,6 +84,13 @@ class ReportInterfaceMetrics(CHTableReportDataSource): ...@@ -75,6 +84,13 @@ class ReportInterfaceMetrics(CHTableReportDataSource):
unit="BIT/S", unit="BIT/S",
metric_name="round(quantile(0.90)(load_out), 0)", metric_name="round(quantile(0.90)(load_out), 0)",
), ),
ReportField(
name="load_out_avg",
label="Load Out (Average)",
description="",
unit="BIT/S",
metric_name="round(avg(load_out), 0)",
),
ReportField( ReportField(
name="load_out_p", name="load_out_p",
label="Load Out (% Bandwith)", label="Load Out (% Bandwith)",
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment