Commit Graph

164 Commits (a2de2cc5c8b275faf00e490a1cad1853bb0169f2)

Author SHA1 Message Date
Brett Buddin a2de2cc5c8
fix(kv): Store canceled task runs in the correct bucket.
Task runs are stored and retrieved from the `taskRunsv1` bucket, but
when they are canceled they are incorrectly placed in the `tasksv1`
bucket. Once this has been done, further look ups of the task run fail,
because it is located in the wrong bucket.

This addresses the problem by placing them back into the `taskRunsv1`
bucket. An additional test has been added to ensure we are able to
successfully read a canceled run.
2019-12-17 10:19:27 -05:00
Alirie Gray b5ccad3c07
feat(metrics): add run latency to executor metrics (#16190) 2019-12-11 14:50:32 -08:00
Johnny Steenbergen b2ea95f512 feat(http): add notification endpoint service
note: tests are seriously borked here. Cannot reuse any existing testing
as the setup is very particular and the http layer doesn't suppport everyting.
that being said, there are goign to be implicit testing in the
`launcher/pkger_test.go` file. This feels broken, and probably needs to be
readdressed before we GA a 2.0 influxdb....
2019-12-10 12:40:17 -08:00
Stuart Carnie 2640f87538
fix(task): LatestScheduled is set when task is updated to active
This change ensures the following behavior:

* task LatestScheduled is always set when a task is updated and
  transitions from a status of inactive to active
* task LatestScheduled is non-zero when created, to set the initial
  schedule time as some point after it was created

In addition, the kv.Service introduces clock.Clock that is used for
task create and task updates only. This change permits testing
in a deterministic fashion.
2019-12-06 11:52:54 -07:00
Nathaniel Cook 423dc9703c
fix(http/bucket): lift bucket name validation to http layer (#16125)
This removes the bucket name validation from the KV BucketService,
and moves it to the http implementation of the service.
The effect is that API user requests still get validated but direct KV access does not
2019-12-05 10:30:08 -07:00
Jacob Marble 5f19c6cace
chore: Remove several instances of WithLogger (#15996)
* chore: Remove several instances of WithLogger

* chore: unexport Logger fields

* chore: unexport some more Logger fields

* chore: go fmt

chore: fix test

chore: s/logger/log

chore: fix test

chore: revert http.Handler.Handler constructor initialization

* refactor: integrate review feedback, fix all test nop loggers

* refactor: capitalize all log messages

* refactor: rename two logger to log
2019-12-04 15:10:23 -08:00
Jakub Bednář f25fe8c5a2 fix(http): Return an empty array if organization has no secret keys (#15363)
* fix(http): Return an empty array if organization has no secret keys

* fix(http): Return an empty array if organization has no secret keys instead nil
2019-12-04 13:29:05 -08:00
Deary Hudson III ad961669ae
feat(http): create cell view properties on dashboard creation (#16112) 2019-12-04 13:47:25 -06:00
Alirie Gray 9417936069
feat(tasks): add ability to filter by active tasks (#15893) 2019-12-02 14:16:10 -08:00
Stuart Carnie a5b29843cf
fix(kv): Add push down predicate hint to filter by keys and values
A KV store may optionally implement a key predicate
function to filter on keys or values, which may reduce memory and
CPU usage.

Expected FindByTaskID resource mapping improvements for a single user:

Before:
206966085 ns/op   37672164 B/op   445060 allocs/op

After:
  1514118 ns/op      11184 B/op      131 allocs/op
2019-11-22 10:55:01 -07:00
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