It was possible to create checks with invalid data causing
odd internal errors to return from the layers far down below.
Likely, we need to add more checks to the validation, but, I have
not thoroughly checked.
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.
At times snowflake id generation would create org and bucket IDs with
characters that had special meaning for the storage engine.
The storage engine concats the org and bucket bytes together into a
single 128 bit value. That value is used in the old measurement
section. Measurement was transformed into the tag, _measurement.
However, certain properties of the older measurement data location
are still required for the org/bucket bytes. We cannot have
commas, spaces, nor backslashes.
This PR puts a specific ID generator in place during the creation of
orgs and buckets. The IDs are just random numbers but with each
of the restricted chars incremented by one. While this changes the
entropy distribution somewhat, it does not matter too much for our
purposes.
... because now org and bucket ids are checked for previous existence
transactionally in the key-value stores. If the ID does already exist
then we try to generate a new key up to 100 times.
* 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
* Make endpoint description field normal sized
* Add password type to secret inputs
* de-snarkify and remove defaults from new-endpoint-draft
* Make new tag rules unique
* Remove hardcoded fields in initRuleDraft
* Add tag rule make statusRule is equal to level
* Status rule can be "is equal to"
* Remove cron option from rule
* Add the text lastupdated to cards
* Fix offset and every copy
* Improve Tags in checks
* Move threshold deadman selector to conditions card
* Filter empty tag rules on notification rules
* Make dismiss button gray
* Fix review comments
* remove irrelevant tests
* Fix missing url field from http rule
fix(notification/check): include tags in check object in generated flux
Closes https://github.com/influxdata/influxdb/issues/14769
fix(notification/check): use selected field in threshold functions
Closes https://github.com/influxdata/influxdb/issues/14776
fix(testing): add selected field for check tests
fix(check): use real flux for threshold check
feat(notification/check): generate flux for deadman checks
chore(endpoint): rename webhook endpoint to http endpoint
fix(notification/rule): fetch url for flux script off of endpoint
fix(notification/rule): clean up slack and http rules
fix(notification/rule): change MessageTemp to MessageTemplate
fix(rules): pass endpoint in to rule during create
fix(ui): rename webhook to http
feat(notification/check): namespace deadman under alerts
fix(notification/check): nest tags under tags key in data object in flux
wip
feat(kv): log error if urm cannot be deleted for notification rule
fix(notification/rule): remove name from notify call in slack rule
chore(ui/cypress/e2e): skip rule create test
* added missing Permission types: notificationRules, notificationEndpoints, checks
* Authorization links use Link as a type
* Run's logs are readonly
* TaskCreateRequest and TaskUpdateRequest has description property to update Task description
Create view with checkID in NewVEO
fix ruleToDraftRule bug
Fix no thresholds error
Get correct view status for rendering cell
Fix editVEO flow
Add notification endpoint ID to initRule
Remove task type from check and notification rule
mock generate AST
use check query in EditCheckEO
wip
Create default http notification endpoint
Co-authored-by: Michael Desa <mjdesa@gmail.com>
Dont save view if no dashboardID in saveCheck
Execute queries in editCheckEO
Fix check remove bug
Disable Advanced view and multiple queries in check builder
Disable alerting button if draftQuery is not alertable
chore(kv/check): remove createCheckTask from KV as the result of #14728
* feat(task): Remove token's from task structures
We had previously removed token's from the task api but left the token in place in several locations in the stack.
Now we can cleanly remove the extra tokens.
* feat(task): impersonate user on task execution
Passing tokens to tasks is cumbersome and we needed a way to more easily create tasks. With this change we no longer need a token on task create. We take the user that created the task and pass that in as the "owner". As far as the task is concerned the owner is the source of permissions.
This is done by adding an additional field on task create that is OwnerID. We will no longer respect the token passed in and it will be deprecated soon.
Things to do still:
Task updates need to allow for owners to be set.
First pass at flux AST generation from check
Co-authored-by: Michael Desa <mjdesa@gmail.com>
Co-authored-by: Deniz Kusefoglu <deniz@influxdata.com>
fix(notification/check): format call expression
Co-authored-by: Michael Desa <mjdesa@gmail.com>
Co-authored-by: Deniz Kusefoglu <deniz@influxdata.com>
fix(notification/check): cleanup CheckDefinition
Co-authored-by: Michael Desa <mjdesa@gmail.com>
Co-authored-by: Deniz Kusefoglu <deniz@influxdata.com>
fix(notification/check): clean up threshold functions
Co-authored-by: Michael Desa <mjdesa@gmail.com>
Co-authored-by: Deniz Kusefoglu <deniz@influxdata.com>
fix(notification/check): clean up message function
Co-authored-by: Michael Desa <mjdesa@gmail.com>
Co-authored-by: Deniz Kusefoglu <deniz@influxdata.com>
fix(notification/check): misc fixes
Co-authored-by: Michael Desa <mjdesa@gmail.com>
Co-authored-by: Deniz Kusefoglu <deniz@influxdata.com>
fix(notification/check): remove dead code
Co-authored-by: Michael Desa <mjdesa@gmail.com>
Co-authored-by: Deniz Kusefoglu <deniz@influxdata.com>
fix(notification/check): move threshold flux generation to check pkg
Co-authored-by: Michael Desa <mjdesa@gmail.com>
Co-authored-by: Deniz Kusefoglu <deniz@influxdata.com>
fix(notification/check): move base ast generation to its own package
Co-authored-by: Michael Desa <mjdesa@gmail.com>
Co-authored-by: Deniz Kusefoglu <deniz@influxdata.com>
fix(notification/check): add comment for GenerateFluxAST
Co-authored-by: Michael Desa <mjdesa@gmail.com>
Co-authored-by: Deniz Kusefoglu <deniz@influxdata.com>
docs(notification/flux): add comments to each exported function
Co-authored-by: Michael Desa <mjdesa@gmail.com>
Co-authored-by: Deniz Kusefoglu <deniz@influxdata.com>
feat(notification/check): add tests for GenerateFlux
Co-authored-by: Michael Desa <mjdesa@gmail.com>
Co-authored-by: Deniz Kusefoglu <deniz@influxdata.com>
feat(notification/check): add task options to generated flux
fix(notification/check): use flux compatible duration type
test(notification/check): add task option to task definition
test(http): use check Duration in checks http handlers
feat(check): add TaskID to checks base
fix(notification/check): hack around issue with formatting ast package
wtih multiple files
test(check): create task when check is created
A lot of little changes had to happen as a result of this. This change
was rather painful.
feat(checks): add update and delete of task for check
fix(notifications/check): hack around the alerts package not being
available
test(kv): temporarily skip check tests while we merge the pr above
* adding new templates; removing calls to create templates
* fixing quickstart dashboard creation
* Type dashboard template
* bump templates repo version
* add templateID to template meta in swagger
* Add templateID to document meta type in UI
* add templateID to telegrafPlugin and telegrafplugin info types
* Instantiate templates from static templates
* Get tests to pass
* Fix type conflicts
* Bump templates version
* update changelog
* Use CheckPlot to visualize check view
* Revert to add threshold types
* Disable view type dropdown in checkView
* Add proper equality
* Add errors in default cases
This will only attempt to parse an error as JSON if it has the content
type `application/json` so that it stops trying to parse the result as
JSON when it isn't JSON.
While the real error message is included, the addition of the "could not
parse json" makes it very confusing to read and distracts from the real
issue.
* chore: add new types for NotiicationRules
* build(client): remove client and build each build
* chore: update gitignore to exclude generated client
* fix: allow client dir to be empty
* docs: add README to client dir
* fix(build): add autogen client to eslintignore
* build: gen client for ci js tests
* Add check saving flows and change activeTab type
* Add first pass at alertBuilder
* Change TimeMachineEnum type
* Add xy view properties to checks, and convert to and from check View type
* Add Column Header to checks column
* Add change current check type action
* Access view type through properties
* Load xy view options for check view
* Add orgID to check in createCheck
* Clear current check on close CheckEO
* Create Check Alerting Button
* Create check view on edit and new check EO
* Fix edit check eo action bug
* Update threshold types
* When switch schedule from every to cron change the inputs that are visible
* save Current Check from VEO if view type is check
* Add description component to checks
* TimeMachineIDs to TimeMachineID
* Remove bracketed object decleration
* Remove as Threshold type
* Use ViewType instead of typeof
* Create CheckType type
* Remove time machine reducer tests
* Remove check view properties that come from xyView
* Fix EditCheck hooks
* Move status calculations to body of function
* Update redux store when performing check CRUD
* Create add and remove check actions in timeMachine
* Remove trailing space
* Define new check, edit check and check view routes with VEO
Co-authored-by: Michael Desa <mjdesa@gmail.com>
* Add task status to other task types
* Put editAlerting route behind feature flag
* add action and reducer for update current check
* Add init edit and new check editor overlay
* Split VEO in to two for new and edit view
* get edit and new CheckEO's ready
* Create getViewForTimeMachine action
* current check should be a partial check
* Fix view typing
* Fix linter errors
* Fix equality
* Catch save VEO errors
If client requests with Accept-Encoding: gzip, then
compress response and return with Content-Encoding: gzip.
This increases the server-side load by about 12%, but saves network bandwidth.
benchmark old ns/op new ns/op delta
Benchmark_Query_no_gzip-4 123609 137885 +11.55%
benchmark old allocs new allocs delta
Benchmark_Query_no_gzip-4 149 150 +0.67%
benchmark old bytes new bytes delta
Benchmark_Query_no_gzip-4 14297 15205 +6.35%
* bump to client 0.5.3
* export Query type from client and create alerting mock
* Bump client to 0.5.5
* Merge all status enums to one type
* Fix threshold visualization types
* Add extra underscore to notification rules
* Use check view type from client
* Add description field to checks, notificationrules and endpoints
* Add init check cards
* Add check card actions
* Correct component name
* Add check card context and toggle
* Add id to notification rule base
* Add notification rule cards
* add checks reducer tests
* user immer for checks reducer
* add tests and immer to notification rule reducer
If we handle the flux errors in the query controller, it makes it so we
are handling the errors in the location where the happen rather than at
a layer further up the stack.
This should simplify it so the errors are handled in this single
location instead.
* Add discriminator and enum to check types
* Add threshold discriminators and type enum
* Add notification rule discriminators and type enum
* Remove description field
* Fix reference to threshold base
* Move types to ViewBase type from each View Property
* Fix view properties
* Add monotonex to swagger options
* Add empty to view types
* remove whitespace
* Rename check schema to healthcheck
* add alert schema and endpoints
* Add checkView as a view type
Co-Authored-By: Jade McGough <jademcgough@users.noreply.github.com>