From 183bb1785beec231883d01dc56b3336fdb0b2e3f Mon Sep 17 00:00:00 2001 From: Marcus Efraimsson Date: Tue, 9 Oct 2018 14:52:08 +0200 Subject: [PATCH 01/14] fix /api/org/users so that query and limit querystrings works (cherry picked from commit c0b7ca39022a5d5d6080afbedce8d8c9760a4187) --- pkg/api/org_users.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/api/org_users.go b/pkg/api/org_users.go index 4e2ed36431e..13af654e4c7 100644 --- a/pkg/api/org_users.go +++ b/pkg/api/org_users.go @@ -45,7 +45,7 @@ func addOrgUserHelper(cmd m.AddOrgUserCommand) Response { // GET /api/org/users func GetOrgUsersForCurrentOrg(c *m.ReqContext) Response { - return getOrgUsersHelper(c.OrgId, c.Params("query"), c.ParamsInt("limit")) + return getOrgUsersHelper(c.OrgId, c.Query("query"), c.QueryInt("limit")) } // GET /api/orgs/:orgId/users From 2af029232968c74e2c08ef385217e38b1e27a805 Mon Sep 17 00:00:00 2001 From: Marcus Efraimsson Date: Thu, 11 Oct 2018 11:46:07 +0200 Subject: [PATCH 02/14] fix phantomjs render of graph panel when legend as table to the right (cherry picked from commit fc79ba30aefaa9b5754d36197d120a65cf1dd451) --- public/sass/components/_panel_graph.scss | 1 + 1 file changed, 1 insertion(+) diff --git a/public/sass/components/_panel_graph.scss b/public/sass/components/_panel_graph.scss index 01fcc5a3e64..63d9169a4f8 100644 --- a/public/sass/components/_panel_graph.scss +++ b/public/sass/components/_panel_graph.scss @@ -137,6 +137,7 @@ .graph-legend-table { display: table; + width: auto; .graph-legend-scroll { display: table; From 19df00e2d4171b6e26256a33f438cb9120c1f924 Mon Sep 17 00:00:00 2001 From: Erik Sundell Date: Thu, 11 Oct 2018 15:10:47 +0200 Subject: [PATCH 03/14] stackdriver: check if array is empty to prevent filter from crashing. This closes #13607 (cherry picked from commit c84cf1f598cfbb9f0fa719154762e287e1a917b5) --- public/app/plugins/datasource/stackdriver/filter_segments.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/app/plugins/datasource/stackdriver/filter_segments.ts b/public/app/plugins/datasource/stackdriver/filter_segments.ts index 8d193f663c2..9eb27f31975 100644 --- a/public/app/plugins/datasource/stackdriver/filter_segments.ts +++ b/public/app/plugins/datasource/stackdriver/filter_segments.ts @@ -87,7 +87,7 @@ export class FilterSegments { } // remove condition if it is first segment - if (index === 0 && this.filterSegments[0].type === 'condition') { + if (index === 0 && this.filterSegments.length > 0 && this.filterSegments[0].type === 'condition') { this.filterSegments.splice(0, 1); } } From 0082bb0dbcc8394804dc13d036f24e328245dd92 Mon Sep 17 00:00:00 2001 From: Marcus Efraimsson Date: Fri, 12 Oct 2018 14:15:44 +0200 Subject: [PATCH 04/14] make sure to add all variable nodes to dag before linking variables (cherry picked from commit 4b1a2d3b11117ef785fe5bcb4190cca1dd68f626) --- public/app/core/utils/dag.test.ts | 12 +++++++++++ public/app/core/utils/dag.ts | 20 +++++++++++++++++-- .../app/features/templating/variable_srv.ts | 6 ++++-- 3 files changed, 34 insertions(+), 4 deletions(-) diff --git a/public/app/core/utils/dag.test.ts b/public/app/core/utils/dag.test.ts index 064da13806b..4ee0dd7134b 100644 --- a/public/app/core/utils/dag.test.ts +++ b/public/app/core/utils/dag.test.ts @@ -104,5 +104,17 @@ describe('Directed acyclic graph', () => { const actual = nodeH.getOptimizedInputEdges(); expect(actual).toHaveLength(0); }); + + it('when linking non-existing input node with existing output node should throw error', () => { + expect(() => { + dag.link('non-existing', 'A'); + }).toThrowError("cannot link input node named non-existing since it doesn't exist in graph"); + }); + + it('when linking existing input node with non-existing output node should throw error', () => { + expect(() => { + dag.link('A', 'non-existing'); + }).toThrowError("cannot link output node named non-existing since it doesn't exist in graph"); + }); }); }); diff --git a/public/app/core/utils/dag.ts b/public/app/core/utils/dag.ts index eb7ff1c3b1a..48c00a4c8c3 100644 --- a/public/app/core/utils/dag.ts +++ b/public/app/core/utils/dag.ts @@ -15,6 +15,14 @@ export class Edge { } link(inputNode: Node, outputNode: Node) { + if (!inputNode) { + throw Error('inputNode is required'); + } + + if (!outputNode) { + throw Error('outputNode is required'); + } + this.unlink(); this.inputNode = inputNode; this.outputNode = outputNode; @@ -152,7 +160,11 @@ export class Graph { for (let n = 0; n < inputArr.length; n++) { const i = inputArr[n]; if (typeof i === 'string') { - inputNodes.push(this.getNode(i)); + const n = this.getNode(i); + if (!n) { + throw Error(`cannot link input node named ${i} since it doesn't exist in graph`); + } + inputNodes.push(n); } else { inputNodes.push(i); } @@ -161,7 +173,11 @@ export class Graph { for (let n = 0; n < outputArr.length; n++) { const i = outputArr[n]; if (typeof i === 'string') { - outputNodes.push(this.getNode(i)); + const n = this.getNode(i); + if (!n) { + throw Error(`cannot link output node named ${i} since it doesn't exist in graph`); + } + outputNodes.push(n); } else { outputNodes.push(i); } diff --git a/public/app/features/templating/variable_srv.ts b/public/app/features/templating/variable_srv.ts index 8c0f1f11f77..75e2ca35ec7 100644 --- a/public/app/features/templating/variable_srv.ts +++ b/public/app/features/templating/variable_srv.ts @@ -291,9 +291,11 @@ export class VariableSrv { createGraph() { const g = new Graph(); - this.variables.forEach(v1 => { - g.createNode(v1.name); + this.variables.forEach(v => { + g.createNode(v.name); + }); + this.variables.forEach(v1 => { this.variables.forEach(v2 => { if (v1 === v2) { return; From 6f5d1fff755cf8c238cfc68ccce44d8846454b8d Mon Sep 17 00:00:00 2001 From: olshansky Date: Fri, 12 Oct 2018 23:13:11 +0300 Subject: [PATCH 05/14] fix: label values regex for single letter labels Closes: #13641 (cherry picked from commit 91e201ffa82cb8cb67acdaaab195f82f38e31d74) --- public/app/plugins/datasource/prometheus/metric_find_query.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/app/plugins/datasource/prometheus/metric_find_query.ts b/public/app/plugins/datasource/prometheus/metric_find_query.ts index feada28deea..680f7a8fb98 100644 --- a/public/app/plugins/datasource/prometheus/metric_find_query.ts +++ b/public/app/plugins/datasource/prometheus/metric_find_query.ts @@ -12,7 +12,7 @@ export default class PrometheusMetricFindQuery { } process() { - const labelValuesRegex = /^label_values\((?:(.+),\s*)?([a-zA-Z_][a-zA-Z0-9_]+)\)\s*$/; + const labelValuesRegex = /^label_values\((?:(.+),\s*)?([a-zA-Z_][a-zA-Z0-9_]*)\)\s*$/; const metricNamesRegex = /^metrics\((.+)\)\s*$/; const queryResultRegex = /^query_result\((.+)\)\s*$/; From 2fd66c3b284c619061ee749765db89d38a6a1b37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Fri, 12 Oct 2018 21:51:21 -0700 Subject: [PATCH 06/14] fix for graph time formating for Last 24h ranges, fixes #13650 (cherry picked from commit 551e0843fa569cd7dae17904aa06a67525f8abd1) --- public/app/plugins/panel/graph/graph.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/public/app/plugins/panel/graph/graph.ts b/public/app/plugins/panel/graph/graph.ts index 33db0e7220a..7a8e24539f7 100755 --- a/public/app/plugins/panel/graph/graph.ts +++ b/public/app/plugins/panel/graph/graph.ts @@ -713,7 +713,9 @@ class GraphElement { if (min && max && ticks) { const range = max - min; const secPerTick = range / ticks / 1000; - const oneDay = 86400000; + // Need have 10 milisecond margin on the day range + // As sometimes last 24 hour dashboard evaluates to more than 86400000 + const oneDay = 86400010; const oneYear = 31536000000; if (secPerTick <= 45) { From 06dc70699bc32cef8c4a120ad1da29ac69c6509a Mon Sep 17 00:00:00 2001 From: Leonard Gram Date: Mon, 15 Oct 2018 14:54:21 +0200 Subject: [PATCH 07/14] build: makes sure publisher.sh is available when deploying. (cherry picked from commit 6fd343067724c0c41054203abd7920bdb078db40) --- .circleci/config.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index a4bb2d67855..fe72996797e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -170,6 +170,7 @@ jobs: - scripts/*.sh - scripts/publish - scripts/build/release_publisher/release_publisher + - scripts/build/publish.sh build: docker: From 22880a75df9aace4a3ba2327a3be5833d37808b9 Mon Sep 17 00:00:00 2001 From: Jordan Neufeld Date: Sat, 6 Oct 2018 10:14:14 -0500 Subject: [PATCH 08/14] Fix text overflow on playlist search #13464 (cherry picked from commit 4815f92f6fabd9d155b8e07e462657ec6186baa4) --- public/sass/pages/_playlist.scss | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/public/sass/pages/_playlist.scss b/public/sass/pages/_playlist.scss index 5dd1c92cbd2..b8802940818 100644 --- a/public/sass/pages/_playlist.scss +++ b/public/sass/pages/_playlist.scss @@ -84,11 +84,11 @@ background-color: $list-item-bg; margin-bottom: 4px; .search-result-icon:before { - content: "\f009"; + content: '\f009'; } &.search-item-dash-home .search-result-icon:before { - content: "\f015"; + content: '\f015'; } } @@ -105,7 +105,10 @@ .playlist-available-list { td { line-height: 2rem; + max-width: 335px; white-space: nowrap; + text-overflow: ellipsis; + overflow: hidden; } .add-dashboard { From 8696b27c09e8a0f99f282d7220c4f870cd8235a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Mon, 8 Oct 2018 09:19:48 +0200 Subject: [PATCH 09/14] fix for influxdb annotation issue that caused text to be shown twice, fixes #13553 (cherry picked from commit 67f5bb2c4eade449668ea7c014dd4a71b435d83d) --- public/app/plugins/datasource/influxdb/influx_series.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/public/app/plugins/datasource/influxdb/influx_series.ts b/public/app/plugins/datasource/influxdb/influx_series.ts index d2a8482eced..10c1584f488 100644 --- a/public/app/plugins/datasource/influxdb/influx_series.ts +++ b/public/app/plugins/datasource/influxdb/influx_series.ts @@ -99,9 +99,6 @@ export default class InfluxSeries { if (column === 'sequence_number') { return; } - if (!titleCol) { - titleCol = index; - } if (column === this.annotation.titleColumn) { titleCol = index; return; @@ -114,6 +111,10 @@ export default class InfluxSeries { textCol = index; return; } + // legacy case + if (!titleCol && textCol !== index) { + titleCol = index; + } }); _.each(series.values, value => { From ac6bd22fd4c63bf2b11be62ddc9a3137b58cec8d Mon Sep 17 00:00:00 2001 From: Yuan Liu Date: Thu, 11 Oct 2018 11:21:06 +0800 Subject: [PATCH 10/14] Update time_series_query.go fix alert no data when elasticsearch group by terms size is set to no limit (cherry picked from commit 3b9ab6e20461b9da908ed4eaa4eb502d19f4d404) --- pkg/tsdb/elasticsearch/time_series_query.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/tsdb/elasticsearch/time_series_query.go b/pkg/tsdb/elasticsearch/time_series_query.go index fddcf3cb8b3..45a63ad5c3f 100644 --- a/pkg/tsdb/elasticsearch/time_series_query.go +++ b/pkg/tsdb/elasticsearch/time_series_query.go @@ -171,6 +171,10 @@ func addTermsAgg(aggBuilder es.AggBuilder, bucketAgg *BucketAgg, metrics []*Metr } else { a.Size = 500 } + if a.Size == 0 { + a.Size = 500 + } + if minDocCount, err := bucketAgg.Settings.Get("min_doc_count").Int(); err == nil { a.MinDocCount = &minDocCount } From 1bc344447cb137de89216812906e437995ec69b0 Mon Sep 17 00:00:00 2001 From: Yuan Liu Date: Thu, 11 Oct 2018 11:36:40 +0800 Subject: [PATCH 11/14] bug fix bug fix (cherry picked from commit 567db87c3a7cead11ea81d399d93fc966bf0932f) --- pkg/tsdb/elasticsearch/time_series_query.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/tsdb/elasticsearch/time_series_query.go b/pkg/tsdb/elasticsearch/time_series_query.go index 45a63ad5c3f..e7c1fc1f4b1 100644 --- a/pkg/tsdb/elasticsearch/time_series_query.go +++ b/pkg/tsdb/elasticsearch/time_series_query.go @@ -172,7 +172,7 @@ func addTermsAgg(aggBuilder es.AggBuilder, bucketAgg *BucketAgg, metrics []*Metr a.Size = 500 } if a.Size == 0 { - a.Size = 500 + a.Size = 500 } if minDocCount, err := bucketAgg.Settings.Get("min_doc_count").Int(); err == nil { From 5c38d3e9b0bf4bd09af4cbb9d789554db9b6147b Mon Sep 17 00:00:00 2001 From: Yuan Liu Date: Thu, 11 Oct 2018 11:40:23 +0800 Subject: [PATCH 12/14] remove tab (cherry picked from commit f8a8b213f9542683dcd9080d1626dd687cb3b8ba) --- pkg/tsdb/elasticsearch/time_series_query.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/tsdb/elasticsearch/time_series_query.go b/pkg/tsdb/elasticsearch/time_series_query.go index e7c1fc1f4b1..869e23e21ce 100644 --- a/pkg/tsdb/elasticsearch/time_series_query.go +++ b/pkg/tsdb/elasticsearch/time_series_query.go @@ -174,7 +174,7 @@ func addTermsAgg(aggBuilder es.AggBuilder, bucketAgg *BucketAgg, metrics []*Metr if a.Size == 0 { a.Size = 500 } - + if minDocCount, err := bucketAgg.Settings.Get("min_doc_count").Int(); err == nil { a.MinDocCount = &minDocCount } From c507319f7587b4482775812a6374468af4ad1088 Mon Sep 17 00:00:00 2001 From: Yuan Liu Date: Thu, 11 Oct 2018 16:04:57 +0800 Subject: [PATCH 13/14] add test for es alert when group by has no limit (cherry picked from commit 18dfdc4f0d190c0b1a7909f5936b7be546dc4e70) --- pkg/tsdb/elasticsearch/time_series_query_test.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pkg/tsdb/elasticsearch/time_series_query_test.go b/pkg/tsdb/elasticsearch/time_series_query_test.go index 49bf5f5bc75..fe8ae0fa8f2 100644 --- a/pkg/tsdb/elasticsearch/time_series_query_test.go +++ b/pkg/tsdb/elasticsearch/time_series_query_test.go @@ -60,7 +60,7 @@ func TestExecuteTimeSeriesQuery(t *testing.T) { _, err := executeTsdbQuery(c, `{ "timeField": "@timestamp", "bucketAggs": [ - { "type": "terms", "field": "@host", "id": "2" }, + { "type": "terms", "field": "@host", "id": "2", "settings": { "size": "0", "order": "asc" } }, { "type": "date_histogram", "field": "@timestamp", "id": "3" } ], "metrics": [{"type": "count", "id": "1" }] @@ -69,7 +69,9 @@ func TestExecuteTimeSeriesQuery(t *testing.T) { sr := c.multisearchRequests[0].Requests[0] firstLevel := sr.Aggs[0] So(firstLevel.Key, ShouldEqual, "2") - So(firstLevel.Aggregation.Aggregation.(*es.TermsAggregation).Field, ShouldEqual, "@host") + termsAgg := firstLevel.Aggregation.Aggregation.(*es.TermsAggregation) + So(termsAgg.Field, ShouldEqual, "@host") + So(termsAgg.Size, ShouldEqual, 500) secondLevel := firstLevel.Aggregation.Aggs[0] So(secondLevel.Key, ShouldEqual, "3") So(secondLevel.Aggregation.Aggregation.(*es.DateHistogramAgg).Field, ShouldEqual, "@timestamp") From 73f2fb439d96637331553e49cfab137a99a57437 Mon Sep 17 00:00:00 2001 From: Marcus Efraimsson Date: Tue, 16 Oct 2018 11:30:42 +0200 Subject: [PATCH 14/14] release 5.3.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 333cd361ac4..f4ca54c2926 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "company": "Grafana Labs" }, "name": "grafana", - "version": "5.3.0", + "version": "5.3.1", "repository": { "type": "git", "url": "http://github.com/grafana/grafana.git"