Commit Graph

154 Commits (ba5dc411df19a3817b0bace15e3e1f05a06cec7c)

Author SHA1 Message Date
Stuart Carnie d248fea5e5
fix(kv): Add push down predicate hint to filter by keys
A KV store may optionally implement a key predicate
function to filter on keys, which may reduce memory and CPU usage.

Expected user resource mapping improvements for a single user:

Before:
3813719 ns/op  4170142 B/op  33 allocs/op

After:
 316869 ns/op      816 B/op  15 allocs/op
2019-11-20 13:35:13 -07:00
Johnny Steenbergen bc083e169c chore: refactor password service to provide userID instead of name 2019-11-20 09:16:31 -08:00
Lyon Hill 5c7787743e
fix(task): add hinting to allow us to skip task auth lookup (#15973) 2019-11-19 11:06:04 -07:00
Jade McGough 6b19ea7569
fix(kv): don't stub system buckets when searching by name (#15928)
* Removed an unused function as cleanup.
* Users without true system buckets won't have fake buckets returned if they don't specify their org in the request, but this shouldn't break tasks.
2019-11-18 23:33:15 -08:00
Alirie Gray f0ecc0e89d
refactor(tasks): use go Time for Task CreatedAt, UpdatedAt, LatestCompleted, Offset (#15672) 2019-11-12 17:13:56 -08:00
Ariel Salem 3ba8eaac3e
feat(createdAt): Added createdat and updatedAt to Authorization (#15784)
* feat(auth): add createdAt and updatedAt to authorization

Co-Authored-By: Ariel <ariel.salem1989@gmail.com>

* feat(auth): passing createAuth tests

* test: ensured that createdAt and updatedAt are valid on authorizations
2019-11-07 06:46:30 -08:00
Lyon Hill bb6aa1df3b
feat(task): Add a latestScheduled field for tasks (#15785)
Previously we overwrote the tasks existing latestCompleted to be used for latestCompleted as well as latestScheduled.
For obvious reasons this is confusing and missleading. I believe by seperating the two fields we can have a clear seperation
of concerns.
2019-11-06 15:10:52 -07:00
Deary Hudson III 81965f0b33
feat(kv): unique variable names (#15695)
* feat(kv): unique variable names

- adds system bucket for creating an index of unique variable names
- adds tests
- deleted unit tests for dead code
- removed a test runner for the variable service from http
2019-11-04 14:28:21 -06:00
Stuart Carnie 65906a2456
feat(kv): Add unit tests for expected behavior of taskMatchFn 2019-11-01 14:48:50 -07:00
Stuart Carnie b1875d2def
feat(kv): Cursor API accepts hints for improving performance
Implementations of the `kv.Bucket#Cursor` API may use
the hints to instruct the access or read behavior to
the underlying key/value store.

The `findAllTasks` function was also fixed to ensure
that paging works as expected when using a name filter.
Tests were added to verify this behavior.

Redundant error checks were also removed.
2019-11-01 14:48:50 -07:00
Deary Hudson III 741b64d4ee
feat(kv): makes label names unique across kv impls
* feat: (http) label names to be unique

* feat(http): should work for updates as well

* chore: commented out former work. added a failing test

* feat: ensure label uniqueness & test cases

* feat: updating labels ensures uniqueness

* fix: fixes a failing unrelated test

* chore: update changelog
2019-10-31 11:30:36 -05:00
Brandon Farmer ce3e2969ae
Merge pull request #15646 from influxdata/system-bucket-deletion
feat(influxdb): Prevent the deletion of system buckets
2019-10-30 16:02:00 -07:00
Brandon Farmer e473394e7d feat(influxdb): prevent users from rename system buckets 2019-10-30 12:53:43 -07:00
Gavin Cabbage 75147d014c
feat(tasks): expose lastRunStatus and lastRunError in task API 2019-10-30 14:00:22 -04:00
Brandon Farmer af2b2a140f feat(influxdb): Prevent the deletion of system buckets 2019-10-29 14:15:39 -07:00
Kelvin Wang 4615a01338 fix(kv): use urm filter to search endpoints 2019-10-24 13:28:34 -04:00
Kelvin Wang 81283b1ac2 fix(kv): find checks by urm 2019-10-24 12:29:48 -04:00
Brandon Farmer 88bf178802 feat(influxdb): Add labels create endpoints
- Notification Rules
- Notification Endpoints
- Checks

Co-authored-by: Deniz Kusefoglu <deniz@influxdata.com>
2019-10-23 09:53:50 -07:00
Jade McGough 09d24a61b4
fix(kv): allow system buckets to be created (#15542)
This code is no longer necessary, as we now enforce this behavior for http-originating bucket creations here: https://github.com/influxdata/influxdb/blob/master/http/bucket_service.go#L377

Without this change, all system buckets that are created or updated will have the incorrect type.
2019-10-22 16:11:24 -07:00
Brandon Farmer a5b883536c fix(influxdb): system buckets must have org ids 2019-10-22 14:52:19 -07:00
Brandon Farmer 177df27d3f fix(influxdb): move system bucket fallback to kv level 2019-10-22 12:05:04 -07:00
Brandon Farmer bad4751709 fix(influxdb): authorizing system buckets 2019-10-21 15:49:10 -07:00
Brandon Farmer ea82dc3470 fix(tasks): tasks look up system bucket id 2019-10-21 14:48:47 -07:00
Brandon Farmer b343250390 fix(influxdb): fixes broken tests from system bucket changes 2019-10-21 14:48:47 -07:00
Brandon Farmer 2e0749b3ba feat(influxdb): Add system buckets on org creation
* Only allow users to create user buckets
* Only accept bucket creation parameters on post
2019-10-21 14:48:47 -07:00
Alirie Gray 552168d3ae
refactor(tasks): use Go time objects for timestamps on task Runs (#15406) 2019-10-17 17:23:45 -07:00
Lyon Hill 3c6779f011
feat(task): Allow tasks to run more isolated from other task systems (#15384)
* feat(task): Allow tasks to run more isolated from other task systems

To allow the task internal system to be used for user created tasks as well
as checks, notification and other future additions we needed to take 2 actions:

1 - We need to use type as a first class citizen, meaning that task's have a type
and each system that will be creating tasks will set the task type through the api.
This is a change to the previous assumption that any user could set task types. This change
will allow us to have other service's white label the task service for their own purposes and not
have to worry about colissions between the types.

2 - We needed to allow other systems to add data specific to the problem they are trying to solve.
For this purpose adding a `metadata` field to the internal task system which should allow other systems to
use the task service.

These changes will allow us in the future to allow for the current check's and notifications implementations
to create a task with meta data instead of creating a check object and a task object in the database.
By allowing this new behavior checks, notifications, and user task's can all follow the same pattern:

Field an api request in a system specific http endpoint, use a small translation to the `TaskService` function call,
translate the results to what the api expects for this system, and return results.

* fix(task): undo additional check for ownerID because check is not ready
2019-10-11 08:53:38 -06:00
Jakub Bednář ea9cf13af6
fix(notification/rule): fixed http NotificationRule (#15245)
* Fixed handler path for a list of all labels for a notification rule
* Fixed filtering NotificationRules by limit and offset
2019-10-07 09:36:55 +02:00
Deary Hudson bd7c4dad8f fix(http): Ensures users are created with an active status 2019-09-30 15:37:59 -07:00
Lyon Hill 270d39224c
fix(task): include offset in next due calculation (#15281) 2019-09-25 15:21:37 -06:00
Jakub Bednář 9f0d9f6ecb fix(http): fix NotificationEndpoint: (#15148)
* Add TraceSpan parameter to GetNotificationEndpoints operation
* Fixed handler path for a list of all labels for a notification endpoint
* Fixed filter NotificationEndpoints by limit and offset
2019-09-23 15:55:37 -07:00
Brandon Farmer d83fabeabc feat(influxdb): user disabling 2019-09-23 11:57:16 -07:00
Jonathan A. Sternberg cbd04f2884
refactor: http error serialization matches the new error schema (#15196)
The http error schema has been changed to simplify the outward facing
API. The `op` and `error` attributes have been dropped because they
confused people. The `error` attribute will likely be readded in some
form in the future, but only as additional context and will not be
required or even suggested for the UI to use.

Errors are now output differently both when they are serialized to JSON
and when they are output as strings. The `op` is no longer used if it is
present. It will only appear as an optional attribute if at all. The
`message` attribute for an error is always output and it will be the
prefix for any nested error. When this is serialized to JSON, the
message is automatically flattened so a nested error such as:

    influxdb.Error{
        Msg: errors.New("something bad happened"),
        Err: io.EOF,
    }

This would be written to the message as:

    something bad happened: EOF

This matches a developers expectations much more easily as most
programmers assume that wrapping an error will act as a prefix for the
inner error.

This is flattened when written out to HTTP in order to make this logic
immaterial to a frontend developer.

The code is still present and plays an important role in categorizing
the error type. On the other hand, the code will not be output as part
of the message as it commonly plays a redundant and confusing role when
humans read it. The human readable message usually gives more context
and a message like with the code acting as a prefix is generally not
desired. But, the code plays a very important role in helping to
identify categories of errors and so it is very important as part of the
return response.
2019-09-19 10:06:47 -05:00
Chris Goller 6527ba090b fix(kv): remove extraneous function calls 2019-09-08 02:53:46 -05:00
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