Commit Graph

59 Commits (9b6d4f949975b9f9db8228a961090b5b4f49b1a4)

Author SHA1 Message Date
George 78cafa861b
refactor(notifications): isolate endpoint service (#19818)
* refactor(notifications): isolate endpoint service

Following the ongoing effort to isolate behaviours into their own
packages and off of kv.Service, this change move the notification
endpoints service implementation into its own package. It removes the
endpoint behaviors from the kv service completely.

* chore(influxd): wire up the isolated check service in place of kv service
2020-10-28 15:22:14 +00:00
George 3d643e0681
refactor(notification): move rule service into own package (#19804)
* refactor(notification): move rule service into own package

* chore(launcher): fix tests to use clients as opposed to direct kv service

* chore(influx): update task cli to consume core domain model task from client

* chore(kv): remove rule service behaviours from kv

This also introduces the org id resolver type. Which is transplanted
from the kv service. As this one function coupled all resource
capabilities onto the kv service. Making removing these capabilities
impossible. Moving this type out into its own package which depends on
each service explicitly ensures we don't have one type which has to
implement all the service contracts.

* fix(launcher): remove double reference to influxdb package
2020-10-27 11:45:05 +00:00
Brett Buddin 77fcf692c5
fix(notification/rule): Include the edge of the boundary we are observing. (#19392)
* fix(notification/rule): Include the edge of the boundary we are observing.

* chore(changelog): Add 19392 to changelog.
2020-08-24 10:08:14 -04:00
Pavel Zavora 6d086f7495 feat(notification/telegram): take back telegram notification after being reverted in #19088
This reverts commit f67c3a14e0.
2020-08-12 11:28:02 +02:00
Michael Desa f67c3a14e0
Revert "feat(notification/telegram): add telegram notification" (#19088) 2020-07-27 08:31:18 -07:00
Pavel Zavora 078bd8db09 feat(notification/telegram): specify channel as a telegram endpoint property 2020-07-25 11:59:04 +02:00
Pavel Zavora 001e0f8d37 chore(notification/telegram): change telegram flux package import 2020-07-25 11:59:04 +02:00
Pavel Zavora 04026eb835 feat(notification/telegram): update swagger with telegram endpoint and rule 2020-07-25 11:59:04 +02:00
Pavel Zavora 192e997aea feat(notification/telegram): add telegram endpoint and rule 2020-07-25 11:59:04 +02:00
Jonathan A. Sternberg d3fa60991f
Merge branch 'master' into chore/merge-master 2020-04-06 12:17:47 -05:00
Jonathan A. Sternberg 0ae8bebd75
refactor: rewrite imports to include the /v2 suffix for version 2 2020-04-03 12:39:20 -05:00
Jonathan A. Sternberg 469c5849c4
Merge branch 'master' into feat/use-algo-w 2020-04-03 09:30:04 -05:00
Ariel Salem 4f65cda351
fix(ui): fixed threshold check bug that wouldn't allow threshold checks to be created where fields had spaces in them (#17391) 2020-03-23 19:17:52 -07:00
Jonathan A. Sternberg 0d6e4e310b
Merge branch 'master' into feat/use-algo-w 2020-03-06 16:46:49 -06:00
Jonathan A. Sternberg bcbb9df72e
refactor(task): tasks will now use the flux language service (#17104)
The tasks subsystem will now use the flux language service to parse and
evaluate flux instead of directly interacting with the parser or
runtime. This helps break the dependency on the libflux parser for the
base influxdb package.

This includes the task notification packages which were changed at the
same time.
2020-03-05 14:36:58 -06:00
Michael Desa be636f983d fix(notification/rule): import experimental package for pagerduty rule
🤦
2020-02-21 09:13:36 -08:00
Michael Desa c0bccf53dd fix(notification/rule): add alert level filtering to pagerduty rule
An accidental omission of status a level check resulted in all statuses
triggering notifications for pagerduty rules. This was not caught due
to insufficient testing of the pagerduty rule.
2020-02-20 13:37:03 -08:00
Johnny Steenbergen 77dd06bc5e fix: enable skipped tests for notification rules and fixup issue in tag matcher 2020-01-02 07:16:03 -08:00
Deniz Kusefoglu 219d73bf60
fix(notificationrules): Correct logic on matching notification rules (#16328)
* fix(notificationrules): Correct logic on matching notification rules

* feat(nrs): Add more tests
2019-12-31 23:44:27 +00:00
Johnny Steenbergen 61dceaa727 feat(pkger): add application functionality for the notification rules resource 2019-12-20 12:48:46 -08:00
Johnny Steenbergen 86a359f34b chore(http): refactor http layer to be able to encode/decode influxdb.ID's safely
noticed that I had not used the http server as the entry point for server tests.
This was work to make that happen. Along the way, found a bunch of issues I hadn't
seen before 🤦. There are a number of changes tucked away inside the
other types, that make it possible to encode/decode a type with zero value for
influxdb.ID.
2019-12-13 09:46:01 -08:00
Kelvin Wang 2837d4ec08 fix(predicate): add string parser 2019-10-18 12:02:53 -04:00
Kelvin Wang 62f4042853 feat(influxdb): add predicate package 2019-10-18 12:02:52 -04:00
Michael Desa 58fbddc123
fix(notification/rule): ensure stateChanges rule has enough data in window
Closes https://github.com/influxdata/influxdb/issues/15154

Previously, we niavely incremented the unit associated with the leading
duration. Now, if the unit is `s` we double it. For every other unit, we
increase the magnitude by 1.

fix(notification/rule): change panic to t.Fatal

chore(notification/rule): add support for durations less than s
2019-09-24 12:48:10 -04:00
kelwang c3127c8cdd
Merge pull request #15179 from bednar/check-cron
fix(alerts): remove the cron option from checks/rules
2019-09-23 21:28:02 -04:00
Brandon Farmer d83fabeabc feat(influxdb): user disabling 2019-09-23 11:57:16 -07:00
Jakub Bednar 265bc7bf2a fix(alerts): remove the cron option from checks/rules 2019-09-23 10:20:22 +02:00
Michael Desa a1979ef615
fix(notification/rule): alert on all statuses if for any status rule
This PR special cases `any` level rules so that they will alert on all
conditions.
2019-09-11 15:19:00 -04:00
Michael Desa ea1b7bec09
fix(pagerduty/rule): change url to clientURL for pagerduty endpoint/rule
Closes https://github.com/influxdata/influxdb/issues/15042

Previously, there was an optional URL provided for the pagerduty
endpoint. However, the pagerduty API url does not change and as a result
it should not have been a parameter. The Pagerduty API does require a
`clientURL` that is presented in the pagerduty UI when an alert is
triggered. Currently that value will default to the alerts history page
for the organization.
2019-09-09 19:09:35 -04:00
Chris Goller 5848056ea7 fix(notification/rule): pagerduty does not need token and url
Previously, the URL would cause pages to be sent to incorrect addresses.
Token is only needed for PagerDuty REST API and not events.
2019-09-06 23:07:37 -05:00
Chris Goller bf1e198714 fix(notification/rule): pagerduty helper functions need key args
The pagerduty helper functions did not have the correct syntax.
2019-09-06 21:27:09 -05:00
Chris Goller 9dcdbd05a1 fix(notification/rule): convert time, trigger, severity
Semantically, we've done the following:

// name of the client sending the alert.
client: "influxdata"

// url of the client sending the alert.
client_url: the endpoint URL for now (needs to change to rule)

// The class/type of the event, for example ping failure or cpu load
class: check's name

// Logical grouping of components of a service, for example app-stack
group: source measurement

Co-authored-by: Alirie Gray <alirie.gray@gmail.com>
2019-09-06 18:34:42 -05:00
Chris Goller dbcdc8dc59
feat(notification/rule): add _version: 1 to HTTP body (#15028)
This adds the _version: 1 correctly to the body of the HTTP POST.

Additionally, this fixes the imports when using secrets.

The POSTed JSON body now is:

```json
{
  "_check_id": "046cac59e2aa3000",
  "_check_name": "High CPU User Usage",
  "_level": "crit",
  "_measurement": "notifications",
  "_message": "High CPU User Usage: rsavage.prod is crit",
  "_notification_endpoint_id": "046cad0c83aec000",
  "_notification_endpoint_name": "HTTP Endpoint",
  "_notification_rule_id": "046dff53d4183000",
  "_notification_rule_name": "HTTP Notification",
  "_source_measurement": "cpu",
  "_source_timestamp": 1567797375000000000,
  "_start": "2019-09-06T19:15:59Z",
  "_status_timestamp": 1567797376416632300,
  "_stop": "2019-09-06T19:16:20.362006739Z",
  "_time": "2019-09-06T19:16:20.609629338Z",
  "_type": "threshold",
  "_version": 1,
  "cpu": "cpu-total",
  "host": "rsavage.prod",
  "usage_user": 91.12278069517379
}
```
2019-09-06 16:21:27 -05:00
kelwang c88284840b
Merge pull request #14962 from influxdata/fix_offset_must_be_smaller
fix(notification): offset must be smaller than every
2019-09-06 16:20:49 -04:00
Chris Goller 8367d8d252
feat(notification/rule): add JSON body for the HTTP POST (#14994)
The body of the JSON webhook would be:
{
        "version": 1,
        "rule_name": notification._notification_rule_name,
        "rule_id": notification._notification_rule_id,
        "endpoint_name": notification._notification_endpoint_name,
        "endpoint_id": notification._notification_endpoint_id,
        "check_name": r._check_name,
        "check_id": r._check_id,
        "check_type": r._type,
        "source_measurement": r._source_measurement,
        "source_timestamp": r._source_timestamp,
        "level": r._level,
        "message": r._message,
}
2019-09-05 20:38:02 -05:00
Chris Goller da359f2ce2
feat(notification/rule): add auth and content-type headers for… (#14986)
The basic auth headers use a function that will soon be in flux that
renders usernames and passwords into `Basic <b64 u and p>`

This work assumes that AuthMethod has been set as well as the
appropriate secrets
2019-09-05 17:32:28 -05:00
Michael Desa 79a6b353e3
fix(notification/rule): conditionally include url and token for slack rule
Previously, we expected that both token and url would be provided, but
we've become aware that the user may provide either or both of them.
2019-09-05 18:00:45 -04:00
Alirie Gray e7e5b60cbb test(alerts): update time in pagerduty test 2019-09-05 14:31:15 -07:00
Chris Goller a5395e323f feat(pagerduty): update pagerduty generation schema
We chose pretty arbitrary data from monitor to add to the pagerduty
schema.

We'll need to see how this renders and make adjustments.

Co-authored-by: Alirie Gray <alirie.gray@gmail.com>
2019-09-05 14:16:01 -07:00
Michael Desa af89f38d04 feat(notification/rule): add pagerduty notification rule 2019-09-05 14:16:01 -07:00
Kelvin Wang d1dd460a92 fix(notification): offset must be smaller than every 2019-09-05 11:20:59 -04:00
Michael Desa 38f1598602
fix(notification/rule): filter statuses by current level if no previous 2019-09-05 10:30:11 -04:00
Michael Desa d96d21c5e1
fix(notification/rule): remove fieldsAsCols pivot from rules 2019-09-05 09:52:05 -04:00
Michael Desa 119f901264
fix(notification/rule): use every from rule in task options in flux 2019-09-04 20:38:31 -04:00
Michael Desa 5ff6f8b9ca
fix(notification/rule): pivot table from monitor 2019-09-04 20:38:31 -04:00
Michael Desa 07e7309c48
fix(notification/rule): add colors to slack notifications 2019-09-04 20:38:31 -04:00
Michael Desa 8251922b63
fix(notification/rule): filter for state changes in rules
fix(notification/rule): add overlap to windows so that state changes works

Since stateChanges cannot detect a state change for the initial point,
returned, we generate a task that queries for more data than required
and filters out records that are before the every. This way we will not
miss state changes that take place on the initial value.

fix(notification/rule): prevent union of tables for single status rule

fix(testing): add status rules to notifications
2019-09-03 16:58:50 -04:00
Michael Desa bf28f6e771
Merge pull request #14863 from influxdata/fix/http-rules
fix(notification/rule): remove name from notify call
2019-08-30 09:59:59 -04:00
Deniz Kusefoglu 9450149561
Add Any to rule levels (#14866)
* WIP

* Fix UI linter errors from swagger changes to Level Rule

* Prevent same level selection on changes from

* Remove unused get

* Fix prettier error

* chore(notification/rule): change level rule to check level for rules
2019-08-29 17:46:00 -07:00
Michael Desa f42ef324a8
fix(notification/rule): remove name from notify call 2019-08-28 20:24:20 -04:00