From ec14fa58b530346a27779924abdeb04c44bad851 Mon Sep 17 00:00:00 2001 From: bergquist Date: Fri, 13 Oct 2017 09:46:18 +0200 Subject: [PATCH 01/23] alerting: add count_non_null reducer makes it possible to have a second condition requering at least X points of data. --- pkg/services/alerting/conditions/reducer.go | 10 +++++++ .../alerting/conditions/reducer_test.go | 29 +++++++++++++++++++ public/app/features/alerting/alert_def.ts | 1 + .../features/alerting/partials/alert_tab.html | 2 +- 4 files changed, 41 insertions(+), 1 deletion(-) diff --git a/pkg/services/alerting/conditions/reducer.go b/pkg/services/alerting/conditions/reducer.go index 6eaa21b958e..0a61c13fa12 100644 --- a/pkg/services/alerting/conditions/reducer.go +++ b/pkg/services/alerting/conditions/reducer.go @@ -141,6 +141,16 @@ func (s *SimpleReducer) Reduce(series *tsdb.TimeSeries) null.Float { break } } + case "count_non_null": + for _, v := range series.Points { + if v[0].Valid { + value++ + } + } + + if value > 0 { + allNull = false + } } if allNull { diff --git a/pkg/services/alerting/conditions/reducer_test.go b/pkg/services/alerting/conditions/reducer_test.go index f0147e9021a..866b574f59f 100644 --- a/pkg/services/alerting/conditions/reducer_test.go +++ b/pkg/services/alerting/conditions/reducer_test.go @@ -67,6 +67,35 @@ func TestSimpleReducer(t *testing.T) { So(reducer.Reduce(series).Valid, ShouldEqual, false) }) + Convey("count_non_null", func() { + Convey("with null values and real values", func() { + reducer := NewSimpleReducer("count_non_null") + series := &tsdb.TimeSeries{ + Name: "test time serie", + } + + series.Points = append(series.Points, tsdb.NewTimePoint(null.FloatFromPtr(nil), 1)) + series.Points = append(series.Points, tsdb.NewTimePoint(null.FloatFromPtr(nil), 2)) + series.Points = append(series.Points, tsdb.NewTimePoint(null.FloatFrom(3), 3)) + series.Points = append(series.Points, tsdb.NewTimePoint(null.FloatFrom(3), 4)) + + So(reducer.Reduce(series).Valid, ShouldEqual, true) + So(reducer.Reduce(series).Float64, ShouldEqual, 2) + }) + + Convey("with null values", func() { + reducer := NewSimpleReducer("count_non_null") + series := &tsdb.TimeSeries{ + Name: "test time serie", + } + + series.Points = append(series.Points, tsdb.NewTimePoint(null.FloatFromPtr(nil), 1)) + series.Points = append(series.Points, tsdb.NewTimePoint(null.FloatFromPtr(nil), 2)) + + So(reducer.Reduce(series).Valid, ShouldEqual, false) + }) + }) + Convey("avg of number values and null values should ignore nulls", func() { reducer := NewSimpleReducer("avg") series := &tsdb.TimeSeries{ diff --git a/public/app/features/alerting/alert_def.ts b/public/app/features/alerting/alert_def.ts index c86f0dee775..84481b60ce0 100644 --- a/public/app/features/alerting/alert_def.ts +++ b/public/app/features/alerting/alert_def.ts @@ -51,6 +51,7 @@ var reducerTypes = [ {text: 'median()', value: 'median'}, {text: 'diff()', value: 'diff'}, {text: 'percent_diff()', value: 'percent_diff'}, + {text: 'count_non_null()', value: 'count_non_null'}, ]; var noDataModes = [ diff --git a/public/app/features/alerting/partials/alert_tab.html b/public/app/features/alerting/partials/alert_tab.html index ce737df84d9..9b5a535c727 100644 --- a/public/app/features/alerting/partials/alert_tab.html +++ b/public/app/features/alerting/partials/alert_tab.html @@ -42,7 +42,7 @@ WHEN
- + OF
From 9d916fdad68bfe25974f9097516a2f25ceea0a9c Mon Sep 17 00:00:00 2001 From: bergquist Date: Fri, 13 Oct 2017 10:29:11 +0200 Subject: [PATCH 02/23] changelog: adds note about closing #9516 --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ef6c3ffc273..ba65378c91d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -36,6 +36,7 @@ * **Table**: Add support for displaying the timestamp with milliseconds [#9429](https://github.com/grafana/grafana/pull/9429), thx [@s1061123](https://github.com/s1061123) * **Hipchat**: Add metrics, message and image to hipchat notifications [#9110](https://github.com/grafana/grafana/issues/9110), thx [@eloo](https://github.com/eloo) * **Kafka**: Add support for sending alert notifications to kafka [#7104](https://github.com/grafana/grafana/issues/7104), thx [@utkarshcmu](https://github.com/utkarshcmu) +* **Alerting**: add count_non_null as series reducer [#9516](https://github.com/grafana/grafana/issues/9516) ## Tech * **Go**: Grafana is now built using golang 1.9 From 7069fed31dfbf89177b2a4175033f019b6d50cec Mon Sep 17 00:00:00 2001 From: bergquist Date: Fri, 13 Oct 2017 13:11:18 +0200 Subject: [PATCH 03/23] update packagecloud script for 4.6.0-beta1 --- packaging/publish/publish_testing.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packaging/publish/publish_testing.sh b/packaging/publish/publish_testing.sh index 17fabc5e136..276193ad63f 100755 --- a/packaging/publish/publish_testing.sh +++ b/packaging/publish/publish_testing.sh @@ -1,10 +1,10 @@ #! /usr/bin/env bash -deb_ver=4.5.0-beta1 -rpm_ver=4.5.0-beta1 +deb_ver=4.6.0-beta1 +rpm_ver=4.6.0-beta1 -# wget https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana_${deb_ver}_amd64.deb +wget https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana_${deb_ver}_amd64.deb -# package_cloud push grafana/testing/debian/jessie grafana_${deb_ver}_amd64.deb +package_cloud push grafana/testing/debian/jessie grafana_${deb_ver}_amd64.deb package_cloud push grafana/testing/debian/wheezy grafana_${deb_ver}_amd64.deb package_cloud push grafana/testing/debian/stretch grafana_${deb_ver}_amd64.deb From 4a22d228576073b5f9db03e7448805c1177006db Mon Sep 17 00:00:00 2001 From: Morten Linderud Date: Fri, 13 Oct 2017 14:08:37 +0200 Subject: [PATCH 04/23] Missing dot in aws credentials path As far as i know the path hasn't changed, but the dot is missing in one place. --- docs/sources/features/datasources/cloudwatch.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/sources/features/datasources/cloudwatch.md b/docs/sources/features/datasources/cloudwatch.md index 29da06bfb1e..1d98b2d16d1 100644 --- a/docs/sources/features/datasources/cloudwatch.md +++ b/docs/sources/features/datasources/cloudwatch.md @@ -29,7 +29,7 @@ Name | Description ------------ | ------------- *Name* | The data source name. This is how you refer to the data source in panels & queries. *Default* | Default data source means that it will be pre-selected for new panels. -*Credentials* profile name | Specify the name of the profile to use (if you use `~/aws/credentials` file), leave blank for default. +*Credentials* profile name | Specify the name of the profile to use (if you use `~/.aws/credentials` file), leave blank for default. *Default Region* | Used in query editor to set region (can be changed on per query basis) *Custom Metrics namespace* | Specify the CloudWatch namespace of Custom metrics *Assume Role Arn* | Specify the ARN of the role to assume From 86b2048d3bdedad791609389619c359727506dc5 Mon Sep 17 00:00:00 2001 From: bergquist Date: Fri, 13 Oct 2017 13:22:17 +0200 Subject: [PATCH 05/23] changelog: adds release date for v4.6.0-beta1 --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ba65378c91d..cffea02cf9b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,7 @@ - UX changes to nav & side menu - New dashboard grid layout system -# 4.6.0 (unreleased) +# 4.6.0-beta1 (2017-10-13) ## New Features * **GCS**: Adds support for Google Cloud Storage [#8370](https://github.com/grafana/grafana/issues/8370) thx [@chuhlomin](https://github.com/chuhlomin) From 91f60bb6c40bdeed61f259e0170cf56c3eccc3f6 Mon Sep 17 00:00:00 2001 From: bergquist Date: Fri, 13 Oct 2017 13:22:42 +0200 Subject: [PATCH 06/23] set nightly version to v4.7.0-pre1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index e037b0211cf..9ef0f2fb548 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "company": "Grafana Labs" }, "name": "grafana", - "version": "4.6.0-beta1", + "version": "4.7.0-pre1", "repository": { "type": "git", "url": "http://github.com/grafana/grafana.git" From 888d608090c6f12c5c67e6b55afeb8fa708b1682 Mon Sep 17 00:00:00 2001 From: Eric Dahl Date: Sat, 14 Oct 2017 21:49:38 -0700 Subject: [PATCH 07/23] CloudWatch: Add ALB RequestCountPerTarget metric This commit adds the new ALB metric `RequestCountPerTarget` which was released in July 2017. --- pkg/tsdb/cloudwatch/metric_find_query.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/tsdb/cloudwatch/metric_find_query.go b/pkg/tsdb/cloudwatch/metric_find_query.go index 3f4f7bea9ef..b1ce507d27c 100644 --- a/pkg/tsdb/cloudwatch/metric_find_query.go +++ b/pkg/tsdb/cloudwatch/metric_find_query.go @@ -38,7 +38,7 @@ var customMetricsDimensionsMap map[string]map[string]map[string]*CustomMetricsCa func init() { metricsMap = map[string][]string{ "AWS/ApiGateway": {"4XXError", "5XXError", "CacheHitCount", "CacheMissCount", "Count", "IntegrationLatency", "Latency"}, - "AWS/ApplicationELB": {"ActiveConnectionCount", "ClientTLSNegotiationErrorCount", "HealthyHostCount", "HTTPCode_ELB_4XX_Count", "HTTPCode_ELB_5XX_Count", "HTTPCode_Target_2XX_Count", "HTTPCode_Target_3XX_Count", "HTTPCode_Target_4XX_Count", "HTTPCode_Target_5XX_Count", "IPv6ProcessedBytes", "IPv6RequestCount", "NewConnectionCount", "ProcessedBytes", "RejectedConnectionCount", "RequestCount", "TargetConnectionErrorCount", "TargetResponseTime", "TargetTLSNegotiationErrorCount", "UnHealthyHostCount"}, + "AWS/ApplicationELB": {"ActiveConnectionCount", "ClientTLSNegotiationErrorCount", "HealthyHostCount", "HTTPCode_ELB_4XX_Count", "HTTPCode_ELB_5XX_Count", "HTTPCode_Target_2XX_Count", "HTTPCode_Target_3XX_Count", "HTTPCode_Target_4XX_Count", "HTTPCode_Target_5XX_Count", "IPv6ProcessedBytes", "IPv6RequestCount", "NewConnectionCount", "ProcessedBytes", "RejectedConnectionCount", "RequestCount", "RequestCountPerTarget", "TargetConnectionErrorCount", "TargetResponseTime", "TargetTLSNegotiationErrorCount", "UnHealthyHostCount"}, "AWS/AutoScaling": {"GroupMinSize", "GroupMaxSize", "GroupDesiredCapacity", "GroupInServiceInstances", "GroupPendingInstances", "GroupStandbyInstances", "GroupTerminatingInstances", "GroupTotalInstances"}, "AWS/Billing": {"EstimatedCharges"}, "AWS/CloudFront": {"Requests", "BytesDownloaded", "BytesUploaded", "TotalErrorRate", "4xxErrorRate", "5xxErrorRate"}, From 40b11654fd3247bfa426b37dd35c3321e08d8451 Mon Sep 17 00:00:00 2001 From: Mitsuhiro Tanda Date: Mon, 16 Oct 2017 13:05:53 +0900 Subject: [PATCH 08/23] show error message when cloudwatch datasource can't add --- public/app/plugins/datasource/cloudwatch/datasource.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/public/app/plugins/datasource/cloudwatch/datasource.js b/public/app/plugins/datasource/cloudwatch/datasource.js index f6ea196e764..c611111f2fa 100644 --- a/public/app/plugins/datasource/cloudwatch/datasource.js +++ b/public/app/plugins/datasource/cloudwatch/datasource.js @@ -318,6 +318,8 @@ function (angular, _, moment, dateMath, kbn, templatingVariable) { return this.getDimensionValues(region, namespace, metricName, 'ServiceName', dimensions).then(function () { return { status: 'success', message: 'Data source is working' }; + }, function (err) { + return { status: 'error', message: err.message }; }); }; From fa68eb9be68f8845be85ff70ab0559ab58980b7a Mon Sep 17 00:00:00 2001 From: Joaquin Casares Date: Mon, 16 Oct 2017 00:25:30 -0500 Subject: [PATCH 09/23] Add autofocus tag for username field on login.html (#9526) --- public/app/partials/login.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/app/partials/login.html b/public/app/partials/login.html index fe19d34f8d5..48c94640fc5 100644 --- a/public/app/partials/login.html +++ b/public/app/partials/login.html @@ -20,7 +20,7 @@