Skip to content

Commit f3ea7c0

Browse files
author
Davide Schiera
committed
Timestamp metric is no longer explicitly passed by caller for time series panel.
1 parent 5f340c0 commit f3ea7c0

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

examples/dashboard.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@
6060
panel_name = 'CPU Over Time'
6161
panel_type = 'timeSeries'
6262
metrics = [
63-
{ 'id': 'timestamp' },
6463
{ 'id': 'kubernetes.pod.name' },
6564
{ 'id': 'cpu.used.percent', 'aggregations': { 'time': 'avg', 'group': 'avg' } }
6665
]

sdcclient/_client.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,17 @@ def add_dashboard_panel(self, dashboard, name, type, metrics, scope=None, sort_b
391391
}
392392
}
393393

394+
if type == 'timeSeries':
395+
#
396+
# In case of a time series, the current dashboard implementation
397+
# requires the timestamp to be explicitly specified as "key".
398+
# However, this function uses the same abstraction of the data API
399+
# that doesn't require to specify a timestamp key (you only need to
400+
# specify time window and sampling)
401+
#
402+
metrics = copy.copy(metrics)
403+
metrics.insert(0, { 'id': 'timestamp' })
404+
394405
#
395406
# Convert list of metrics to format used by Sysdig Cloud
396407
#

0 commit comments

Comments
 (0)