From 0015183a7b66930b1be2ee80f94df345579b28fa Mon Sep 17 00:00:00 2001 From: Tom Wilkie Date: Fri, 17 Nov 2017 17:21:49 +0000 Subject: [PATCH 01/17] Don't import JSON dashboards from hidden directories. --- pkg/services/search/json_index.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkg/services/search/json_index.go b/pkg/services/search/json_index.go index 79c238b27f9..bcda432e343 100644 --- a/pkg/services/search/json_index.go +++ b/pkg/services/search/json_index.go @@ -90,6 +90,9 @@ func (index *JsonDashIndex) updateIndex() error { return err } if f.IsDir() { + if strings.HasPrefix(f.Name(), ".") { + return filepath.SkipDir + } return nil } From c1e5f5be8702fb840e002c26be62c5226f67a9be Mon Sep 17 00:00:00 2001 From: Maytee Chinavanichkit Date: Mon, 20 Nov 2017 18:00:56 +0900 Subject: [PATCH 02/17] Use correct moments format for Showing last us time instead of value test (#9923) Fixes this issue: PhantomJS 2.1.1 (Mac OS X 0.0.0) SingleStatCtrl showing last us time instead of value should set formatted value FAILED expected '09/17/2017 4:56:37 pm' to equal '09/17/2017 16:56:37 pm' --- public/app/plugins/panel/singlestat/specs/singlestat_specs.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/app/plugins/panel/singlestat/specs/singlestat_specs.ts b/public/app/plugins/panel/singlestat/specs/singlestat_specs.ts index cf74cfbd150..e7ba5aa15a4 100644 --- a/public/app/plugins/panel/singlestat/specs/singlestat_specs.ts +++ b/public/app/plugins/panel/singlestat/specs/singlestat_specs.ts @@ -104,7 +104,7 @@ describe('SingleStatCtrl', function() { }); it('should set formatted value', function() { - expect(ctx.data.valueFormatted).to.be(moment(1505634997920).format('MM/DD/YYYY H:mm:ss a')); + expect(ctx.data.valueFormatted).to.be(moment(1505634997920).format('MM/DD/YYYY h:mm:ss a')); }); }); From 66e4297816fb1eb0c45894e5ebd8e2b2141b6166 Mon Sep 17 00:00:00 2001 From: Patrick O'Carroll Date: Mon, 20 Nov 2017 10:05:18 +0100 Subject: [PATCH 03/17] changed padding to pixels, fixes #9916 (#9924) --- public/sass/components/_panel_graph.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/sass/components/_panel_graph.scss b/public/sass/components/_panel_graph.scss index 247ed1e94cc..c92e5a0d3d0 100644 --- a/public/sass/components/_panel_graph.scss +++ b/public/sass/components/_panel_graph.scss @@ -280,7 +280,7 @@ .graph-annotation__header { background-color: $popover-border-color; - padding: 0.40rem 0.65rem; + padding: 6px 10px; display: flex; } From f54547776d0943d4a2fd356bee1e86c2405e8dd0 Mon Sep 17 00:00:00 2001 From: Alexander Zobnin Date: Mon, 20 Nov 2017 12:06:34 +0300 Subject: [PATCH 04/17] graph: disable zoom in non-timeseries modes (#9914) --- public/app/plugins/panel/graph/graph.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/public/app/plugins/panel/graph/graph.ts b/public/app/plugins/panel/graph/graph.ts index 82bad53164c..f8567d02fad 100755 --- a/public/app/plugins/panel/graph/graph.ts +++ b/public/app/plugins/panel/graph/graph.ts @@ -688,7 +688,14 @@ function graphDirective($rootScope, timeSrv, popoverSrv, contextSrv) { } elem.bind("plotselected", function (event, ranges) { + if (panel.xaxis.mode !== 'time') { + // Skip if panel in histogram or series mode + plot.clearSelection(); + return; + } + if ((ranges.ctrlKey || ranges.metaKey) && contextSrv.isEditor) { + // Add annotation setTimeout(() => { eventManager.updateTime(ranges.xaxis); }, 100); @@ -703,6 +710,11 @@ function graphDirective($rootScope, timeSrv, popoverSrv, contextSrv) { }); elem.bind("plotclick", function (event, pos, item) { + if (panel.xaxis.mode !== 'time') { + // Skip if panel in histogram or series mode + return; + } + if ((pos.ctrlKey || pos.metaKey) && contextSrv.isEditor) { // Skip if range selected (added in "plotselected" event handler) let isRangeSelection = pos.x !== pos.x1; From b1de1e6f26fffd13aabf0b380754eecc0d8347f1 Mon Sep 17 00:00:00 2001 From: Ryan McKinley Date: Mon, 20 Nov 2017 11:27:18 +0100 Subject: [PATCH 05/17] Move the loading flag to PanelCtrl (#9929) --- public/app/features/panel/metrics_panel_ctrl.ts | 1 - public/app/features/panel/panel_ctrl.ts | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/public/app/features/panel/metrics_panel_ctrl.ts b/public/app/features/panel/metrics_panel_ctrl.ts index c139f5c8313..f85a9f4562a 100644 --- a/public/app/features/panel/metrics_panel_ctrl.ts +++ b/public/app/features/panel/metrics_panel_ctrl.ts @@ -11,7 +11,6 @@ import {metricsTabDirective} from './metrics_tab'; class MetricsPanelCtrl extends PanelCtrl { scope: any; - loading: boolean; datasource: any; datasourceName: any; $q: any; diff --git a/public/app/features/panel/panel_ctrl.ts b/public/app/features/panel/panel_ctrl.ts index 34574bdb476..16e2e69b1fb 100644 --- a/public/app/features/panel/panel_ctrl.ts +++ b/public/app/features/panel/panel_ctrl.ts @@ -31,6 +31,7 @@ export class PanelCtrl { containerHeight: any; events: Emitter; timing: any; + loading: boolean; constructor($scope, $injector) { this.$injector = $injector; From 59cebca4b2694c562264f1b7e635dbb06851d0d0 Mon Sep 17 00:00:00 2001 From: Patrick O'Carroll Date: Mon, 20 Nov 2017 14:31:51 +0100 Subject: [PATCH 06/17] converted influx-series to TS, converted test to jest --- .../datasource/influxdb/influx_series.d.ts | 2 - .../{influx_series.js => influx_series.ts} | 73 ++++++++------- ..._series_specs.ts => influx_series.jest.ts} | 93 +++++++++---------- 3 files changed, 83 insertions(+), 85 deletions(-) delete mode 100644 public/app/plugins/datasource/influxdb/influx_series.d.ts rename public/app/plugins/datasource/influxdb/{influx_series.js => influx_series.ts} (75%) rename public/app/plugins/datasource/influxdb/specs/{influx_series_specs.ts => influx_series.jest.ts} (66%) diff --git a/public/app/plugins/datasource/influxdb/influx_series.d.ts b/public/app/plugins/datasource/influxdb/influx_series.d.ts deleted file mode 100644 index c3318b8e133..00000000000 --- a/public/app/plugins/datasource/influxdb/influx_series.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare var test: any; -export default test; diff --git a/public/app/plugins/datasource/influxdb/influx_series.js b/public/app/plugins/datasource/influxdb/influx_series.ts similarity index 75% rename from public/app/plugins/datasource/influxdb/influx_series.js rename to public/app/plugins/datasource/influxdb/influx_series.ts index 6d35b020075..e17e83026e7 100644 --- a/public/app/plugins/datasource/influxdb/influx_series.js +++ b/public/app/plugins/datasource/influxdb/influx_series.ts @@ -1,28 +1,27 @@ -define([ - 'lodash', - 'app/core/table_model', -], -function (_, TableModel) { - 'use strict'; +import _ from 'lodash'; +import TableModel from 'app/core/table_model'; - function InfluxSeries(options) { +export default class InfluxSeries { + + series: any; + alias: any; + annotation: any; + + constructor(options) { this.series = options.series; this.alias = options.alias; this.annotation = options.annotation; } - var p = InfluxSeries.prototype; - - p.getTimeSeries = function() { + getTimeSeries() { var output = []; - var self = this; var i, j; - if (self.series.length === 0) { + if (this.series.length === 0) { return output; } - _.each(self.series, function(series) { + _.each(this.series, (series) => { var columns = series.columns.length; var tags = _.map(series.tags, function(value, key) { return key + ': ' + value; @@ -35,8 +34,8 @@ function (_, TableModel) { seriesName = seriesName + '.' + columnName; } - if (self.alias) { - seriesName = self._getSeriesName(series, j); + if (this.alias) { + seriesName = this._getSeriesName(series, j); } else if (series.tags) { seriesName = seriesName + ' {' + tags.join(', ') + '}'; } @@ -53,9 +52,9 @@ function (_, TableModel) { }); return output; - }; + } - p._getSeriesName = function(series, index) { + _getSeriesName(series, index) { var regex = /\$(\w+)|\[\[([\s\S]+?)\]\]/g; var segments = series.name.split('.'); @@ -72,30 +71,29 @@ function (_, TableModel) { if (!series.tags) { return match; } return series.tags[tag]; }); - }; + } - p.getAnnotations = function () { + getAnnotations() { var list = []; - var self = this; - _.each(this.series, function (series) { + _.each(this.series, (series) => { var titleCol = null; var timeCol = null; var tagsCol = []; var textCol = null; - _.each(series.columns, function(column, index) { + _.each(series.columns, (column, index) => { if (column === 'time') { timeCol = index; return; } if (column === 'sequence_number') { return; } if (!titleCol) { titleCol = index; } - if (column === self.annotation.titleColumn) { titleCol = index; return; } - if (_.includes((self.annotation.tagsColumn || '').replace(' ', '').split(","), column)) { tagsCol.push(index); return; } - if (column === self.annotation.textColumn) { textCol = index; return; } + if (column === this.annotation.titleColumn) { titleCol = index; return; } + if (_.includes((this.annotation.tagsColumn || '').replace(' ', '').split(","), column)) { tagsCol.push(index); return; } + if (column === this.annotation.textColumn) { textCol = index; return; } }); - _.each(series.values, function (value) { + _.each(series.values, (value) => { var data = { - annotation: self.annotation, + annotation: this.annotation, time: + new Date(value[timeCol]), title: value[titleCol], // Remove empty values, then split in different tags for comma separated values @@ -108,18 +106,17 @@ function (_, TableModel) { }); return list; - }; + } - p.getTable = function() { - var table = new TableModel.default(); - var self = this; + getTable() { + var table = new TableModel(); var i, j; - if (self.series.length === 0) { + if (this.series.length === 0) { return table; } - _.each(self.series, function(series, seriesIndex) { + _.each(this.series, (series, seriesIndex) => { if (seriesIndex === 0) { table.columns.push({text: 'Time', type: 'time'}); @@ -151,7 +148,11 @@ function (_, TableModel) { }); return table; - }; + } +} + + + + + - return InfluxSeries; -}); diff --git a/public/app/plugins/datasource/influxdb/specs/influx_series_specs.ts b/public/app/plugins/datasource/influxdb/specs/influx_series.jest.ts similarity index 66% rename from public/app/plugins/datasource/influxdb/specs/influx_series_specs.ts rename to public/app/plugins/datasource/influxdb/specs/influx_series.jest.ts index ef0a742528f..99bfac107e7 100644 --- a/public/app/plugins/datasource/influxdb/specs/influx_series_specs.ts +++ b/public/app/plugins/datasource/influxdb/specs/influx_series.jest.ts @@ -1,4 +1,3 @@ -import {describe, it, expect} from 'test/lib/common'; import InfluxSeries from '../influx_series'; describe('when generating timeseries from influxdb response', function() { @@ -19,24 +18,24 @@ describe('when generating timeseries from influxdb response', function() { var series = new InfluxSeries(options); var result = series.getTimeSeries(); - expect(result.length).to.be(3); - expect(result[0].target).to.be('cpu.mean {app: test, server: server1}'); - expect(result[0].datapoints[0][0]).to.be(10); - expect(result[0].datapoints[0][1]).to.be(1431946625000); - expect(result[0].datapoints[1][0]).to.be(20); - expect(result[0].datapoints[1][1]).to.be(1431946626000); + expect(result.length).toBe(3); + expect(result[0].target).toBe('cpu.mean {app: test, server: server1}'); + expect(result[0].datapoints[0][0]).toBe(10); + expect(result[0].datapoints[0][1]).toBe(1431946625000); + expect(result[0].datapoints[1][0]).toBe(20); + expect(result[0].datapoints[1][1]).toBe(1431946626000); - expect(result[1].target).to.be('cpu.max {app: test, server: server1}'); - expect(result[1].datapoints[0][0]).to.be(11); - expect(result[1].datapoints[0][1]).to.be(1431946625000); - expect(result[1].datapoints[1][0]).to.be(21); - expect(result[1].datapoints[1][1]).to.be(1431946626000); + expect(result[1].target).toBe('cpu.max {app: test, server: server1}'); + expect(result[1].datapoints[0][0]).toBe(11); + expect(result[1].datapoints[0][1]).toBe(1431946625000); + expect(result[1].datapoints[1][0]).toBe(21); + expect(result[1].datapoints[1][1]).toBe(1431946626000); - expect(result[2].target).to.be('cpu.min {app: test, server: server1}'); - expect(result[2].datapoints[0][0]).to.be(9); - expect(result[2].datapoints[0][1]).to.be(1431946625000); - expect(result[2].datapoints[1][0]).to.be(19); - expect(result[2].datapoints[1][1]).to.be(1431946626000); + expect(result[2].target).toBe('cpu.min {app: test, server: server1}'); + expect(result[2].datapoints[0][0]).toBe(9); + expect(result[2].datapoints[0][1]).toBe(1431946625000); + expect(result[2].datapoints[1][0]).toBe(19); + expect(result[2].datapoints[1][1]).toBe(1431946626000); }); }); @@ -47,9 +46,9 @@ describe('when generating timeseries from influxdb response', function() { var series = new InfluxSeries(options); var result = series.getTimeSeries(); - expect(result[0].target).to.be('new series'); - expect(result[1].target).to.be('new series'); - expect(result[2].target).to.be('new series'); + expect(result[0].target).toBe('new series'); + expect(result[1].target).toBe('new series'); + expect(result[2].target).toBe('new series'); }); }); @@ -60,9 +59,9 @@ describe('when generating timeseries from influxdb response', function() { var series = new InfluxSeries(options); var result = series.getTimeSeries(); - expect(result[0].target).to.be('alias: cpu -> server1 (cpu)'); - expect(result[1].target).to.be('alias: cpu -> server1 (cpu)'); - expect(result[2].target).to.be('alias: cpu -> server1 (cpu)'); + expect(result[0].target).toBe('alias: cpu -> server1 (cpu)'); + expect(result[1].target).toBe('alias: cpu -> server1 (cpu)'); + expect(result[2].target).toBe('alias: cpu -> server1 (cpu)'); }); }); @@ -90,8 +89,8 @@ describe('when generating timeseries from influxdb response', function() { var series = new InfluxSeries(options); var result = series.getTimeSeries(); - expect(result[0].target).to.be('cpu {app: test, server: server1}'); - expect(result[1].target).to.be('cpu {app: test2, server: server2}'); + expect(result[0].target).toBe('cpu {app: test, server: server1}'); + expect(result[1].target).toBe('cpu {app: test2, server: server2}'); }); }); @@ -122,18 +121,18 @@ describe('when generating timeseries from influxdb response', function() { var series = new InfluxSeries(options); var result = series.getTimeSeries(); - expect(result.length).to.be(2); - expect(result[0].target).to.be('cpu.mean {app: test, server: server1}'); - expect(result[0].datapoints[0][0]).to.be(10); - expect(result[0].datapoints[0][1]).to.be(1431946625000); - expect(result[0].datapoints[1][0]).to.be(12); - expect(result[0].datapoints[1][1]).to.be(1431946626000); + expect(result.length).toBe(2); + expect(result[0].target).toBe('cpu.mean {app: test, server: server1}'); + expect(result[0].datapoints[0][0]).toBe(10); + expect(result[0].datapoints[0][1]).toBe(1431946625000); + expect(result[0].datapoints[1][0]).toBe(12); + expect(result[0].datapoints[1][1]).toBe(1431946626000); - expect(result[1].target).to.be('cpu.mean {app: test2, server: server2}'); - expect(result[1].datapoints[0][0]).to.be(15); - expect(result[1].datapoints[0][1]).to.be(1431946625000); - expect(result[1].datapoints[1][0]).to.be(16); - expect(result[1].datapoints[1][1]).to.be(1431946626000); + expect(result[1].target).toBe('cpu.mean {app: test2, server: server2}'); + expect(result[1].datapoints[0][0]).toBe(15); + expect(result[1].datapoints[0][1]).toBe(1431946625000); + expect(result[1].datapoints[1][0]).toBe(16); + expect(result[1].datapoints[1][1]).toBe(1431946626000); }); }); @@ -143,7 +142,7 @@ describe('when generating timeseries from influxdb response', function() { var series = new InfluxSeries(options); var result = series.getTimeSeries(); - expect(result[0].target).to.be('new series'); + expect(result[0].target).toBe('new series'); }); }); @@ -154,8 +153,8 @@ describe('when generating timeseries from influxdb response', function() { var series = new InfluxSeries(options); var result = series.getTimeSeries(); - expect(result[0].target).to.be('alias: cpu -> server1 (cpu)'); - expect(result[1].target).to.be('alias: cpu -> server2 (cpu)'); + expect(result[0].target).toBe('alias: cpu -> server1 (cpu)'); + expect(result[1].target).toBe('alias: cpu -> server2 (cpu)'); }); }); @@ -180,7 +179,7 @@ describe('when generating timeseries from influxdb response', function() { var series = new InfluxSeries(options); var result = series.getTimeSeries(); - expect(result[0].target).to.be('alias: prod -> count'); + expect(result[0].target).toBe('alias: prod -> count'); }); }); @@ -201,9 +200,9 @@ describe('when generating timeseries from influxdb response', function() { var series = new InfluxSeries(options); var table = series.getTable(); - expect(table.type).to.be('table'); - expect(table.columns.length).to.be(5); - expect(table.rows[0]).to.eql([1431946625000, 'Africa', 'server2', 23, 10]); + expect(table.type).toBe('table'); + expect(table.columns.length).toBe(5); + expect(table.rows[0]).toEqual([1431946625000, 'Africa', 'server2', 23, 10]); }); }); @@ -228,7 +227,7 @@ describe('when generating timeseries from influxdb response', function() { var series = new InfluxSeries(options); var annotations = series.getAnnotations(); - expect(annotations[0].tags.length).to.be(0); + expect(annotations[0].tags.length).toBe(0); }); }); @@ -254,9 +253,9 @@ describe('when generating timeseries from influxdb response', function() { var series = new InfluxSeries(options); var annotations = series.getAnnotations(); - expect(annotations[0].tags.length).to.be(2); - expect(annotations[0].tags[0]).to.be('America'); - expect(annotations[0].tags[1]).to.be('backend'); + expect(annotations[0].tags.length).toBe(2); + expect(annotations[0].tags[0]).toBe('America'); + expect(annotations[0].tags[1]).toBe('backend'); }); }); }); From 25f63e05810e21d67acec7a36fcc44a29ddfba63 Mon Sep 17 00:00:00 2001 From: Patrick O'Carroll Date: Mon, 20 Nov 2017 15:25:42 +0100 Subject: [PATCH 07/17] converted test-files to jest --- .../datasource/influxdb/response_parser.ts | 2 - ...ux_query_specs.ts => influx_query.jest.ts} | 62 +++++++++---------- ...query_part_specs.ts => query_part.jest.ts} | 19 +++--- ...arser_specs.ts => response_parser.jest.ts} | 37 +++++------ 4 files changed, 57 insertions(+), 63 deletions(-) rename public/app/plugins/datasource/influxdb/specs/{influx_query_specs.ts => influx_query.jest.ts} (73%) rename public/app/plugins/datasource/influxdb/specs/{query_part_specs.ts => query_part.jest.ts} (58%) rename public/app/plugins/datasource/influxdb/specs/{response_parser_specs.ts => response_parser.jest.ts} (76%) diff --git a/public/app/plugins/datasource/influxdb/response_parser.ts b/public/app/plugins/datasource/influxdb/response_parser.ts index 23173674361..d52a4e2d0fc 100644 --- a/public/app/plugins/datasource/influxdb/response_parser.ts +++ b/public/app/plugins/datasource/influxdb/response_parser.ts @@ -1,5 +1,3 @@ -/// - import _ from 'lodash'; export default class ResponseParser { diff --git a/public/app/plugins/datasource/influxdb/specs/influx_query_specs.ts b/public/app/plugins/datasource/influxdb/specs/influx_query.jest.ts similarity index 73% rename from public/app/plugins/datasource/influxdb/specs/influx_query_specs.ts rename to public/app/plugins/datasource/influxdb/specs/influx_query.jest.ts index 47ad3498ece..e576f2a7494 100644 --- a/public/app/plugins/datasource/influxdb/specs/influx_query_specs.ts +++ b/public/app/plugins/datasource/influxdb/specs/influx_query.jest.ts @@ -1,5 +1,3 @@ -import {describe, it, expect} from 'test/lib/common'; - import InfluxQuery from '../influx_query'; describe('InfluxQuery', function() { @@ -12,7 +10,7 @@ describe('InfluxQuery', function() { }, templateSrv, {}); var queryText = query.render(); - expect(queryText).to.be('SELECT mean("value") FROM "cpu" WHERE $timeFilter GROUP BY time($__interval) fill(null)'); + expect(queryText).toBe('SELECT mean("value") FROM "cpu" WHERE $timeFilter GROUP BY time($__interval) fill(null)'); }); }); @@ -24,7 +22,7 @@ describe('InfluxQuery', function() { }, templateSrv, {}); var queryText = query.render(); - expect(queryText).to.be('SELECT mean("value") FROM "5m_avg"."cpu" WHERE $timeFilter GROUP BY time($__interval) fill(null)'); + expect(queryText).toBe('SELECT mean("value") FROM "5m_avg"."cpu" WHERE $timeFilter GROUP BY time($__interval) fill(null)'); }); }); @@ -43,7 +41,7 @@ describe('InfluxQuery', function() { }, templateSrv, {}); var queryText = query.render(); - expect(queryText).to.be('SELECT mean("value") /100 AS "text" FROM "cpu" WHERE $timeFilter GROUP BY time($__interval) fill(null)'); + expect(queryText).toBe('SELECT mean("value") /100 AS "text" FROM "cpu" WHERE $timeFilter GROUP BY time($__interval) fill(null)'); }); }); @@ -57,7 +55,7 @@ describe('InfluxQuery', function() { var queryText = query.render(); - expect(queryText).to.be('SELECT mean("value") FROM "cpu" WHERE ("hostname" = \'server\\\\1\') AND $timeFilter' + expect(queryText).toBe('SELECT mean("value") FROM "cpu" WHERE ("hostname" = \'server\\\\1\') AND $timeFilter' + ' GROUP BY time($__interval)'); }); @@ -69,7 +67,7 @@ describe('InfluxQuery', function() { }, templateSrv, {}); var queryText = query.render(); - expect(queryText).to.be('SELECT mean("value") FROM "cpu" WHERE ("app" =~ /e.*/) AND $timeFilter GROUP BY time($__interval)'); + expect(queryText).toBe('SELECT mean("value") FROM "cpu" WHERE ("app" =~ /e.*/) AND $timeFilter GROUP BY time($__interval)'); }); }); @@ -82,7 +80,7 @@ describe('InfluxQuery', function() { }, templateSrv, {}); var queryText = query.render(); - expect(queryText).to.be('SELECT mean("value") FROM "cpu" WHERE ("hostname" = \'server1\' AND "app" = \'email\') AND ' + + expect(queryText).toBe('SELECT mean("value") FROM "cpu" WHERE ("hostname" = \'server1\' AND "app" = \'email\') AND ' + '$timeFilter GROUP BY time($__interval)'); }); }); @@ -96,7 +94,7 @@ describe('InfluxQuery', function() { }, templateSrv, {}); var queryText = query.render(); - expect(queryText).to.be('SELECT mean("value") FROM "cpu" WHERE ("hostname" = \'server1\' OR "hostname" = \'server2\') AND ' + + expect(queryText).toBe('SELECT mean("value") FROM "cpu" WHERE ("hostname" = \'server1\' OR "hostname" = \'server2\') AND ' + '$timeFilter GROUP BY time($__interval)'); }); }); @@ -110,7 +108,7 @@ describe('InfluxQuery', function() { }, templateSrv, {}); var queryText = query.render(); - expect(queryText).to.be('SELECT mean("value") FROM "cpu" WHERE ("value" > 5) AND $timeFilter'); + expect(queryText).toBe('SELECT mean("value") FROM "cpu" WHERE ("value" > 5) AND $timeFilter'); }); }); @@ -123,7 +121,7 @@ describe('InfluxQuery', function() { }, templateSrv, {}); var queryText = query.render(); - expect(queryText).to.be('SELECT mean("value") FROM "cpu" WHERE $timeFilter GROUP BY time($__interval), "host"'); + expect(queryText).toBe('SELECT mean("value") FROM "cpu" WHERE $timeFilter GROUP BY time($__interval), "host"'); }); }); @@ -135,7 +133,7 @@ describe('InfluxQuery', function() { groupBy: [], }, templateSrv, {}); var queryText = query.render(); - expect(queryText).to.be('SELECT "value" FROM "cpu" WHERE $timeFilter'); + expect(queryText).toBe('SELECT "value" FROM "cpu" WHERE $timeFilter'); }); }); @@ -147,7 +145,7 @@ describe('InfluxQuery', function() { groupBy: [{type: 'time'}, {type: 'fill', params: ['0']}], }, templateSrv, {}); var queryText = query.render(); - expect(queryText).to.be('SELECT "value" FROM "cpu" WHERE $timeFilter GROUP BY time($__interval) fill(0)'); + expect(queryText).toBe('SELECT "value" FROM "cpu" WHERE $timeFilter GROUP BY time($__interval) fill(0)'); }); }); @@ -160,10 +158,10 @@ describe('InfluxQuery', function() { }, templateSrv, {}); query.addGroupBy('tag(host)'); - expect(query.target.groupBy.length).to.be(3); - expect(query.target.groupBy[1].type).to.be('tag'); - expect(query.target.groupBy[1].params[0]).to.be('host'); - expect(query.target.groupBy[2].type).to.be('fill'); + expect(query.target.groupBy.length).toBe(3); + expect(query.target.groupBy[1].type).toBe('tag'); + expect(query.target.groupBy[1].params[0]).toBe('host'); + expect(query.target.groupBy[2].type).toBe('fill'); }); it('should add tag last if no fill', function() { @@ -173,8 +171,8 @@ describe('InfluxQuery', function() { }, templateSrv, {}); query.addGroupBy('tag(host)'); - expect(query.target.groupBy.length).to.be(1); - expect(query.target.groupBy[0].type).to.be('tag'); + expect(query.target.groupBy.length).toBe(1); + expect(query.target.groupBy[0].type).toBe('tag'); }); }); @@ -188,8 +186,8 @@ describe('InfluxQuery', function() { }, templateSrv, {}); query.addSelectPart(query.selectModels[0], 'mean'); - expect(query.target.select[0].length).to.be(2); - expect(query.target.select[0][1].type).to.be('mean'); + expect(query.target.select[0].length).toBe(2); + expect(query.target.select[0][1].type).toBe('mean'); }); it('should replace sum by mean', function() { @@ -199,8 +197,8 @@ describe('InfluxQuery', function() { }, templateSrv, {}); query.addSelectPart(query.selectModels[0], 'sum'); - expect(query.target.select[0].length).to.be(2); - expect(query.target.select[0][1].type).to.be('sum'); + expect(query.target.select[0].length).toBe(2); + expect(query.target.select[0][1].type).toBe('sum'); }); it('should add math before alias', function() { @@ -210,8 +208,8 @@ describe('InfluxQuery', function() { }, templateSrv, {}); query.addSelectPart(query.selectModels[0], 'math'); - expect(query.target.select[0].length).to.be(4); - expect(query.target.select[0][2].type).to.be('math'); + expect(query.target.select[0].length).toBe(4); + expect(query.target.select[0][2].type).toBe('math'); }); it('should add math last', function() { @@ -221,8 +219,8 @@ describe('InfluxQuery', function() { }, templateSrv, {}); query.addSelectPart(query.selectModels[0], 'math'); - expect(query.target.select[0].length).to.be(3); - expect(query.target.select[0][2].type).to.be('math'); + expect(query.target.select[0].length).toBe(3); + expect(query.target.select[0][2].type).toBe('math'); }); it('should replace math', function() { @@ -232,8 +230,8 @@ describe('InfluxQuery', function() { }, templateSrv, {}); query.addSelectPart(query.selectModels[0], 'math'); - expect(query.target.select[0].length).to.be(3); - expect(query.target.select[0][2].type).to.be('math'); + expect(query.target.select[0].length).toBe(3); + expect(query.target.select[0][2].type).toBe('math'); }); it('should add math when one only query part', function() { @@ -243,8 +241,8 @@ describe('InfluxQuery', function() { }, templateSrv, {}); query.addSelectPart(query.selectModels[0], 'math'); - expect(query.target.select[0].length).to.be(2); - expect(query.target.select[0][1].type).to.be('math'); + expect(query.target.select[0].length).toBe(2); + expect(query.target.select[0][1].type).toBe('math'); }); describe('when render adhoc filters', function() { @@ -256,7 +254,7 @@ describe('InfluxQuery', function() { {key: 'key2', operator: '!=', value: 'value2'}, ]); - expect(queryText).to.be('"key1" = \'value1\' AND "key2" != \'value2\''); + expect(queryText).toBe('"key1" = \'value1\' AND "key2" != \'value2\''); }); }); diff --git a/public/app/plugins/datasource/influxdb/specs/query_part_specs.ts b/public/app/plugins/datasource/influxdb/specs/query_part.jest.ts similarity index 58% rename from public/app/plugins/datasource/influxdb/specs/query_part_specs.ts rename to public/app/plugins/datasource/influxdb/specs/query_part.jest.ts index 131eea80806..57017938063 100644 --- a/public/app/plugins/datasource/influxdb/specs/query_part_specs.ts +++ b/public/app/plugins/datasource/influxdb/specs/query_part.jest.ts @@ -1,6 +1,3 @@ - -import {describe, it, expect} from 'test/lib/common'; - import queryPart from '../query_part'; describe('InfluxQueryPart', () => { @@ -12,8 +9,8 @@ describe('InfluxQueryPart', () => { params: ['10s'], }); - expect(part.text).to.be('derivative(10s)'); - expect(part.render('mean(value)')).to.be('derivative(mean(value), 10s)'); + expect(part.text).toBe('derivative(10s)'); + expect(part.render('mean(value)')).toBe('derivative(mean(value), 10s)'); }); it('should nest spread function', () => { @@ -21,8 +18,8 @@ describe('InfluxQueryPart', () => { type: 'spread' }); - expect(part.text).to.be('spread()'); - expect(part.render('value')).to.be('spread(value)'); + expect(part.text).toBe('spread()'); + expect(part.render('value')).toBe('spread(value)'); }); it('should handle suffix parts', () => { @@ -31,8 +28,8 @@ describe('InfluxQueryPart', () => { params: ['/ 100'], }); - expect(part.text).to.be('math(/ 100)'); - expect(part.render('mean(value)')).to.be('mean(value) / 100'); + expect(part.text).toBe('math(/ 100)'); + expect(part.render('mean(value)')).toBe('mean(value) / 100'); }); it('should handle alias parts', () => { @@ -41,8 +38,8 @@ describe('InfluxQueryPart', () => { params: ['test'], }); - expect(part.text).to.be('alias(test)'); - expect(part.render('mean(value)')).to.be('mean(value) AS "test"'); + expect(part.text).toBe('alias(test)'); + expect(part.render('mean(value)')).toBe('mean(value) AS "test"'); }); }); diff --git a/public/app/plugins/datasource/influxdb/specs/response_parser_specs.ts b/public/app/plugins/datasource/influxdb/specs/response_parser.jest.ts similarity index 76% rename from public/app/plugins/datasource/influxdb/specs/response_parser_specs.ts rename to public/app/plugins/datasource/influxdb/specs/response_parser.jest.ts index b24baec8f89..45313e047d9 100644 --- a/public/app/plugins/datasource/influxdb/specs/response_parser_specs.ts +++ b/public/app/plugins/datasource/influxdb/specs/response_parser.jest.ts @@ -1,9 +1,10 @@ import _ from 'lodash'; -import {describe, it, expect} from 'test/lib/common'; import ResponseParser from '../response_parser'; -describe("influxdb response parser", () => { - this.parser = new ResponseParser(); +describe('influxdb response parser', () => { + + const parser = new ResponseParser(); + describe("SHOW TAG response", () => { var query = 'SHOW TAG KEYS FROM "cpu"'; var response = { @@ -20,10 +21,10 @@ describe("influxdb response parser", () => { ] }; - var result = this.parser.parse(query, response); + var result = parser.parse(query, response); it("expects three results", () => { - expect(_.size(result)).to.be(3); + expect(_.size(result)).toBe(3); }); }); @@ -45,12 +46,12 @@ describe("influxdb response parser", () => { ] }; - var result = this.parser.parse(query, response); + var result = parser.parse(query, response); it("should get two responses", () => { - expect(_.size(result)).to.be(2); - expect(result[0].text).to.be("server1"); - expect(result[1].text).to.be("server2"); + expect(_.size(result)).toBe(2); + expect(result[0].text).toBe("server1"); + expect(result[1].text).toBe("server2"); }); }); @@ -80,13 +81,13 @@ describe("influxdb response parser", () => { ] }; - var result = this.parser.parse(query, response); + var result = parser.parse(query, response); it("should get two responses", () => { - expect(_.size(result)).to.be(3); - expect(result[0].text).to.be('site'); - expect(result[1].text).to.be('api'); - expect(result[2].text).to.be('webapi'); + expect(_.size(result)).toBe(3); + expect(result[0].text).toBe('site'); + expect(result[1].text).toBe('api'); + expect(result[2].text).toBe('webapi'); }); }); }); @@ -110,9 +111,9 @@ describe("influxdb response parser", () => { ] }; - var result = this.parser.parse(query, response); + var result = parser.parse(query, response); it("should get two responses", () => { - expect(_.size(result)).to.be(6); + expect(_.size(result)).toBe(6); }); }); @@ -131,10 +132,10 @@ describe("influxdb response parser", () => { ] }; - var result = this.parser.parse(query, response); + var result = parser.parse(query, response); it("should get two responses", () => { - expect(_.size(result)).to.be(1); + expect(_.size(result)).toBe(1); }); }); }); From d7321cd89cc5fbdd90cbc4684904ad92c2050185 Mon Sep 17 00:00:00 2001 From: bergquist Date: Tue, 21 Nov 2017 09:55:42 +0100 Subject: [PATCH 08/17] prom: initial docker block for prometheus 2 --- docker/blocks/prometheus2/Dockerfile | 3 ++ docker/blocks/prometheus2/alert.rules | 10 +++++++ docker/blocks/prometheus2/prometheus.yml | 35 ++++++++++++++++++++++++ 3 files changed, 48 insertions(+) create mode 100644 docker/blocks/prometheus2/Dockerfile create mode 100644 docker/blocks/prometheus2/alert.rules create mode 100644 docker/blocks/prometheus2/prometheus.yml diff --git a/docker/blocks/prometheus2/Dockerfile b/docker/blocks/prometheus2/Dockerfile new file mode 100644 index 00000000000..d4a9eb2d75d --- /dev/null +++ b/docker/blocks/prometheus2/Dockerfile @@ -0,0 +1,3 @@ +FROM prom/prometheus:v2.0.0 +ADD prometheus.yml /etc/prometheus/ +ADD alert.rules /etc/prometheus/ diff --git a/docker/blocks/prometheus2/alert.rules b/docker/blocks/prometheus2/alert.rules new file mode 100644 index 00000000000..563d1e89994 --- /dev/null +++ b/docker/blocks/prometheus2/alert.rules @@ -0,0 +1,10 @@ +# Alert Rules + +ALERT AppCrash + IF process_open_fds > 0 + FOR 15s + LABELS { severity="critical" } + ANNOTATIONS { + summary = "Number of open fds > 0", + description = "Just testing" + } diff --git a/docker/blocks/prometheus2/prometheus.yml b/docker/blocks/prometheus2/prometheus.yml new file mode 100644 index 00000000000..83dda78bb3c --- /dev/null +++ b/docker/blocks/prometheus2/prometheus.yml @@ -0,0 +1,35 @@ +# my global config +global: + scrape_interval: 10s # By default, scrape targets every 15 seconds. + evaluation_interval: 10s # By default, scrape targets every 15 seconds. + # scrape_timeout is set to the global default (10s). + +# Load and evaluate rules in this file every 'evaluation_interval' seconds. +#rule_files: +# - "alert.rules" +# - "first.rules" +# - "second.rules" + +# alerting: +# alertmanagers: +# - scheme: http +# static_configs: +# - targets: +# - "127.0.0.1:9093" + +scrape_configs: + - job_name: 'prometheus' + static_configs: + - targets: ['localhost:9090'] + + - job_name: 'node_exporter' + static_configs: + - targets: ['127.0.0.1:9100'] + + - job_name: 'fake-data-gen' + static_configs: + - targets: ['127.0.0.1:9091'] + + - job_name: 'grafana' + static_configs: + - targets: ['127.0.0.1:3000'] From d5ef0403af030e0c74cd963affad8469d25b3f2b Mon Sep 17 00:00:00 2001 From: Cody Boggs Date: Thu, 2 Nov 2017 08:22:15 -0600 Subject: [PATCH 09/17] First draft of a Prometheus 2.0 Stats dashboard --- .../dashboards/prometheus_2_stats.json | 1758 +++++++++++++++++ 1 file changed, 1758 insertions(+) create mode 100644 public/app/plugins/datasource/prometheus/dashboards/prometheus_2_stats.json diff --git a/public/app/plugins/datasource/prometheus/dashboards/prometheus_2_stats.json b/public/app/plugins/datasource/prometheus/dashboards/prometheus_2_stats.json new file mode 100644 index 00000000000..1fa9420931d --- /dev/null +++ b/public/app/plugins/datasource/prometheus/dashboards/prometheus_2_stats.json @@ -0,0 +1,1758 @@ +{ + "__inputs": [ + { + "name": "DS_NAME", + "type": "datasource", + "pluginId": "prometheus" + } + ], + "annotations": { + "list": [] + }, + "editable": true, + "gnetId": null, + "graphTooltip": 1, + "hideControls": false, + "id": null, + "links": [ + { + "icon": "info", + "tags": [], + "targetBlank": true, + "title": "Grafana Docs", + "tooltip": "", + "type": "link", + "url": "http://docs.grafana.org/" + }, + { + "icon": "info", + "tags": [], + "targetBlank": true, + "title": "Prometheus Docs", + "type": "link", + "url": "http://prometheus.io/docs/introduction/overview/" + } + ], + "refresh": "5m", + "revision": "0.1", + "rows": [ + { + "collapse": false, + "height": 178, + "panels": [ + { + "aliasColors": { + "prometheus": "#C15C17", + "{instance=\"localhost:9090\",job=\"prometheus\"}": "#CCA300" + }, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "${DS_LOCAL-P8S}", + "editable": true, + "error": false, + "fill": 0, + "grid": {}, + "id": 3, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "links": [], + "nullPointMode": "connected", + "percentage": false, + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "span": 3, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "sum(irate(prometheus_tsdb_head_samples_appended_total{job=\"prometheus\"}[5m]))", + "format": "time_series", + "hide": false, + "interval": "", + "intervalFactor": 2, + "legendFormat": "samples", + "metric": "", + "refId": "A", + "step": 120 + } + ], + "thresholds": [], + "timeFrom": null, + "timeShift": null, + "title": "Samples Appended", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "cumulative" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "short", + "logBase": 1, + "max": null, + "min": "0", + "show": true + }, + { + "format": "short", + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ] + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "${DS_LOCAL-P8S}", + "editable": true, + "error": false, + "fill": 0, + "grid": {}, + "id": 14, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "links": [], + "nullPointMode": "connected", + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "span": 3, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "max(prometheus_target_interval_length_seconds{job=\"prometheus\", quantile!=\"0.01\", quantile!=\"0.05\"}) by (quantile)", + "format": "time_series", + "interval": "", + "intervalFactor": 2, + "legendFormat": "{{quantile}} ({{interval}})", + "metric": "", + "refId": "A", + "step": 120 + } + ], + "thresholds": [], + "timeFrom": null, + "timeShift": null, + "title": "Scrape Duration", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "cumulative" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "s", + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ] + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "${DS_LOCAL-P8S}", + "description": "", + "fill": 0, + "id": 16, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "links": [], + "nullPointMode": "null", + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [ + { + "alias": "total node memory", + "linewidth": 3 + } + ], + "spaceLength": 10, + "span": 3, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "sum(process_resident_memory_bytes{job=\"prometheus\"})", + "format": "time_series", + "hide": false, + "interval": "", + "intervalFactor": 2, + "legendFormat": "p8s process resident memory", + "refId": "D", + "step": 120 + }, + { + "expr": "node_memory_Mapped{instance=~'[[node]].*'}", + "format": "time_series", + "hide": false, + "interval": "", + "intervalFactor": 2, + "legendFormat": "mmap'd memory", + "refId": "A", + "step": 120 + }, + { + "expr": "node_memory_MemTotal{instance=~'[[node]].*'}", + "format": "time_series", + "hide": false, + "interval": "", + "intervalFactor": 2, + "legendFormat": "total node memory", + "refId": "B", + "step": 120 + }, + { + "expr": "process_virtual_memory_bytes{job=\"prometheus\"}", + "format": "time_series", + "hide": false, + "intervalFactor": 2, + "legendFormat": "virtual memory", + "refId": "C", + "step": 120 + } + ], + "thresholds": [], + "timeFrom": null, + "timeShift": null, + "title": "Memory Profile", + "tooltip": { + "shared": true, + "sort": 2, + "value_type": "individual" + }, + "transparent": false, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "bytes", + "label": "", + "logBase": 1, + "max": null, + "min": "0", + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ] + }, + { + "cacheTimeout": null, + "colorBackground": false, + "colorValue": true, + "colors": [ + "rgba(50, 172, 45, 0.97)", + "rgba(237, 129, 40, 0.89)", + "rgba(245, 54, 54, 0.9)" + ], + "datasource": "${DS_LOCAL-P8S}", + "format": "none", + "gauge": { + "maxValue": 100, + "minValue": 0, + "show": false, + "thresholdLabels": false, + "thresholdMarkers": true + }, + "id": 37, + "interval": null, + "links": [], + "mappingType": 1, + "mappingTypes": [ + { + "name": "value to text", + "value": 1 + }, + { + "name": "range to text", + "value": 2 + } + ], + "maxDataPoints": 100, + "nullPointMode": "connected", + "nullText": null, + "postfix": "", + "postfixFontSize": "50%", + "prefix": "", + "prefixFontSize": "50%", + "rangeMaps": [ + { + "from": "null", + "text": "N/A", + "to": "null" + } + ], + "span": 3, + "sparkline": { + "fillColor": "rgba(31, 118, 189, 0.18)", + "full": false, + "lineColor": "rgb(31, 120, 193)", + "show": false + }, + "tableColumn": "", + "targets": [ + { + "expr": "tsdb_wal_corruptions_total", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "", + "refId": "A", + "step": 600 + } + ], + "thresholds": "0.1,1", + "title": "WAL Corruptions", + "type": "singlestat", + "valueFontSize": "200%", + "valueMaps": [ + { + "op": "=", + "text": "None", + "value": "0" + } + ], + "valueName": "max" + } + ], + "repeat": null, + "repeatIteration": null, + "repeatRowId": null, + "showTitle": false, + "title": "New row", + "titleSize": "h6" + }, + { + "collapse": false, + "height": 227, + "panels": [ + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "${DS_LOCAL-P8S}", + "decimals": null, + "editable": true, + "error": false, + "fill": 0, + "grid": {}, + "id": 35, + "legend": { + "alignAsTable": false, + "avg": false, + "current": false, + "hideEmpty": true, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "links": [], + "nullPointMode": "connected", + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "span": 3, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "max(prometheus_evaluator_duration_seconds{quantile!=\"0.01\", quantile!=\"0.05\"}) by (quantile)", + "format": "time_series", + "interval": "", + "intervalFactor": 2, + "legendFormat": "{{quantile}}", + "refId": "A", + "step": 120 + } + ], + "thresholds": [], + "timeFrom": null, + "timeShift": null, + "title": "Rule Eval Duration", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "cumulative" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "s", + "label": "", + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ] + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "${DS_LOCAL-P8S}", + "fill": 0, + "id": 29, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "links": [], + "nullPointMode": "null", + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "span": 3, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "sum(prometheus_tsdb_head_active_appenders{job=\"prometheus\"})", + "format": "time_series", + "interval": "", + "intervalFactor": 2, + "legendFormat": "active_appenders", + "metric": "", + "refId": "A", + "step": 120 + }, + { + "expr": "sum(process_open_fds{job=\"prometheus\"})", + "format": "time_series", + "interval": "", + "intervalFactor": 2, + "legendFormat": "open_fds", + "refId": "B", + "step": 120 + } + ], + "thresholds": [], + "timeFrom": null, + "timeShift": null, + "title": "Active Appenders", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": false + } + ] + }, + { + "aliasColors": { + "prometheus": "#F9BA8F", + "{instance=\"localhost:9090\",interval=\"5s\",job=\"prometheus\"}": "#F9BA8F" + }, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "${DS_LOCAL-P8S}", + "editable": true, + "error": false, + "fill": 0, + "grid": {}, + "id": 2, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "links": [], + "nullPointMode": "connected", + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "span": 3, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "prometheus_tsdb_blocks_loaded", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "blocks", + "refId": "A", + "step": 120 + } + ], + "thresholds": [], + "timeFrom": null, + "timeShift": null, + "title": "Blocks Loaded", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "cumulative" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "short", + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ] + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "${DS_LOCAL-P8S}", + "decimals": null, + "description": "", + "fill": 0, + "id": 33, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "links": [], + "nullPointMode": "connected", + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "span": 3, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "prometheus_tsdb_head_chunks", + "format": "time_series", + "interval": "", + "intervalFactor": 2, + "legendFormat": "chunks", + "refId": "A", + "step": 120 + } + ], + "thresholds": [], + "timeFrom": null, + "timeShift": null, + "title": "Head Chunks", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "bytes", + "label": "", + "logBase": 1, + "max": null, + "min": null, + "show": false + } + ] + } + ], + "repeat": null, + "repeatIteration": null, + "repeatRowId": null, + "showTitle": false, + "title": "New row", + "titleSize": "h6" + }, + { + "collapse": false, + "height": "250px", + "panels": [ + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "${DS_LOCAL-P8S}", + "decimals": null, + "description": "", + "fill": 0, + "id": 20, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "links": [], + "nullPointMode": "connected", + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [ + { + "alias": "duration-p99", + "yaxis": 2 + } + ], + "spaceLength": 10, + "span": 4, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "histogram_quantile(0.99, sum(rate(prometheus_tsdb_compaction_duration_bucket[5m])) by (le))", + "format": "time_series", + "hide": false, + "interval": "", + "intervalFactor": 2, + "legendFormat": "duration-{{p99}}", + "refId": "A", + "step": 120 + }, + { + "expr": "irate(prometheus_tsdb_compactions_total[5m])", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "compactions", + "refId": "B", + "step": 120 + }, + { + "expr": "irate(prometheus_tsdb_compactions_failed_total[5m])", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "failed", + "refId": "C", + "step": 120 + }, + { + "expr": "irate(prometheus_tsdb_compactions_triggered_total[5m])", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "triggered", + "refId": "D", + "step": 120 + } + ], + "thresholds": [], + "timeFrom": null, + "timeShift": null, + "title": "Compaction Activity", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": "0", + "show": true + }, + { + "format": "s", + "label": "", + "logBase": 1, + "max": null, + "min": "0", + "show": true + } + ] + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "${DS_LOCAL-P8S}", + "fill": 1, + "id": 36, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "links": [], + "nullPointMode": "null", + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [ + { + "alias": "duration-p99", + "yaxis": 2 + } + ], + "spaceLength": 10, + "span": 4, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "prometheus_tsdb_head_gc_duration_seconds{quantile=\"0.99\"}", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "duration-p99", + "refId": "A", + "step": 120 + }, + { + "expr": "irate(prometheus_tsdb_head_gc_duration_seconds_count[5m])", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "collections", + "refId": "B", + "step": 120 + } + ], + "thresholds": [], + "timeFrom": null, + "timeShift": null, + "title": "Head Block GC Activity", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": "0", + "show": true + }, + { + "format": "s", + "label": null, + "logBase": 1, + "max": null, + "min": "0", + "show": true + } + ] + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "${DS_LOCAL-P8S}", + "fill": 1, + "id": 32, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "links": [], + "nullPointMode": "null", + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "span": 4, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "rate(prometheus_tsdb_reloads_total{job=\"prometheus\"}[5m])", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "reloads", + "refId": "A", + "step": 120 + }, + { + "expr": "rate(prometheus_tsdb_reloads_failures_total{job=\"prometheus\"}[5m])", + "format": "time_series", + "hide": false, + "intervalFactor": 2, + "legendFormat": "failures", + "refId": "B", + "step": 120 + } + ], + "thresholds": [], + "timeFrom": null, + "timeShift": null, + "title": "Reload Count", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ] + } + ], + "repeat": null, + "repeatIteration": null, + "repeatRowId": null, + "showTitle": false, + "title": "New row", + "titleSize": "h6" + }, + { + "collapse": false, + "height": 250, + "panels": [ + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "${DS_LOCAL-P8S}", + "editable": true, + "error": false, + "fill": 0, + "grid": {}, + "id": 34, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "links": [], + "minSpan": 2, + "nullPointMode": "connected", + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "repeat": null, + "seriesOverrides": [ + { + "alias": "/.*_read$/", + "transform": "negative-Y" + } + ], + "spaceLength": 10, + "span": 4, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "sum(rate(node_disk_reads_completed{instance=~'$node.*'}[5m]))", + "format": "time_series", + "interval": "", + "intervalFactor": 4, + "legendFormat": "read", + "metric": "", + "refId": "A", + "step": 240, + "target": "" + }, + { + "expr": "sum(rate(node_disk_writes_completed{instance=~'$node.*'}[5m]))", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "write", + "metric": "", + "refId": "B", + "step": 120 + } + ], + "thresholds": [], + "timeFrom": null, + "timeShift": null, + "title": "Disk IOs / sec", + "tooltip": { + "msResolution": false, + "shared": false, + "sort": 0, + "value_type": "cumulative" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "short", + "label": "IO/second read (-) / write (+)", + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ] + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "${DS_LOCAL-P8S}", + "editable": true, + "error": false, + "fill": 0, + "grid": {}, + "id": 39, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "links": [], + "minSpan": 2, + "nullPointMode": "connected", + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "span": 4, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "sum(rate(node_disk_io_time_weighted{instance=~'$node.*'}[5m]))", + "format": "time_series", + "interval": "", + "intervalFactor": 4, + "legendFormat": "weighted", + "metric": "", + "refId": "A", + "step": 240, + "target": "" + }, + { + "expr": "sum(rate(node_disk_io_time_ms{instance=~'$node.*'}[5m]))", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "time", + "metric": "", + "refId": "B", + "step": 120 + } + ], + "thresholds": [], + "timeFrom": null, + "timeShift": null, + "title": "Disk I/O Time", + "tooltip": { + "msResolution": false, + "shared": false, + "sort": 0, + "value_type": "cumulative" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "ms", + "label": "", + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "ms", + "logBase": 1, + "max": null, + "min": null, + "show": false + } + ] + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "${DS_LOCAL-P8S}", + "editable": true, + "error": false, + "fill": 0, + "grid": {}, + "id": 38, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "links": [], + "minSpan": 2, + "nullPointMode": "connected", + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [ + { + "alias": "/.*_read$/", + "transform": "negative-Y" + } + ], + "spaceLength": 10, + "span": 4, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "sum(rate(node_disk_bytes_read{instance=~'$node.*'}[5m]))", + "format": "time_series", + "interval": "", + "intervalFactor": 4, + "legendFormat": "read", + "metric": "", + "refId": "A", + "step": 240, + "target": "" + }, + { + "expr": "sum(rate(node_disk_bytes_written{instance=~'$node.*'}[5m]))", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "write", + "metric": "", + "refId": "B", + "step": 120 + } + ], + "thresholds": [], + "timeFrom": null, + "timeShift": null, + "title": "Disk Throughput", + "tooltip": { + "msResolution": false, + "shared": false, + "sort": 0, + "value_type": "cumulative" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "bytes", + "label": "read(-) / write (+)", + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "bytes", + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ] + } + ], + "repeat": null, + "repeatIteration": null, + "repeatRowId": null, + "showTitle": false, + "title": "Dashboard Row", + "titleSize": "h6" + }, + { + "collapse": false, + "height": 250, + "panels": [ + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "${DS_LOCAL-P8S}", + "decimals": 3, + "editable": true, + "error": false, + "fill": 10, + "grid": {}, + "id": 27, + "legend": { + "alignAsTable": false, + "avg": false, + "current": false, + "hideEmpty": false, + "max": false, + "min": false, + "rightSide": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 0, + "links": [], + "minSpan": 2, + "nullPointMode": "connected", + "percentage": true, + "pointradius": 5, + "points": false, + "renderer": "flot", + "repeat": null, + "seriesOverrides": [], + "spaceLength": 10, + "span": 6, + "stack": true, + "steppedLine": false, + "targets": [ + { + "expr": "sum by (mode)(irate(node_cpu{mode=\"system\", instance=~'[[node]].*', _ftio=\"\"}[5m]))", + "format": "time_series", + "interval": "", + "intervalFactor": 2, + "legendFormat": "{{mode}}", + "metric": "", + "refId": "A", + "step": 60, + "target": "" + }, + { + "expr": "sum by (mode)(irate(node_cpu{mode='user', instance=~'[[node]].*', _ftio=\"\"}[5m]))", + "format": "time_series", + "interval": "", + "intervalFactor": 2, + "legendFormat": "user", + "refId": "B", + "step": 60 + }, + { + "expr": "sum by (mode)(irate(node_cpu{mode='nice', instance=~'[[node]].*', _ftio=\"\"}[5m]))", + "format": "time_series", + "interval": "", + "intervalFactor": 2, + "legendFormat": "nice", + "refId": "C", + "step": 60 + }, + { + "expr": "sum by (mode)(irate(node_cpu{mode='iowait', instance=~'[[node]].*', _ftio=\"\"}[5m]))", + "format": "time_series", + "interval": "", + "intervalFactor": 2, + "legendFormat": "iowait", + "refId": "E", + "step": 60 + }, + { + "expr": "sum by (mode)(irate(node_cpu{mode='steal', instance=~'[[node]].*', _ftio=\"\"}[5m]))", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "steal", + "refId": "H", + "step": 60 + }, + { + "expr": "sum by (mode)(irate(node_cpu{mode='idle', instance=~'[[node]].*', _ftio=\"\"}[5m]))", + "format": "time_series", + "interval": "", + "intervalFactor": 2, + "legendFormat": "idle", + "refId": "D", + "step": 60 + }, + { + "expr": "sum by (mode)(irate(node_cpu{mode='irq', instance=~'[[node]].*', _ftio=\"\"}[5m]))", + "format": "time_series", + "interval": "", + "intervalFactor": 2, + "legendFormat": "irq", + "refId": "F", + "step": 60 + }, + { + "expr": "sum by (mode)(irate(node_cpu{mode='softirq', instance=~'[[node]].*', _ftio=\"\"}[5m]))", + "format": "time_series", + "interval": "", + "intervalFactor": 2, + "legendFormat": "softirq", + "refId": "G", + "step": 60 + }, + { + "expr": "sum by (mode)(irate(node_cpu{mode='guest', instance=~'[[node]].*', _ftio=\"\"}[5m]))", + "format": "time_series", + "interval": "", + "intervalFactor": 2, + "legendFormat": "guest", + "refId": "I", + "step": 60 + } + ], + "thresholds": [], + "timeFrom": null, + "timeShift": null, + "title": "Host CPU", + "tooltip": { + "msResolution": false, + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "short", + "label": "%", + "logBase": 1, + "max": 100, + "min": 0, + "show": true + }, + { + "format": "short", + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ] + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "${DS_LOCAL-P8S}", + "decimals": 2, + "editable": true, + "error": false, + "fill": 9, + "grid": {}, + "id": 28, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "links": [], + "minSpan": 2, + "nullPointMode": "connected", + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "repeat": null, + "seriesOverrides": [ + { + "alias": "total", + "color": "#629E51", + "fill": 0, + "linewidth": 4, + "stack": "D", + "zindex": 2 + }, + { + "alias": "swapped", + "color": "#BF1B00", + "fill": 10, + "linewidth": 4, + "stack": true, + "zindex": 2 + }, + { + "alias": "apps", + "color": "#EAB839" + }, + { + "alias": "buffers", + "color": "#BA43A9" + }, + { + "alias": "cached", + "color": "#7EB26D" + }, + { + "alias": "misc", + "color": "#447EBC", + "fill": 3 + }, + { + "alias": "free", + "color": "#70DBED", + "fill": 3 + } + ], + "spaceLength": 10, + "span": 6, + "stack": true, + "steppedLine": false, + "targets": [ + { + "expr": "sum(( node_memory_MemTotal{instance=~'[[node]].*', _ftio=\"\"} - node_memory_MemFree{instance=~'[[node]].*', _ftio=\"\"} - node_memory_Buffers{instance=~'[[node]].*', _ftio=\"\"} - node_memory_Cached{instance=~'[[node]].*', _ftio=\"\"} - node_memory_SwapCached{instance=~'[[node]].*', _ftio=\"\"} - node_memory_Slab{instance=~'[[node]].*', _ftio=\"\"} - node_memory_PageTables{instance=~'[[node]].*', _ftio=\"\"} - node_memory_VmallocUsed{instance=~'[[node]].*', _ftio=\"\"} ))", + "format": "time_series", + "hide": false, + "interval": "", + "intervalFactor": 2, + "legendFormat": "apps", + "metric": "", + "refId": "C", + "step": 60 + }, + { + "expr": "sum(node_memory_Buffers{instance=~'[[node]].*', _ftio=\"\"})", + "format": "time_series", + "hide": false, + "interval": "", + "intervalFactor": 2, + "legendFormat": "buffers", + "metric": "", + "refId": "A", + "step": 60 + }, + { + "expr": "sum(node_memory_Cached{instance=~'[[node]].*', _ftio=\"\"})", + "format": "time_series", + "hide": false, + "interval": "", + "intervalFactor": 2, + "legendFormat": "cached", + "metric": "", + "refId": "E", + "step": 60 + }, + { + "expr": "sum({__name__=~\"node_memory_(SwapCached|Slab|PageTables|VmallocUsed)\", instance=~'[[node]].*', _ftio=\"\"})", + "format": "time_series", + "hide": false, + "interval": "", + "intervalFactor": 2, + "legendFormat": "misc", + "refId": "F", + "step": 60 + }, + { + "expr": "sum(node_memory_MemFree{instance=~'[[node]].*', _ftio=\"\"})", + "format": "time_series", + "hide": false, + "interval": "", + "intervalFactor": 2, + "legendFormat": "free", + "metric": "", + "refId": "B", + "step": 60 + }, + { + "expr": "sum(node_memory_SwapTotal{instance=~'[[node]].*', _ftio=\"\"}) - sum(node_memory_SwapFree{instance=~'[[node]].*', _ftio=\"\"})", + "format": "time_series", + "interval": "", + "intervalFactor": 2, + "legendFormat": "swapped", + "refId": "G", + "step": 60 + }, + { + "expr": "sum(node_memory_MemTotal{instance=~'[[node]].*', _ftio=\"\"}) ", + "format": "time_series", + "interval": "", + "intervalFactor": 2, + "legendFormat": "total", + "metric": "", + "refId": "D", + "step": 60 + } + ], + "thresholds": [], + "timeFrom": null, + "timeShift": null, + "title": "Host Memory", + "tooltip": { + "msResolution": false, + "shared": true, + "sort": 2, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "bytes", + "label": "GB", + "logBase": 1, + "max": null, + "min": "0", + "show": true + }, + { + "format": "short", + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ] + } + ], + "repeat": null, + "repeatIteration": null, + "repeatRowId": null, + "showTitle": false, + "title": "Dashboard Row", + "titleSize": "h6" + } + ], + "schemaVersion": 14, + "style": "dark", + "tags": [ + "prometheus" + ], + "templating": { + "list": [ + { + "allValue": null, + "current": {}, + "datasource": "${DS_LOCAL-P8S}", + "hide": 0, + "includeAll": false, + "label": "Node", + "multi": false, + "name": "node", + "options": [], + "query": "label_values(prometheus_target_interval_length_seconds_count, instance)", + "refresh": 2, + "regex": "", + "sort": 0, + "tagValuesQuery": "", + "tags": [], + "tagsQuery": "", + "type": "query", + "useTags": false + } + ] + }, + "time": { + "from": "now-6h", + "to": "now" + }, + "timepicker": { + "now": true, + "refresh_intervals": [ + "5s", + "10s", + "30s", + "1m", + "5m", + "15m", + "30m", + "1h", + "2h", + "1d" + ], + "time_options": [ + "5m", + "15m", + "1h", + "6h", + "12h", + "24h", + "2d", + "7d", + "30d" + ] + }, + "timezone": "browser", + "title": "Prometheus 2.0 Stats", + "version": 1 +} From 29de4e7c536c66836a1084b3077d598ea3758dc2 Mon Sep 17 00:00:00 2001 From: Cody Boggs Date: Mon, 6 Nov 2017 08:15:02 -0700 Subject: [PATCH 10/17] fix data source var and remove node_exporter dependency --- .../dashboards/prometheus_2_stats.json | 865 +++--------------- 1 file changed, 120 insertions(+), 745 deletions(-) diff --git a/public/app/plugins/datasource/prometheus/dashboards/prometheus_2_stats.json b/public/app/plugins/datasource/prometheus/dashboards/prometheus_2_stats.json index 1fa9420931d..ecbaa35deff 100644 --- a/public/app/plugins/datasource/prometheus/dashboards/prometheus_2_stats.json +++ b/public/app/plugins/datasource/prometheus/dashboards/prometheus_2_stats.json @@ -3,7 +3,8 @@ { "name": "DS_NAME", "type": "datasource", - "pluginId": "prometheus" + "pluginId": "prometheus", + "pluginName": "Prometheus" } ], "annotations": { @@ -33,12 +34,12 @@ "url": "http://prometheus.io/docs/introduction/overview/" } ], - "refresh": "5m", - "revision": "0.1", + "refresh": "1m", + "revision": "1.0", "rows": [ { "collapse": false, - "height": 178, + "height": "200", "panels": [ { "aliasColors": { @@ -48,7 +49,7 @@ "bars": false, "dashLength": 10, "dashes": false, - "datasource": "${DS_LOCAL-P8S}", + "datasource": "${DS_NAME}", "editable": true, "error": false, "fill": 0, @@ -86,7 +87,7 @@ "legendFormat": "samples", "metric": "", "refId": "A", - "step": 120 + "step": 20 } ], "thresholds": [], @@ -128,7 +129,7 @@ "bars": false, "dashLength": 10, "dashes": false, - "datasource": "${DS_LOCAL-P8S}", + "datasource": "${DS_NAME}", "editable": true, "error": false, "fill": 0, @@ -162,10 +163,10 @@ "format": "time_series", "interval": "", "intervalFactor": 2, - "legendFormat": "{{quantile}} ({{interval}})", + "legendFormat": "{{quantile}}", "metric": "", "refId": "A", - "step": 120 + "step": 20 } ], "thresholds": [], @@ -207,7 +208,7 @@ "bars": false, "dashLength": 10, "dashes": false, - "datasource": "${DS_LOCAL-P8S}", + "datasource": "${DS_NAME}", "description": "", "fill": 0, "id": 16, @@ -228,12 +229,7 @@ "pointradius": 5, "points": false, "renderer": "flot", - "seriesOverrides": [ - { - "alias": "total node memory", - "linewidth": 3 - } - ], + "seriesOverrides": [], "spaceLength": 10, "span": 3, "stack": false, @@ -247,27 +243,7 @@ "intervalFactor": 2, "legendFormat": "p8s process resident memory", "refId": "D", - "step": 120 - }, - { - "expr": "node_memory_Mapped{instance=~'[[node]].*'}", - "format": "time_series", - "hide": false, - "interval": "", - "intervalFactor": 2, - "legendFormat": "mmap'd memory", - "refId": "A", - "step": 120 - }, - { - "expr": "node_memory_MemTotal{instance=~'[[node]].*'}", - "format": "time_series", - "hide": false, - "interval": "", - "intervalFactor": 2, - "legendFormat": "total node memory", - "refId": "B", - "step": 120 + "step": 20 }, { "expr": "process_virtual_memory_bytes{job=\"prometheus\"}", @@ -276,7 +252,7 @@ "intervalFactor": 2, "legendFormat": "virtual memory", "refId": "C", - "step": 120 + "step": 20 } ], "thresholds": [], @@ -325,7 +301,7 @@ "rgba(237, 129, 40, 0.89)", "rgba(245, 54, 54, 0.9)" ], - "datasource": "${DS_LOCAL-P8S}", + "datasource": "${DS_NAME}", "format": "none", "gauge": { "maxValue": 100, @@ -377,7 +353,7 @@ "intervalFactor": 2, "legendFormat": "", "refId": "A", - "step": 600 + "step": 60 } ], "thresholds": "0.1,1", @@ -403,14 +379,14 @@ }, { "collapse": false, - "height": 227, + "height": "200", "panels": [ { "aliasColors": {}, "bars": false, "dashLength": 10, "dashes": false, - "datasource": "${DS_LOCAL-P8S}", + "datasource": "${DS_NAME}", "decimals": null, "editable": true, "error": false, @@ -449,7 +425,7 @@ "intervalFactor": 2, "legendFormat": "{{quantile}}", "refId": "A", - "step": 120 + "step": 20 } ], "thresholds": [], @@ -492,7 +468,7 @@ "bars": false, "dashLength": 10, "dashes": false, - "datasource": "${DS_LOCAL-P8S}", + "datasource": "${DS_NAME}", "fill": 0, "id": 29, "legend": { @@ -526,7 +502,7 @@ "legendFormat": "active_appenders", "metric": "", "refId": "A", - "step": 120 + "step": 20 }, { "expr": "sum(process_open_fds{job=\"prometheus\"})", @@ -535,7 +511,7 @@ "intervalFactor": 2, "legendFormat": "open_fds", "refId": "B", - "step": 120 + "step": 20 } ], "thresholds": [], @@ -582,7 +558,7 @@ "bars": false, "dashLength": 10, "dashes": false, - "datasource": "${DS_LOCAL-P8S}", + "datasource": "${DS_NAME}", "editable": true, "error": false, "fill": 0, @@ -617,7 +593,7 @@ "intervalFactor": 2, "legendFormat": "blocks", "refId": "A", - "step": 120 + "step": 20 } ], "thresholds": [], @@ -659,7 +635,7 @@ "bars": false, "dashLength": 10, "dashes": false, - "datasource": "${DS_LOCAL-P8S}", + "datasource": "${DS_NAME}", "decimals": null, "description": "", "fill": 0, @@ -694,7 +670,7 @@ "intervalFactor": 2, "legendFormat": "chunks", "refId": "A", - "step": 120 + "step": 20 } ], "thresholds": [], @@ -743,14 +719,14 @@ }, { "collapse": false, - "height": "250px", + "height": "200", "panels": [ { "aliasColors": {}, "bars": false, "dashLength": 10, "dashes": false, - "datasource": "${DS_LOCAL-P8S}", + "datasource": "${DS_NAME}", "decimals": null, "description": "", "fill": 0, @@ -779,7 +755,7 @@ } ], "spaceLength": 10, - "span": 4, + "span": 3, "stack": false, "steppedLine": false, "targets": [ @@ -791,7 +767,7 @@ "intervalFactor": 2, "legendFormat": "duration-{{p99}}", "refId": "A", - "step": 120 + "step": 20 }, { "expr": "irate(prometheus_tsdb_compactions_total[5m])", @@ -799,7 +775,7 @@ "intervalFactor": 2, "legendFormat": "compactions", "refId": "B", - "step": 120 + "step": 20 }, { "expr": "irate(prometheus_tsdb_compactions_failed_total[5m])", @@ -807,7 +783,7 @@ "intervalFactor": 2, "legendFormat": "failed", "refId": "C", - "step": 120 + "step": 20 }, { "expr": "irate(prometheus_tsdb_compactions_triggered_total[5m])", @@ -815,7 +791,7 @@ "intervalFactor": 2, "legendFormat": "triggered", "refId": "D", - "step": 120 + "step": 20 } ], "thresholds": [], @@ -859,7 +835,7 @@ "bars": false, "dashLength": 10, "dashes": false, - "datasource": "${DS_LOCAL-P8S}", + "datasource": "${DS_NAME}", "fill": 1, "id": 36, "legend": { @@ -886,7 +862,7 @@ } ], "spaceLength": 10, - "span": 4, + "span": 3, "stack": false, "steppedLine": false, "targets": [ @@ -896,7 +872,7 @@ "intervalFactor": 2, "legendFormat": "duration-p99", "refId": "A", - "step": 120 + "step": 20 }, { "expr": "irate(prometheus_tsdb_head_gc_duration_seconds_count[5m])", @@ -904,7 +880,7 @@ "intervalFactor": 2, "legendFormat": "collections", "refId": "B", - "step": 120 + "step": 20 } ], "thresholds": [], @@ -948,7 +924,7 @@ "bars": false, "dashLength": 10, "dashes": false, - "datasource": "${DS_LOCAL-P8S}", + "datasource": "${DS_NAME}", "fill": 1, "id": 32, "legend": { @@ -970,7 +946,7 @@ "renderer": "flot", "seriesOverrides": [], "spaceLength": 10, - "span": 4, + "span": 3, "stack": false, "steppedLine": false, "targets": [ @@ -980,7 +956,7 @@ "intervalFactor": 2, "legendFormat": "reloads", "refId": "A", - "step": 120 + "step": 20 }, { "expr": "rate(prometheus_tsdb_reloads_failures_total{job=\"prometheus\"}[5m])", @@ -989,7 +965,7 @@ "intervalFactor": 2, "legendFormat": "failures", "refId": "B", - "step": 120 + "step": 20 } ], "thresholds": [], @@ -1027,6 +1003,82 @@ "show": true } ] + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "${DS_NAME}", + "fill": 0, + "id": 38, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "links": [], + "nullPointMode": "null", + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "span": 3, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "prometheus_engine_query_duration_seconds{job=\"prometheus\", quantile=\"0.99\"}", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "{{slice}}_p99", + "refId": "A", + "step": 20 + } + ], + "thresholds": [], + "timeFrom": null, + "timeShift": null, + "title": "Query Durations", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ] } ], "repeat": null, @@ -1035,662 +1087,6 @@ "showTitle": false, "title": "New row", "titleSize": "h6" - }, - { - "collapse": false, - "height": 250, - "panels": [ - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": "${DS_LOCAL-P8S}", - "editable": true, - "error": false, - "fill": 0, - "grid": {}, - "id": 34, - "legend": { - "avg": false, - "current": false, - "max": false, - "min": false, - "show": true, - "total": false, - "values": false - }, - "lines": true, - "linewidth": 1, - "links": [], - "minSpan": 2, - "nullPointMode": "connected", - "percentage": false, - "pointradius": 5, - "points": false, - "renderer": "flot", - "repeat": null, - "seriesOverrides": [ - { - "alias": "/.*_read$/", - "transform": "negative-Y" - } - ], - "spaceLength": 10, - "span": 4, - "stack": false, - "steppedLine": false, - "targets": [ - { - "expr": "sum(rate(node_disk_reads_completed{instance=~'$node.*'}[5m]))", - "format": "time_series", - "interval": "", - "intervalFactor": 4, - "legendFormat": "read", - "metric": "", - "refId": "A", - "step": 240, - "target": "" - }, - { - "expr": "sum(rate(node_disk_writes_completed{instance=~'$node.*'}[5m]))", - "format": "time_series", - "intervalFactor": 2, - "legendFormat": "write", - "metric": "", - "refId": "B", - "step": 120 - } - ], - "thresholds": [], - "timeFrom": null, - "timeShift": null, - "title": "Disk IOs / sec", - "tooltip": { - "msResolution": false, - "shared": false, - "sort": 0, - "value_type": "cumulative" - }, - "type": "graph", - "xaxis": { - "buckets": null, - "mode": "time", - "name": null, - "show": true, - "values": [] - }, - "yaxes": [ - { - "format": "short", - "label": "IO/second read (-) / write (+)", - "logBase": 1, - "max": null, - "min": null, - "show": true - }, - { - "format": "short", - "logBase": 1, - "max": null, - "min": null, - "show": true - } - ] - }, - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": "${DS_LOCAL-P8S}", - "editable": true, - "error": false, - "fill": 0, - "grid": {}, - "id": 39, - "legend": { - "avg": false, - "current": false, - "max": false, - "min": false, - "show": true, - "total": false, - "values": false - }, - "lines": true, - "linewidth": 1, - "links": [], - "minSpan": 2, - "nullPointMode": "connected", - "percentage": false, - "pointradius": 5, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "span": 4, - "stack": false, - "steppedLine": false, - "targets": [ - { - "expr": "sum(rate(node_disk_io_time_weighted{instance=~'$node.*'}[5m]))", - "format": "time_series", - "interval": "", - "intervalFactor": 4, - "legendFormat": "weighted", - "metric": "", - "refId": "A", - "step": 240, - "target": "" - }, - { - "expr": "sum(rate(node_disk_io_time_ms{instance=~'$node.*'}[5m]))", - "format": "time_series", - "intervalFactor": 2, - "legendFormat": "time", - "metric": "", - "refId": "B", - "step": 120 - } - ], - "thresholds": [], - "timeFrom": null, - "timeShift": null, - "title": "Disk I/O Time", - "tooltip": { - "msResolution": false, - "shared": false, - "sort": 0, - "value_type": "cumulative" - }, - "type": "graph", - "xaxis": { - "buckets": null, - "mode": "time", - "name": null, - "show": true, - "values": [] - }, - "yaxes": [ - { - "format": "ms", - "label": "", - "logBase": 1, - "max": null, - "min": null, - "show": true - }, - { - "format": "ms", - "logBase": 1, - "max": null, - "min": null, - "show": false - } - ] - }, - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": "${DS_LOCAL-P8S}", - "editable": true, - "error": false, - "fill": 0, - "grid": {}, - "id": 38, - "legend": { - "avg": false, - "current": false, - "max": false, - "min": false, - "show": true, - "total": false, - "values": false - }, - "lines": true, - "linewidth": 1, - "links": [], - "minSpan": 2, - "nullPointMode": "connected", - "percentage": false, - "pointradius": 5, - "points": false, - "renderer": "flot", - "seriesOverrides": [ - { - "alias": "/.*_read$/", - "transform": "negative-Y" - } - ], - "spaceLength": 10, - "span": 4, - "stack": false, - "steppedLine": false, - "targets": [ - { - "expr": "sum(rate(node_disk_bytes_read{instance=~'$node.*'}[5m]))", - "format": "time_series", - "interval": "", - "intervalFactor": 4, - "legendFormat": "read", - "metric": "", - "refId": "A", - "step": 240, - "target": "" - }, - { - "expr": "sum(rate(node_disk_bytes_written{instance=~'$node.*'}[5m]))", - "format": "time_series", - "intervalFactor": 2, - "legendFormat": "write", - "metric": "", - "refId": "B", - "step": 120 - } - ], - "thresholds": [], - "timeFrom": null, - "timeShift": null, - "title": "Disk Throughput", - "tooltip": { - "msResolution": false, - "shared": false, - "sort": 0, - "value_type": "cumulative" - }, - "type": "graph", - "xaxis": { - "buckets": null, - "mode": "time", - "name": null, - "show": true, - "values": [] - }, - "yaxes": [ - { - "format": "bytes", - "label": "read(-) / write (+)", - "logBase": 1, - "max": null, - "min": null, - "show": true - }, - { - "format": "bytes", - "logBase": 1, - "max": null, - "min": null, - "show": true - } - ] - } - ], - "repeat": null, - "repeatIteration": null, - "repeatRowId": null, - "showTitle": false, - "title": "Dashboard Row", - "titleSize": "h6" - }, - { - "collapse": false, - "height": 250, - "panels": [ - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": "${DS_LOCAL-P8S}", - "decimals": 3, - "editable": true, - "error": false, - "fill": 10, - "grid": {}, - "id": 27, - "legend": { - "alignAsTable": false, - "avg": false, - "current": false, - "hideEmpty": false, - "max": false, - "min": false, - "rightSide": false, - "show": true, - "total": false, - "values": false - }, - "lines": true, - "linewidth": 0, - "links": [], - "minSpan": 2, - "nullPointMode": "connected", - "percentage": true, - "pointradius": 5, - "points": false, - "renderer": "flot", - "repeat": null, - "seriesOverrides": [], - "spaceLength": 10, - "span": 6, - "stack": true, - "steppedLine": false, - "targets": [ - { - "expr": "sum by (mode)(irate(node_cpu{mode=\"system\", instance=~'[[node]].*', _ftio=\"\"}[5m]))", - "format": "time_series", - "interval": "", - "intervalFactor": 2, - "legendFormat": "{{mode}}", - "metric": "", - "refId": "A", - "step": 60, - "target": "" - }, - { - "expr": "sum by (mode)(irate(node_cpu{mode='user', instance=~'[[node]].*', _ftio=\"\"}[5m]))", - "format": "time_series", - "interval": "", - "intervalFactor": 2, - "legendFormat": "user", - "refId": "B", - "step": 60 - }, - { - "expr": "sum by (mode)(irate(node_cpu{mode='nice', instance=~'[[node]].*', _ftio=\"\"}[5m]))", - "format": "time_series", - "interval": "", - "intervalFactor": 2, - "legendFormat": "nice", - "refId": "C", - "step": 60 - }, - { - "expr": "sum by (mode)(irate(node_cpu{mode='iowait', instance=~'[[node]].*', _ftio=\"\"}[5m]))", - "format": "time_series", - "interval": "", - "intervalFactor": 2, - "legendFormat": "iowait", - "refId": "E", - "step": 60 - }, - { - "expr": "sum by (mode)(irate(node_cpu{mode='steal', instance=~'[[node]].*', _ftio=\"\"}[5m]))", - "format": "time_series", - "intervalFactor": 2, - "legendFormat": "steal", - "refId": "H", - "step": 60 - }, - { - "expr": "sum by (mode)(irate(node_cpu{mode='idle', instance=~'[[node]].*', _ftio=\"\"}[5m]))", - "format": "time_series", - "interval": "", - "intervalFactor": 2, - "legendFormat": "idle", - "refId": "D", - "step": 60 - }, - { - "expr": "sum by (mode)(irate(node_cpu{mode='irq', instance=~'[[node]].*', _ftio=\"\"}[5m]))", - "format": "time_series", - "interval": "", - "intervalFactor": 2, - "legendFormat": "irq", - "refId": "F", - "step": 60 - }, - { - "expr": "sum by (mode)(irate(node_cpu{mode='softirq', instance=~'[[node]].*', _ftio=\"\"}[5m]))", - "format": "time_series", - "interval": "", - "intervalFactor": 2, - "legendFormat": "softirq", - "refId": "G", - "step": 60 - }, - { - "expr": "sum by (mode)(irate(node_cpu{mode='guest', instance=~'[[node]].*', _ftio=\"\"}[5m]))", - "format": "time_series", - "interval": "", - "intervalFactor": 2, - "legendFormat": "guest", - "refId": "I", - "step": 60 - } - ], - "thresholds": [], - "timeFrom": null, - "timeShift": null, - "title": "Host CPU", - "tooltip": { - "msResolution": false, - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "buckets": null, - "mode": "time", - "name": null, - "show": true, - "values": [] - }, - "yaxes": [ - { - "format": "short", - "label": "%", - "logBase": 1, - "max": 100, - "min": 0, - "show": true - }, - { - "format": "short", - "logBase": 1, - "max": null, - "min": null, - "show": true - } - ] - }, - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": "${DS_LOCAL-P8S}", - "decimals": 2, - "editable": true, - "error": false, - "fill": 9, - "grid": {}, - "id": 28, - "legend": { - "avg": false, - "current": false, - "max": false, - "min": false, - "show": true, - "total": false, - "values": false - }, - "lines": true, - "linewidth": 1, - "links": [], - "minSpan": 2, - "nullPointMode": "connected", - "percentage": false, - "pointradius": 5, - "points": false, - "renderer": "flot", - "repeat": null, - "seriesOverrides": [ - { - "alias": "total", - "color": "#629E51", - "fill": 0, - "linewidth": 4, - "stack": "D", - "zindex": 2 - }, - { - "alias": "swapped", - "color": "#BF1B00", - "fill": 10, - "linewidth": 4, - "stack": true, - "zindex": 2 - }, - { - "alias": "apps", - "color": "#EAB839" - }, - { - "alias": "buffers", - "color": "#BA43A9" - }, - { - "alias": "cached", - "color": "#7EB26D" - }, - { - "alias": "misc", - "color": "#447EBC", - "fill": 3 - }, - { - "alias": "free", - "color": "#70DBED", - "fill": 3 - } - ], - "spaceLength": 10, - "span": 6, - "stack": true, - "steppedLine": false, - "targets": [ - { - "expr": "sum(( node_memory_MemTotal{instance=~'[[node]].*', _ftio=\"\"} - node_memory_MemFree{instance=~'[[node]].*', _ftio=\"\"} - node_memory_Buffers{instance=~'[[node]].*', _ftio=\"\"} - node_memory_Cached{instance=~'[[node]].*', _ftio=\"\"} - node_memory_SwapCached{instance=~'[[node]].*', _ftio=\"\"} - node_memory_Slab{instance=~'[[node]].*', _ftio=\"\"} - node_memory_PageTables{instance=~'[[node]].*', _ftio=\"\"} - node_memory_VmallocUsed{instance=~'[[node]].*', _ftio=\"\"} ))", - "format": "time_series", - "hide": false, - "interval": "", - "intervalFactor": 2, - "legendFormat": "apps", - "metric": "", - "refId": "C", - "step": 60 - }, - { - "expr": "sum(node_memory_Buffers{instance=~'[[node]].*', _ftio=\"\"})", - "format": "time_series", - "hide": false, - "interval": "", - "intervalFactor": 2, - "legendFormat": "buffers", - "metric": "", - "refId": "A", - "step": 60 - }, - { - "expr": "sum(node_memory_Cached{instance=~'[[node]].*', _ftio=\"\"})", - "format": "time_series", - "hide": false, - "interval": "", - "intervalFactor": 2, - "legendFormat": "cached", - "metric": "", - "refId": "E", - "step": 60 - }, - { - "expr": "sum({__name__=~\"node_memory_(SwapCached|Slab|PageTables|VmallocUsed)\", instance=~'[[node]].*', _ftio=\"\"})", - "format": "time_series", - "hide": false, - "interval": "", - "intervalFactor": 2, - "legendFormat": "misc", - "refId": "F", - "step": 60 - }, - { - "expr": "sum(node_memory_MemFree{instance=~'[[node]].*', _ftio=\"\"})", - "format": "time_series", - "hide": false, - "interval": "", - "intervalFactor": 2, - "legendFormat": "free", - "metric": "", - "refId": "B", - "step": 60 - }, - { - "expr": "sum(node_memory_SwapTotal{instance=~'[[node]].*', _ftio=\"\"}) - sum(node_memory_SwapFree{instance=~'[[node]].*', _ftio=\"\"})", - "format": "time_series", - "interval": "", - "intervalFactor": 2, - "legendFormat": "swapped", - "refId": "G", - "step": 60 - }, - { - "expr": "sum(node_memory_MemTotal{instance=~'[[node]].*', _ftio=\"\"}) ", - "format": "time_series", - "interval": "", - "intervalFactor": 2, - "legendFormat": "total", - "metric": "", - "refId": "D", - "step": 60 - } - ], - "thresholds": [], - "timeFrom": null, - "timeShift": null, - "title": "Host Memory", - "tooltip": { - "msResolution": false, - "shared": true, - "sort": 2, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "buckets": null, - "mode": "time", - "name": null, - "show": true, - "values": [] - }, - "yaxes": [ - { - "format": "bytes", - "label": "GB", - "logBase": 1, - "max": null, - "min": "0", - "show": true - }, - { - "format": "short", - "logBase": 1, - "max": null, - "min": null, - "show": true - } - ] - } - ], - "repeat": null, - "repeatIteration": null, - "repeatRowId": null, - "showTitle": false, - "title": "Dashboard Row", - "titleSize": "h6" } ], "schemaVersion": 14, @@ -1699,31 +1095,10 @@ "prometheus" ], "templating": { - "list": [ - { - "allValue": null, - "current": {}, - "datasource": "${DS_LOCAL-P8S}", - "hide": 0, - "includeAll": false, - "label": "Node", - "multi": false, - "name": "node", - "options": [], - "query": "label_values(prometheus_target_interval_length_seconds_count, instance)", - "refresh": 2, - "regex": "", - "sort": 0, - "tagValuesQuery": "", - "tags": [], - "tagsQuery": "", - "type": "query", - "useTags": false - } - ] + "list": [] }, "time": { - "from": "now-6h", + "from": "now-1h", "to": "now" }, "timepicker": { @@ -1754,5 +1129,5 @@ }, "timezone": "browser", "title": "Prometheus 2.0 Stats", - "version": 1 + "version": 12 } From 9151a2468d80817713c2fb57c5f41ca32fe691d0 Mon Sep 17 00:00:00 2001 From: Cody Boggs Date: Tue, 14 Nov 2017 09:21:46 -0700 Subject: [PATCH 11/17] fix scrape duration, add rule eval iteration stats, and reorg a bit --- .../dashboards/prometheus_2_stats.json | 470 +++++++++++------- 1 file changed, 287 insertions(+), 183 deletions(-) diff --git a/public/app/plugins/datasource/prometheus/dashboards/prometheus_2_stats.json b/public/app/plugins/datasource/prometheus/dashboards/prometheus_2_stats.json index ecbaa35deff..adff038cb09 100644 --- a/public/app/plugins/datasource/prometheus/dashboards/prometheus_2_stats.json +++ b/public/app/plugins/datasource/prometheus/dashboards/prometheus_2_stats.json @@ -159,7 +159,7 @@ "steppedLine": false, "targets": [ { - "expr": "max(prometheus_target_interval_length_seconds{job=\"prometheus\", quantile!=\"0.01\", quantile!=\"0.05\"}) by (quantile)", + "expr": "max(scrape_duration_seconds{job=\"prometheus\"})", "format": "time_series", "interval": "", "intervalFactor": 2, @@ -348,7 +348,7 @@ "tableColumn": "", "targets": [ { - "expr": "tsdb_wal_corruptions_total", + "expr": "tsdb_wal_corruptions_total{job=\"prometheus\"}", "format": "time_series", "intervalFactor": 2, "legendFormat": "", @@ -381,88 +381,6 @@ "collapse": false, "height": "200", "panels": [ - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": "${DS_NAME}", - "decimals": null, - "editable": true, - "error": false, - "fill": 0, - "grid": {}, - "id": 35, - "legend": { - "alignAsTable": false, - "avg": false, - "current": false, - "hideEmpty": true, - "max": false, - "min": false, - "show": true, - "total": false, - "values": false - }, - "lines": true, - "linewidth": 1, - "links": [], - "nullPointMode": "connected", - "percentage": false, - "pointradius": 5, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "span": 3, - "stack": false, - "steppedLine": false, - "targets": [ - { - "expr": "max(prometheus_evaluator_duration_seconds{quantile!=\"0.01\", quantile!=\"0.05\"}) by (quantile)", - "format": "time_series", - "interval": "", - "intervalFactor": 2, - "legendFormat": "{{quantile}}", - "refId": "A", - "step": 20 - } - ], - "thresholds": [], - "timeFrom": null, - "timeShift": null, - "title": "Rule Eval Duration", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "cumulative" - }, - "type": "graph", - "xaxis": { - "buckets": null, - "mode": "time", - "name": null, - "show": true, - "values": [] - }, - "yaxes": [ - { - "format": "s", - "label": "", - "logBase": 1, - "max": null, - "min": null, - "show": true - }, - { - "format": "short", - "logBase": 1, - "max": null, - "min": null, - "show": true - } - ] - }, { "aliasColors": {}, "bars": false, @@ -588,7 +506,7 @@ "steppedLine": false, "targets": [ { - "expr": "prometheus_tsdb_blocks_loaded", + "expr": "prometheus_tsdb_blocks_loaded{job=\"prometheus\"}", "format": "time_series", "intervalFactor": 2, "legendFormat": "blocks", @@ -664,7 +582,7 @@ "steppedLine": false, "targets": [ { - "expr": "prometheus_tsdb_head_chunks", + "expr": "prometheus_tsdb_head_chunks{job=\"prometheus\"}", "format": "time_series", "interval": "", "intervalFactor": 2, @@ -708,6 +626,95 @@ "show": false } ] + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "${DS_NAME}", + "fill": 1, + "id": 36, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "links": [], + "nullPointMode": "null", + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [ + { + "alias": "duration-p99", + "yaxis": 2 + } + ], + "spaceLength": 10, + "span": 3, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "prometheus_tsdb_head_gc_duration_seconds{job=\"prometheus\",quantile=\"0.99\"}", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "duration-p99", + "refId": "A", + "step": 20 + }, + { + "expr": "irate(prometheus_tsdb_head_gc_duration_seconds_count{job=\"prometheus\"}[5m])", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "collections", + "refId": "B", + "step": 20 + } + ], + "thresholds": [], + "timeFrom": null, + "timeShift": null, + "title": "Head Block GC Activity", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": "0", + "show": true + }, + { + "format": "s", + "label": null, + "logBase": 1, + "max": null, + "min": "0", + "show": true + } + ] } ], "repeat": null, @@ -755,12 +762,12 @@ } ], "spaceLength": 10, - "span": 3, + "span": 4, "stack": false, "steppedLine": false, "targets": [ { - "expr": "histogram_quantile(0.99, sum(rate(prometheus_tsdb_compaction_duration_bucket[5m])) by (le))", + "expr": "histogram_quantile(0.99, sum(rate(prometheus_tsdb_compaction_duration_bucket{job=\"prometheus\"}[5m])) by (le))", "format": "time_series", "hide": false, "interval": "", @@ -770,7 +777,7 @@ "step": 20 }, { - "expr": "irate(prometheus_tsdb_compactions_total[5m])", + "expr": "irate(prometheus_tsdb_compactions_total{job=\"prometheus\"}[5m])", "format": "time_series", "intervalFactor": 2, "legendFormat": "compactions", @@ -778,7 +785,7 @@ "step": 20 }, { - "expr": "irate(prometheus_tsdb_compactions_failed_total[5m])", + "expr": "irate(prometheus_tsdb_compactions_failed_total{job=\"prometheus\"}[5m])", "format": "time_series", "intervalFactor": 2, "legendFormat": "failed", @@ -786,7 +793,7 @@ "step": 20 }, { - "expr": "irate(prometheus_tsdb_compactions_triggered_total[5m])", + "expr": "irate(prometheus_tsdb_compactions_triggered_total{job=\"prometheus\"}[5m])", "format": "time_series", "intervalFactor": 2, "legendFormat": "triggered", @@ -830,95 +837,6 @@ } ] }, - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": "${DS_NAME}", - "fill": 1, - "id": 36, - "legend": { - "avg": false, - "current": false, - "max": false, - "min": false, - "show": true, - "total": false, - "values": false - }, - "lines": true, - "linewidth": 1, - "links": [], - "nullPointMode": "null", - "percentage": false, - "pointradius": 5, - "points": false, - "renderer": "flot", - "seriesOverrides": [ - { - "alias": "duration-p99", - "yaxis": 2 - } - ], - "spaceLength": 10, - "span": 3, - "stack": false, - "steppedLine": false, - "targets": [ - { - "expr": "prometheus_tsdb_head_gc_duration_seconds{quantile=\"0.99\"}", - "format": "time_series", - "intervalFactor": 2, - "legendFormat": "duration-p99", - "refId": "A", - "step": 20 - }, - { - "expr": "irate(prometheus_tsdb_head_gc_duration_seconds_count[5m])", - "format": "time_series", - "intervalFactor": 2, - "legendFormat": "collections", - "refId": "B", - "step": 20 - } - ], - "thresholds": [], - "timeFrom": null, - "timeShift": null, - "title": "Head Block GC Activity", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "buckets": null, - "mode": "time", - "name": null, - "show": true, - "values": [] - }, - "yaxes": [ - { - "format": "short", - "label": null, - "logBase": 1, - "max": null, - "min": "0", - "show": true - }, - { - "format": "s", - "label": null, - "logBase": 1, - "max": null, - "min": "0", - "show": true - } - ] - }, { "aliasColors": {}, "bars": false, @@ -946,7 +864,7 @@ "renderer": "flot", "seriesOverrides": [], "spaceLength": 10, - "span": 3, + "span": 4, "stack": false, "steppedLine": false, "targets": [ @@ -1031,7 +949,7 @@ "renderer": "flot", "seriesOverrides": [], "spaceLength": 10, - "span": 3, + "span": 4, "stack": false, "steppedLine": false, "targets": [ @@ -1087,6 +1005,192 @@ "showTitle": false, "title": "New row", "titleSize": "h6" + }, + { + "collapse": false, + "height": 250, + "panels": [ + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "${DS_NAME}", + "decimals": null, + "editable": true, + "error": false, + "fill": 0, + "grid": {}, + "id": 35, + "legend": { + "alignAsTable": false, + "avg": false, + "current": false, + "hideEmpty": true, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "links": [], + "nullPointMode": "connected", + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "span": 6, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "max(prometheus_evaluator_duration_seconds{job=\"prometheus\", quantile!=\"0.01\", quantile!=\"0.05\"}) by (quantile)", + "format": "time_series", + "interval": "", + "intervalFactor": 2, + "legendFormat": "{{quantile}}", + "refId": "A", + "step": 10 + } + ], + "thresholds": [], + "timeFrom": null, + "timeShift": null, + "title": "Rule Eval Duration", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "cumulative" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "s", + "label": "", + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ] + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "${DS_NAME}", + "fill": 1, + "id": 39, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "links": [], + "nullPointMode": "null", + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "span": 6, + "stack": true, + "steppedLine": false, + "targets": [ + { + "expr": "rate(prometheus_evaluator_iterations_missed_total{job=\"prometheus\"}[5m])", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "missed", + "refId": "B", + "step": 10 + }, + { + "expr": "rate(prometheus_evaluator_iterations_skipped_total{job=\"prometheus\"}[5m])", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "skipped", + "refId": "C", + "step": 10 + }, + { + "expr": "rate(prometheus_evaluator_iterations_total{job=\"prometheus\"}[5m])", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "iterations", + "refId": "A", + "step": 10 + } + ], + "thresholds": [], + "timeFrom": null, + "timeShift": null, + "title": "Rule Eval Activity", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ] + } + ], + "repeat": null, + "repeatIteration": null, + "repeatRowId": null, + "showTitle": false, + "title": "Dashboard Row", + "titleSize": "h6" } ], "schemaVersion": 14, @@ -1129,5 +1233,5 @@ }, "timezone": "browser", "title": "Prometheus 2.0 Stats", - "version": 12 + "version": 19 } From 999b1211b6d4da42e14e65ba8d0f171efa039043 Mon Sep 17 00:00:00 2001 From: Cody Boggs Date: Mon, 20 Nov 2017 09:56:07 -0700 Subject: [PATCH 12/17] show top 5 max scrape durations by job, and fix legend format --- .../datasource/prometheus/dashboards/prometheus_2_stats.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/app/plugins/datasource/prometheus/dashboards/prometheus_2_stats.json b/public/app/plugins/datasource/prometheus/dashboards/prometheus_2_stats.json index adff038cb09..6d6a1972d16 100644 --- a/public/app/plugins/datasource/prometheus/dashboards/prometheus_2_stats.json +++ b/public/app/plugins/datasource/prometheus/dashboards/prometheus_2_stats.json @@ -159,11 +159,11 @@ "steppedLine": false, "targets": [ { - "expr": "max(scrape_duration_seconds{job=\"prometheus\"})", + "expr": "topk(5, max(scrape_duration_seconds) by (job))", "format": "time_series", "interval": "", "intervalFactor": 2, - "legendFormat": "{{quantile}}", + "legendFormat": "{{job}}", "metric": "", "refId": "A", "step": 20 From 0390b4187b9ddfea0aed8bba2d70132ffd0fec18 Mon Sep 17 00:00:00 2001 From: bergquist Date: Tue, 21 Nov 2017 10:12:01 +0100 Subject: [PATCH 13/17] prom: add prom2 dashboard as bundled dashboard --- public/app/plugins/datasource/prometheus/plugin.json | 1 + 1 file changed, 1 insertion(+) diff --git a/public/app/plugins/datasource/prometheus/plugin.json b/public/app/plugins/datasource/prometheus/plugin.json index bd19462579b..cb1a024a1d9 100644 --- a/public/app/plugins/datasource/prometheus/plugin.json +++ b/public/app/plugins/datasource/prometheus/plugin.json @@ -5,6 +5,7 @@ "includes": [ {"type": "dashboard", "name": "Prometheus Stats", "path": "dashboards/prometheus_stats.json"}, + {"type": "dashboard", "name": "Prometheus 2.0 Stats", "path": "dashboards/prometheus_2_stats.json"}, {"type": "dashboard", "name": "Grafana Stats", "path": "dashboards/grafana_stats.json"} ], From 0d12b37dfdbc4763e31394f621aa0c1b527f71f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Tue, 21 Nov 2017 11:27:53 +0100 Subject: [PATCH 14/17] fix: alert list panel now works correctly after adding manual annotation on dashboard, fixes #9951 --- CHANGELOG.md | 1 + pkg/api/annotations.go | 1 + pkg/services/annotations/annotations.go | 1 + pkg/services/sqlstore/annotation.go | 4 ++++ pkg/services/sqlstore/annotation_test.go | 14 ++++++++++++++ 5 files changed, 21 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ec9a9293b23..7a75ad758c8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -37,6 +37,7 @@ ## Fixes * **Gzip**: Fixes bug gravatar images when gzip was enabled [#5952](https://github.com/grafana/grafana/issues/5952) +* **Alert list**: Now shows alert state changes even after adding manual annotations on dashboard [#9951](https://github.com/grafana/grafana/issues/9951) # 4.6.2 (2017-11-16) diff --git a/pkg/api/annotations.go b/pkg/api/annotations.go index 32a0a3035d3..0bf95557abc 100644 --- a/pkg/api/annotations.go +++ b/pkg/api/annotations.go @@ -22,6 +22,7 @@ func GetAnnotations(c *middleware.Context) Response { PanelId: c.QueryInt64("panelId"), Limit: c.QueryInt64("limit"), Tags: c.QueryStrings("tags"), + Type: c.Query("type"), } repo := annotations.GetRepository() diff --git a/pkg/services/annotations/annotations.go b/pkg/services/annotations/annotations.go index 2fdc824f172..02f927a76ba 100644 --- a/pkg/services/annotations/annotations.go +++ b/pkg/services/annotations/annotations.go @@ -17,6 +17,7 @@ type ItemQuery struct { DashboardId int64 `json:"dashboardId"` PanelId int64 `json:"panelId"` Tags []string `json:"tags"` + Type string `json:"type"` Limit int64 `json:"limit"` } diff --git a/pkg/services/sqlstore/annotation.go b/pkg/services/sqlstore/annotation.go index d97db10f630..effffb8bab4 100644 --- a/pkg/services/sqlstore/annotation.go +++ b/pkg/services/sqlstore/annotation.go @@ -158,6 +158,10 @@ func (r *SqlAnnotationRepo) Find(query *annotations.ItemQuery) ([]*annotations.I params = append(params, query.From, query.To) } + if query.Type == "alert" { + sql.WriteString(` AND annotation.alert_id > 0`) + } + if len(query.Tags) > 0 { keyValueFilters := []string{} diff --git a/pkg/services/sqlstore/annotation_test.go b/pkg/services/sqlstore/annotation_test.go index e1902b63fa8..2afd4479b66 100644 --- a/pkg/services/sqlstore/annotation_test.go +++ b/pkg/services/sqlstore/annotation_test.go @@ -42,6 +42,7 @@ func TestAnnotations(t *testing.T) { UserId: 1, DashboardId: 1, Text: "hello", + Type: "alert", Epoch: 10, Tags: []string{"outage", "error", "type:outage", "server:server-1"}, } @@ -91,6 +92,19 @@ func TestAnnotations(t *testing.T) { So(items, ShouldHaveLength, 0) }) + Convey("Should not find one when type filter does not match", func() { + items, err := repo.Find(&annotations.ItemQuery{ + OrgId: 1, + DashboardId: 1, + From: 1, + To: 15, + Type: "alert", + }) + + So(err, ShouldBeNil) + So(items, ShouldHaveLength, 0) + }) + Convey("Should find one when all tag filters does match", func() { items, err := repo.Find(&annotations.ItemQuery{ OrgId: 1, From 5dd9582520dd6cb427da7497ef2a08c2af05952f Mon Sep 17 00:00:00 2001 From: Daniel Lee Date: Tue, 21 Nov 2017 13:21:19 +0100 Subject: [PATCH 15/17] mysql: add data source support for Azure MySql Fixes #9649 --- pkg/tsdb/mysql/mysql.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/tsdb/mysql/mysql.go b/pkg/tsdb/mysql/mysql.go index bdb48867b6e..e5c6b92f245 100644 --- a/pkg/tsdb/mysql/mysql.go +++ b/pkg/tsdb/mysql/mysql.go @@ -35,7 +35,7 @@ func NewMysqlQueryEndpoint(datasource *models.DataSource) (tsdb.TsdbQueryEndpoin MacroEngine: NewMysqlMacroEngine(), } - cnnstr := fmt.Sprintf("%s:%s@%s(%s)/%s?collation=utf8mb4_unicode_ci&parseTime=true&loc=UTC", + cnnstr := fmt.Sprintf("%s:%s@%s(%s)/%s?collation=utf8mb4_unicode_ci&parseTime=true&loc=UTC&allowNativePasswords=true", datasource.User, datasource.Password, "tcp", From 43a6a65f8b46ec26722b62616c7b442e089b5e23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Tue, 21 Nov 2017 14:39:09 +0100 Subject: [PATCH 16/17] fix: fixed issue with metric segment introduced in graphite tags query editor PR --- public/app/core/directives/metric_segment.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/public/app/core/directives/metric_segment.js b/public/app/core/directives/metric_segment.js index da21a5b3c45..2754f8d8c6e 100644 --- a/public/app/core/directives/metric_segment.js +++ b/public/app/core/directives/metric_segment.js @@ -48,7 +48,10 @@ function (_, $, coreModule) { segment.html = selected.html || selected.value; segment.fake = false; segment.expandable = selected.expandable; - segment.type = selected.type; + + if (selected.type) { + segment.type = selected.type; + } } else if (segment.custom !== 'false') { segment.value = value; From 3a772c7f7f68b2ac8f115650f6d0e94af206ada0 Mon Sep 17 00:00:00 2001 From: bergquist Date: Tue, 21 Nov 2017 15:01:59 +0100 Subject: [PATCH 17/17] allows head requests for /api/health endpoint closes #9955 --- pkg/api/http_server.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/api/http_server.go b/pkg/api/http_server.go index eadaa117e86..89456d20d8c 100644 --- a/pkg/api/http_server.go +++ b/pkg/api/http_server.go @@ -194,7 +194,8 @@ func (hs *HttpServer) metricsEndpoint(ctx *macaron.Context) { } func (hs *HttpServer) healthHandler(ctx *macaron.Context) { - if ctx.Req.Method != "GET" || ctx.Req.URL.Path != "/api/health" { + notHeadOrGet := ctx.Req.Method != http.MethodGet && ctx.Req.Method != http.MethodHead + if notHeadOrGet || ctx.Req.URL.Path != "/api/health" { return }