Commit Graph

120 Commits (7d299454db001ae826361fba59d942540c2ccec9)

Author SHA1 Message Date
Chris Goller 623224614e feat(kv): random ids without comma, space, backslash for org and bucket
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.
2019-09-08 01:50:05 -05:00
Jade McGough c1cd152363
feat(http): Add bucket types (#15045) 2019-09-06 17:52:54 -07:00
Lyon Hill a17277f27a
fix(task): Dont update updatedAt on latestCompleted updates (#15009)
We need to only update the updated at time when we recieve a external request for
an update. LatestCompleted is an internal request from the scheduler.
2019-09-06 09:45:10 -06:00
Lyon Hill 5d6bb3fced
fix(task): clean up offset when removed in script (#14961)
When the flux script removes a offset it should be removed from the task
2019-09-06 08:26:50 -06:00
Kelvin Wang 490872301f fix(kv): ignore not found error when removing org dep resources 2019-09-03 18:32:04 -04:00
Kelvin Wang 9d67e4bfbf fix(kv): fix notification rule testing 2019-09-03 12:33:48 -04:00
Kelvin Wang 5b33003e4a fix(kv): fix the status check of check and notification 2019-09-03 10:21:39 -04:00
Jade McGough d147874c1e
fix(kv): mock system buckets (#14884) 2019-08-30 12:47:06 -07:00
Ben Johnson da30d04c39
feat(kv): Add kv.Service org & bucket ID validation hooks.
Adds the ability to customize validation of organization and bucket
IDs in the `kv.Service`.
2019-08-29 10:23:41 -06:00
Lyon Hill 2047351197
fix(notifications): fix a double locking notification rule lookup (#14854)
When using a internal function in kv we can only use internal funciton calls.
By trying to use a Public function we attempt to create a read lock after acquiring a write lock
2019-08-28 16:04:56 -06:00
Kelvin Wang 7a677e9532 fix(http): fix notfication endpoint secret store 2019-08-28 16:02:17 -04:00
Jade McGough 2fa1ca3f49
feat: add metadata for system buckets when org is created (#14741)
feat: add metadata for system buckets when org is created
2019-08-28 12:50:23 -07:00
Jade McGough cd2e29cbcb
feat(swagger): notification rule tag filtering (#14793)
feat(swagger): notification rule tag filtering
2019-08-28 09:25:54 -07:00
Lyon Hill 577578b65e
fix(task): Allow task's with no clear owner to use org owner (#14837)
When a task was created we used to use a token, we then decided to switch to using
A user id. To facilitate this change we pull the users auth associated with the task
and use the auth's `GetUserID` method. This only works if they have not deleted the auth.

We need a fail safe way to populate the ownerID in the circumstance that the auth associated
with the task has been deleted. To facilitate this we can pull the UserResourceMapping's for the org
resource of the type `Owner` and use a organization owner as the task owner. This makes sense because
any organization owner also own's any part of the organization including tasks.
2019-08-28 09:28:12 -06:00
Michael Desa b26ed76d6a
fix(notification/check): ensure cloud integration works
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
2019-08-27 15:02:53 -04:00
Michael Desa b4644a39d1
fix(kv): Create/Update/Delete notification rule tasks in transaction 2019-08-26 07:55:43 -04:00
Michael Desa 9cccf32452
fix(kv): Create/Update/Delete check tasks in transaction 2019-08-26 07:55:43 -04:00
Lyon Hill cce5ed74ea
fix(task): fix failover function for task auth to not fail (#14789)
If a task is created and the auth associated is removed
lookup of tasks currently fail. This is bad behavior.
We should expect to be able to at least see and delete task's that
have old auth.
2019-08-23 16:52:55 -06:00
Lyon Hill 0778f90cfc
fix(task): Remove unnecessary auth lookups (#14733)
* fix(task): Remove unnecessary auth lookups

Currently we look up task authorization for all task lookups even if we are only
looking up the task for internal use's. We can keep the same interface but cutdown
on the amount of lookups we do by using seperate internal functions for task lookup
and task with id lookup
2019-08-21 15:56:33 -06:00
Jade McGough 4523064b6d
fix(kv): check createdat and updatedat should be identical (#14699) 2019-08-20 14:16:40 -07:00
kelwang 99cebbbdc1
Merge pull request #14714 from influxdata/create_task_in_stack
chore(http): split taskservice from check and notification
2019-08-20 11:20:15 -04:00
Lyon Hill 0b247cce5b
feat(task): Remove token's from task structures (#14712)
* 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.
2019-08-20 08:42:40 -06:00
Kelvin Wang 03f6214d0e chore(http): split taskservice from check and notification 2019-08-19 18:56:17 -04:00
Michael Desa bef3de49fa
fix(notification/rule): remove println and add json struct tag for http 2019-08-19 11:57:59 -04:00
Michael Desa ed853290a3
Merge pull request #14695 from influxdata/feat/notification-flux
feat(notifiction_rule): create notification rule task
2019-08-19 07:51:18 -04:00
Michael Desa 8e56c36737
feat(notification_rule): create notification rule task
feat(notification_rule): generate base flux for notification rule

wip: saving state

fix(notification/endpoint): add comment about weird requirements

feat(notification_rule): create notification rule task
2019-08-16 15:43:15 -04:00
Alirie Gray 28089fdb59 feat(tasks): add ability to find tasks by name 2019-08-16 12:07:11 -07:00
Kelvin Wang bbb4fbc50d fix(notification/check): remove authorizationID 2019-08-16 00:00:55 -04:00
Kelvin Wang 43fa754087 fix(kv): fix extra \x00 secret decoding 2019-08-15 21:56:20 -04:00
Kelvin Wang 61628671ed feat(kv): add notification endpoint
Co-authored-by: Jade McGough <jade@thezets.com>
2019-08-15 21:56:18 -04:00
Lyon Hill a8d7870689
feat(task): impersonate user on task execution (#14675)
* 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.
2019-08-15 18:31:52 -06:00
Kelvin Wang f3dcdee504 fix(notification/rule): remove authID requirement 2019-08-15 19:31:45 -04:00
Lyon Hill f4fb6a1753
fix(task): Unify task scheduling across create and query (#14668)
Current behavior is that the first execution of a task happens based on the create time
of the task when using a 'every' schedule. If you create a task at 12:02 and want
the task to run every 15m. The first execution would happen at 12:17, and the 2nd would happen
at 12:30.

To fix this behavior I refactored the kv task to give a single source of knowledge.
We now have one function for finding exactly what the last scheduled task was.
We also now have a single method that calculates when the next schedule is due.
By unifying the logic it should always work the same way weather your asking when to run
or when creating a task.
2019-08-15 15:28:35 -06:00
Deniz Kusefoglu e1508ac2e1
feat(checks): add first pass at creating tasks from checks
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
2019-08-15 15:07:09 -04:00
Lyon Hill e922c8a26f
feat(task): add task types (#14567) 2019-08-06 10:27:52 -06:00
zhulongcheng 17de20e80f fix(task): check ErrTaskNotFound err (#14489) 2019-08-06 10:17:30 -06:00
Jade McGough 0e5091ed21 feat(kv): add check kv 2019-07-31 18:52:13 -04:00
kelwang ab241b1332
Merge pull request #11741 from influxdata/task-members
fix: task members endpoints
2019-07-29 11:30:06 -04:00
Jade McGough 254680f094 fix(kv): add task organization ID lookup 2019-07-28 22:07:03 -07:00
zhulongcheng ce4d5a9852 feat(http): patch notification rule 2019-07-28 22:08:23 +08:00
Alirie Gray c04f3a2b30 chore(tasks): remove old auth code and allow only token auth 2019-07-26 09:51:32 -07:00
Kelvin Wang aaa84617d8 feat(kv): add notification rule kv 2019-07-25 15:15:35 -04:00
Alirie Gray a73d9a2b77
refactor(tasks): remove Checker from KV Service struct (#14367) 2019-07-17 15:21:16 -07:00
Alirie Gray 2202b61032
feat(tasks): add health check to kv service (#14364) 2019-07-17 11:24:50 -07:00
Alirie Gray c7f09d6a56
chore(tasks): use pointers for task errors (#14343) 2019-07-15 13:57:51 -07:00
Lyon Hill c8becfd4a2
feat(task): Create a new task executor for the new modular scheduler (#14252)
* feat(task): create new executor for modular scheduler
2019-07-08 08:13:29 -06:00
lisale0 2187bf345b fixed bolt and inmem tests 2019-06-20 16:25:38 -07:00
Jade McGough 2cd14c7cdb fix failures in variable http testing 2019-06-20 16:25:38 -07:00
lisale0 3330d38984 feat(http): adding createdAt variable 2019-06-20 16:25:38 -07:00
Alirie Gray 66157c9d44 chore(tasks): consolidate task errors into task_errors.go 2019-06-17 16:03:18 -07:00