Commit Graph

229 Commits

Author SHA1 Message Date
Owen Diehl
86c8eed386
Instrument/ruler api (#33290)
* ruler api histogram instrumentation

* register ruler metrics
2021-04-27 08:25:32 -04:00
Ganesh Vernekar
6cc7a20789
NGAlert: Remove all pending references to the old API package (#33269)
Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>
2021-04-22 18:36:32 +05:30
Dimitris Sotirakis
d3e510e92f
Chore: Remove Revive standalone linter - use it via golangci-lint (#33150)
* Remove Revive standalone linter - use it via golangci-lint

* Add revive settings to ignore lint errors for now

* Small fix

* Update to grabpl v0.5.53

* Remove errorCode and warningCode from config
2021-04-20 16:51:08 +02:00
dependabot[bot]
0a3e7dea62
Bump github.com/centrifugal/centrifuge from 0.16.0 to 0.17.0 (#33117) 2021-04-19 12:09:10 -07:00
Owen Diehl
e37a780e14
Inhouse alerting api (#33129)
* init

* autogens AM route

* POST dashboards/db spec

* POST alert-notifications spec

* fix description

* re inits vendor, updates grafana to master

* go mod updates

* alerting routes

* renames to receivers

* prometheus endpoints

* align config endpoint with cortex, include templates

* Change grafana receiver type

* Update receivers.go

* rename struct to stop swagger thrashing

* add rules API

* index html

* standalone swagger ui html page

* Update README.md

* Expose GrafanaManagedAlert properties

* Some fixes

- /api/v1/rules/{Namespace} should return a map
- update ExtendedUpsertAlertDefinitionCommand properties

* am alerts routes

* rename prom swagger section for clarity, remove example endpoints

* Add missing json and yaml tags

* folder perms

* make folders POST again

* fix grafana receiver type

* rename fodler->namespace for perms

* make ruler json again

* PR fixes

* silences

* fix Ok -> Ack

* Add id to POST /api/v1/silences (#9)

Signed-off-by: Ganesh Vernekar <cs15btech11018@iith.ac.in>

* Add POST /api/v1/alerts (#10)

Signed-off-by: Ganesh Vernekar <cs15btech11018@iith.ac.in>

* fix silences

* Add testing endpoints

* removes grpc replace directives

* [wip] starts validation

* pkg cleanup

* go mod tidy

* ignores vendor dir

* Change response type for Cortex/Loki alerts

* receiver unmarshaling tests

* ability to split routes between AM & Grafana

* api marshaling & validation

* begins work on routing lib

* [hack] ignores embedded field in generation

* path specific datasource for alerting

* align endpoint names with cloud

* single route per Alerting config

* removes unused routing pkg

* regens spec

* adds datasource param to ruler/prom route paths

* Modifications for supporting migration

* Apply suggestions from code review

* hack for cleaning circular refs in swagger definition

* generates files

* minor fixes for prom endpoints

* decorate prom apis with required: true where applicable

* Revert "generates files"

This reverts commit ef7e975584.

* removes server autogen

* Update imported structs from ngalert

* Fix listing rules response

* Update github.com/prometheus/common dependency

* Update get silence response

* Update get silences response

* adds ruler validation & backend switching

* Fix GET /alertmanager/{DatasourceId}/config/api/v1/alerts response

* Distinct gettable and postable grafana receivers

* Remove permissions routes

* Latest JSON specs

* Fix testing routes

* inline yaml annotation on apirulenode

* yaml test & yamlv3 + comments

* Fix yaml annotations for embedded type

* Rename DatasourceId path parameter

* Implement Backend.String()

* backend zero value is a real backend

* exports DiscoveryBase

* Fix GO initialisms

* Silences: Use PostableSilence as the base struct for creating silences

* Use type alias instead of struct embedding

* More fixes to alertmanager silencing routes

* post and spec JSONs

* Split rule config to postable/gettable

* Fix empty POST /silences payload

Recreating the generated JSON specs fixes the issue
without further modifications

* better yaml unmarshaling for nested yaml docs in cortex-am configs

* regens spec

* re-adds config.receivers

* omitempty to align with prometheus API behavior

* Prefix routes with /api

* Update Alertmanager models

* Make adjustments to follow the Alertmanager API

* ruler: add for and annotations to grafana alert (#45)

* Modify testing API routes

* Fix grafana rule for field type

* Move PostableUserConfig validation to this library

* Fix PostableUserConfig YAML encoding/decoding

* Use common fields for grafana and lotex rules

* Add namespace id in GettableGrafanaRule

* Apply suggestions from code review

* fixup

* more changes

* Apply suggestions from code review

* aligns structure pre merge

* fix new imports & tests

* updates tooling readme

* goimports

* lint

* more linting!!

* revive lint

Co-authored-by: Sofia Papagiannaki <papagian@gmail.com>
Co-authored-by: Domas <domasx2@gmail.com>
Co-authored-by: Sofia Papagiannaki <papagian@users.noreply.github.com>
Co-authored-by: Ganesh Vernekar <15064823+codesome@users.noreply.github.com>
Co-authored-by: gotjosh <josue@grafana.com>
Co-authored-by: David Parrott <stomp.box.yo@gmail.com>
Co-authored-by: Kyle Brandt <kyle@grafana.com>
2021-04-19 14:26:04 -04:00
Alexander Emelin
3e3a0a1ea1
bump jaeger-client-go to v2.27.0 (#33134) 2021-04-19 20:38:14 +03:00
Alexander Emelin
d807fbc9e9
Live: Telegraf input modifiers (#32982) 2021-04-19 18:48:43 +03:00
dependabot[bot]
33621e6f9b
Bump github.com/uber/jaeger-client-go from 2.25.0+incompatible to 2.26.0+incompatible (#33106)
* Bump github.com/uber/jaeger-client-go

Bumps [github.com/uber/jaeger-client-go](https://github.com/uber/jaeger-client-go) from 2.25.0+incompatible to 2.26.0+incompatible.
- [Release notes](https://github.com/uber/jaeger-client-go/releases)
- [Changelog](https://github.com/jaegertracing/jaeger-client-go/blob/master/CHANGELOG.md)
- [Commits](https://github.com/uber/jaeger-client-go/compare/v2.25.0...v2.26.0)

Signed-off-by: dependabot[bot] <support@github.com>

* Fix go.sum

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
2021-04-19 12:33:31 +02:00
dependabot[bot]
58380368af
Bump github.com/mattn/go-sqlite3 from 1.14.6 to 1.14.7 (#33104)
Bumps [github.com/mattn/go-sqlite3](https://github.com/mattn/go-sqlite3) from 1.14.6 to 1.14.7.
- [Release notes](https://github.com/mattn/go-sqlite3/releases)
- [Commits](https://github.com/mattn/go-sqlite3/compare/v1.14.6...v1.14.7)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-04-19 09:26:51 +02:00
Arve Knudsen
dbe2f1871f
Chore: Sync go.mod and go.sum (#33065)
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2021-04-16 13:41:17 +02:00
Sofia Papagiannaki
6bbb2fd4ba
[Alerting]: Several modifications in alert rules (#32983)
* [Alerting]: Use common properties for all rules

* Add Labels in rules

* Fix update ruleGroup API

Return 400 Bad Request response
when the request contains a UID that does not exist

* Check permissions and return namespace id

* Apply suggestions from code review

Co-authored-by: gotjosh <josue@grafana.com>
2021-04-15 15:54:37 +03:00
Sofia Papagiannaki
e7ff04a167
[Alerting]: Implement test rule API route (#32837)
* [Alerting]: Implement test rule API route

* Apply suggestions from code review

* Call /query instead of /query_range
2021-04-13 20:58:34 +03:00
gotjosh
528ca9134b
Alerting: Use a default configuration and periodically poll for new ones (#32851)
* Alerting: Use a default configuration and periodically poll for new ones

Use a default configuration to make sure we always start the grafana
instance. Then, regularly poll for new ones.

I've also made sure that failures to apply configuration do not stop the
Grafana server but instead keep polling until it is a success.
2021-04-13 13:02:44 +01:00
dependabot[bot]
0c72f50c68
Chore(deps): Bump google.golang.org/api from 0.42.0 to 0.44.0 (#32879)
Bumps [google.golang.org/api](https://github.com/googleapis/google-api-go-client) from 0.42.0 to 0.44.0.
- [Release notes](https://github.com/googleapis/google-api-go-client/releases)
- [Changelog](https://github.com/googleapis/google-api-go-client/blob/master/CHANGES.md)
- [Commits](https://github.com/googleapis/google-api-go-client/compare/v0.42.0...v0.44.0)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-04-12 13:05:35 +02:00
dependabot[bot]
dfbb11e094
Chore(deps): Bump github.com/aws/aws-sdk-go from 1.38.12 to 1.38.17 (#32880)
Bumps [github.com/aws/aws-sdk-go](https://github.com/aws/aws-sdk-go) from 1.38.12 to 1.38.17.
- [Release notes](https://github.com/aws/aws-sdk-go/releases)
- [Changelog](https://github.com/aws/aws-sdk-go/blob/main/CHANGELOG.md)
- [Commits](https://github.com/aws/aws-sdk-go/compare/v1.38.12...v1.38.17)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-04-12 13:03:04 +02:00
dependabot[bot]
f247526d6a
Chore(deps): Bump google.golang.org/grpc from 1.36.1 to 1.37.0 (#32878)
Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.36.1 to 1.37.0.
- [Release notes](https://github.com/grpc/grpc-go/releases)
- [Commits](https://github.com/grpc/grpc-go/compare/v1.36.1...v1.37.0)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-04-12 11:29:59 +03:00
dependabot[bot]
d96e82d5e4
Chore(deps): Bump github.com/benbjohnson/clock from 1.0.3 to 1.1.0 (#32882)
Bumps [github.com/benbjohnson/clock](https://github.com/benbjohnson/clock) from 1.0.3 to 1.1.0.
- [Release notes](https://github.com/benbjohnson/clock/releases)
- [Commits](https://github.com/benbjohnson/clock/compare/v1.0.3...v1.1.0)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-04-12 09:56:09 +02:00
Ryan McKinley
b96e45299d
Live: support streaming results out-of-the-box (#32821) 2021-04-09 21:17:22 +02:00
Kyle Brandt
80dfa83380
AlertingNG: Add For+Annotations to Grafana_Alert (#32793)
* add db columns
* Fix deserialisation issue of AlertRule For field (#32848)
* Update to latest alerting-api

Co-authored-by: Sofia Papagiannaki <papagian@users.noreply.github.com>
2021-04-09 16:50:04 +02:00
gotjosh
c9e5088e8b
Alerting: Cleanup and move legacy to a legacy file (#32803)
* Alerting: Cleanup and move legacy to a legacy file

A quick cleanup of the ngalert/api directory, optimising for an easy
removal of what is will be considered legacy at some point. A quick
summary of what's done is:

- Add a prefix `generated` prefix to files that are auto-generated by
  our swagger definitions.
- Create a legacy file to place all the legacy API routes implementation
  and helpers. Deleting files that where no longer needed after this
move.
- Rename the `lotex` file to `lotex_ruler`
- Adding a couple of comments here and there.

With this, I hope to organise our code in this directory a bit better
given there's a lot going on.
2021-04-09 05:55:41 -04:00
dependabot[bot]
e9a27ca2ec
Chore(deps): Bump gonum.org/v1/gonum from 0.8.2 to 0.9.1 (#32568)
Bumps gonum.org/v1/gonum from 0.8.2 to 0.9.1.

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-04-08 15:47:19 +03:00
gotjosh
fe67680c42
Alerting: Allow querying of Alerts from notifications (#32614)
* Alerting: Allow querying of Alerts from notifications

* Wire everything up

* Remove unused functions

* Remove duplicate line
2021-04-08 07:27:59 -04:00
sam boyer
bba4d9bd7f
Introduce "scuemata" system for CUE-based specification of Grafana objects (#32527) 2021-04-08 01:11:11 -07:00
dependabot[bot]
acc8e78c24
Bump github.com/influxdata/influxdb-client-go/v2 from 2.2.2 to 2.2.3 (#32683)
Bumps [github.com/influxdata/influxdb-client-go/v2](https://github.com/influxdata/influxdb-client-go) from 2.2.2 to 2.2.3.
- [Release notes](https://github.com/influxdata/influxdb-client-go/releases)
- [Changelog](https://github.com/influxdata/influxdb-client-go/blob/master/CHANGELOG.md)
- [Commits](https://github.com/influxdata/influxdb-client-go/compare/v2.2.2...v2.2.3)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-04-07 15:18:02 +02:00
Kyle Brandt
d519913843
AlertingNG: Temp endpoint to translate dashboard alert into rule group (#32694)
* Set NoData and ExecErr states
* make save an option
* TODOs
* adjust interval
* FOR and alertRuleTags not done yet
2021-04-07 14:28:06 +02:00
Domas
a56293142a
Alerting: unified alerting frontend (#32708) 2021-04-07 08:42:43 +03:00
Alexander Emelin
54ad791c7e
Live: expose HTTP push endpoint that will read influx line protocol and publish to websocket (#32311)
Co-authored-by: Ryan McKinley <ryantxu@gmail.com>
2021-04-05 19:04:46 +03:00
dependabot[bot]
ec12b344df
Bump github.com/hashicorp/go-version from 1.2.1 to 1.3.0 (#32687)
Bumps [github.com/hashicorp/go-version](https://github.com/hashicorp/go-version) from 1.2.1 to 1.3.0.
- [Release notes](https://github.com/hashicorp/go-version/releases)
- [Changelog](https://github.com/hashicorp/go-version/blob/master/CHANGELOG.md)
- [Commits](https://github.com/hashicorp/go-version/compare/v1.2.1...v1.3.0)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-04-05 13:39:49 +03:00
dependabot[bot]
6a94ca4dd2
Bump github.com/go-openapi/strfmt from 0.20.0 to 0.20.1 (#32684)
Bumps [github.com/go-openapi/strfmt](https://github.com/go-openapi/strfmt) from 0.20.0 to 0.20.1.
- [Release notes](https://github.com/go-openapi/strfmt/releases)
- [Commits](https://github.com/go-openapi/strfmt/compare/v0.20.0...v0.20.1)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-04-05 10:58:13 +03:00
dependabot[bot]
8d3b9878b2
Bump github.com/aws/aws-sdk-go from 1.38.7 to 1.38.12 (#32682)
Bumps [github.com/aws/aws-sdk-go](https://github.com/aws/aws-sdk-go) from 1.38.7 to 1.38.12.
- [Release notes](https://github.com/aws/aws-sdk-go/releases)
- [Changelog](https://github.com/aws/aws-sdk-go/blob/main/CHANGELOG.md)
- [Commits](https://github.com/aws/aws-sdk-go/compare/v1.38.7...v1.38.12)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-04-05 09:36:22 +02:00
Kyle Brandt
948da25c13
ngalerting: represent nil/empty labels the same (#32652)
was getting duplicates of [] and null before
2021-04-02 13:49:45 -04:00
Alexander Emelin
93292f6eef
Live: update Streaming plugin definitions, put frame schema in subscribe result data (#32561)
Co-authored-by: Torkel Ödegaard <torkel@grafana.org>
Co-authored-by: Ryan McKinley <ryantxu@gmail.com>
2021-04-02 19:41:45 +03:00
Kyle Brandt
6ad02315eb
ngalert: json dataframe on temp endpoints (#32641) 2021-04-02 15:52:38 +02:00
Ryan McKinley
f67489a1f6
Chore: update centrifuge import (avoid protobuf) (#32616) 2021-04-01 21:47:04 +02:00
Sofia Papagiannaki
ee06970d72
[Alerting]: Grafana managed ruler API implementation (#32537)
* [Alerting]: Grafana managed ruler API impl

* Apply suggestions from code review

* fix lint

* Add validation for ruleGroup name length

* Fix MySQL migration

Co-authored-by: kyle <kyle@grafana.com>
2021-04-01 11:11:45 +03:00
Sofia Papagiannaki
a5e95823b2
[Alerting]: Alertmanager API implementation (#32174)
* Add validation for grafana recipient

* Alertmanager API implementation (WIP)

* Fix encoding/decoding receiver settings from/to YAML

* Save templates together with the configuration

* update POST to apply latest config

* Alertmanager service enabled by the ngalert toggle

* Silence API integration with Alertmanager

* Apply suggestions from code review

Co-authored-by: gotjosh <josue@grafana.com>
Co-authored-by: Ganesh Vernekar <15064823+codesome@users.noreply.github.com>
2021-03-31 23:00:56 +03:00
Will Browne
6a3faad0b0
Chore: Bump grafana-aws-sdk dep to 0.4.0 (#32563) 2021-03-31 18:30:32 +02:00
Ryan McKinley
1446d094b8
API: return query results as JSON rather than base64 encoded Arrow (#32303) 2021-03-31 08:35:03 -07:00
Ryan McKinley
f456c32f92
Chore: remove measurement.go (#32526) 2021-03-31 07:52:19 -07:00
gotjosh
433f6b91d0
Alerting: Introduce the silencing interface (#32517)
* Alerting: Introduce the silencing interface

The operations introduced are:

- Listing silences
- Retrieving an specific silence
- Deleting a silence
- Creating a silence

Signed-off-by: Josue Abreu <josue@grafana.com>

* Add a comment to listing silences

* Update to upstream alertmanager

* Remove copied code from the Alertmanager
2021-03-31 07:36:36 -04:00
Erik Sundell
f0d6f132ae
SigV4: Add support EC2 IAM role auth and possibility to toggle auth providers (#32444)
* wip: consume aws-sdk config in auth http settings

* fix typings

* use sdk regions

* use latest version of grafana/aws-sdk

* use newest sdk

* add comment

* bump sdk

* fix yarn lock file

* fix storybook issue

* upgrade aws-sdk. also use it in grafana ui

* remove not used config

* add aws-sdk as an external dep for grafana in the grafana ui rollup

Co-authored-by: Will Browne <will.browne@grafana.com>
2021-03-30 12:30:34 +02:00
Sofia Papagiannaki
c4d5a67b38
[Alerting] Forking alert manager API (#32300)
* Alertmanager lotex ruler

* Apply suggestions from code review
2021-03-29 18:18:25 +03:00
dependabot[bot]
77ef835e8c
Chore(deps): Bump github.com/aws/aws-sdk-go from 1.38.2 to 1.38.7 (#32399)
Bumps [github.com/aws/aws-sdk-go](https://github.com/aws/aws-sdk-go) from 1.38.2 to 1.38.7.
- [Release notes](https://github.com/aws/aws-sdk-go/releases)
- [Changelog](https://github.com/aws/aws-sdk-go/blob/main/CHANGELOG.md)
- [Commits](https://github.com/aws/aws-sdk-go/compare/v1.38.2...v1.38.7)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-03-29 09:47:54 +02:00
Arve Knudsen
c8afce5fd6
MSSQL: Upgrade go-mssqldb (#32347)
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2021-03-26 13:16:57 +01:00
Ganesh Vernekar
093e5947f4
Upgrade Prometheus Alertmanager and small fixes (#32280)
Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>
2021-03-25 12:51:44 +01:00
gotjosh
9b52ffc6a9
Alerting: Fetch configuration from the database and run a notification service (#32175)
* Alerting: Fetch configuration from the database and run a notification
instance

Co-Authored-By: Ganesh Vernekar <15064823+codesome@users.noreply.github.com>
2021-03-24 14:20:44 +00:00
Owen Diehl
2179a2658e
Extricates reusable utilities for different alerting proxy types (#32268)
* backendtype helper

* abstracts alertingproxy

* updates alerting api dep

* prom endpoints
2021-03-24 07:43:25 -04:00
Joan López de la Franca Beltran
15676baa4b
Enterprise: Add missing Loki dependency (#32265) 2021-03-23 19:08:31 +01:00
Alexander Emelin
336bc559a3
Basic streaming plugin support (#31940)
This pull request migrates testdata to coreplugin streaming capabilities,
this is mostly a working concept of streaming plugins at the moment, 
the work will continue in the following pull requests.
2021-03-23 20:24:08 +03:00
Sofia Papagiannaki
24cb059a6b
[Alerting]: implement backend checking for forking to Lotex ruler (#32208)
* Rename DatasourceId path parameter

* Implement fork ruler backendType()

* Apply suggestions from code review
2021-03-23 18:08:57 +02:00