Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
noc
noc
Commits
5c46d1c3
Commit
5c46d1c3
authored
Jun 10, 2021
by
Andrey Vertiprahov
Browse files
Merge branch 'fix-avs-chreportdatasource' into 'master'
Fix ts field on CHTableReportDataSource. See merge request
noc/noc!5450
parents
8ef10a8e
5f0c3075
Pipeline
#32152
passed with stages
in 73 minutes and 49 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
lib/app/reportdatasources/base.py
View file @
5c46d1c3
...
...
@@ -404,6 +404,7 @@ class CHTableReportDataSource(ReportDataSource):
CHUNK_SIZE
=
5000
TABLE_NAME
=
None
object_field
=
"sa.ManagedObject"
ts_field
=
"ts"
def
get_client
(
self
):
if
not
hasattr
(
self
,
"_client"
):
...
...
@@ -476,7 +477,7 @@ class CHTableReportDataSource(ReportDataSource):
"q_select"
:
select
or
[],
"q_group"
:
group
or
[],
"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
],
}
...
...
lib/app/reportdatasources/reportinterfacemetrics.py
View file @
5c46d1c3
...
...
@@ -12,6 +12,8 @@ from .base import CHTableReportDataSource, ReportField
class
ReportInterfaceMetrics
(
CHTableReportDataSource
):
name
=
"reportinterfacemetrics"
description
=
"Query Metrics from Interface table"
object_field
=
"managed_object"
CHUNK_SIZE
=
1500
TABLE_NAME
=
"noc.interface"
FIELDS
=
[
...
...
@@ -61,6 +63,13 @@ class ReportInterfaceMetrics(CHTableReportDataSource):
unit
=
"BIT/S"
,
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
(
name
=
"load_in_p"
,
label
=
"Load In (% Bandwith)"
,
...
...
@@ -75,6 +84,13 @@ class ReportInterfaceMetrics(CHTableReportDataSource):
unit
=
"BIT/S"
,
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
(
name
=
"load_out_p"
,
label
=
"Load Out (% Bandwith)"
,
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment