Commit Graph

603 Commits (e9689b7269bc219bd75a1d3a51770de257b2c8e8)

Author SHA1 Message Date
Johnny Steenbergen ad841608ca chore(http): refactor bucket|dashboard|label|umr|var http clients to use reusable HTTP client
this is a step towards providing a shared http client that manages  pooling connections,
timeouts, and reducing GC for by not creating/GCing a client each req. Bring on the red!
2019-12-09 09:44:41 -08:00
Lorenzo Affetti f765612ec1 feat(query): add trace_id and sampled to the query log 2019-12-05 16:06:15 +01: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
Nathaniel Cook fd63ff17f3
feat(cmd/influx): add command to manually transpile InfluxQL to Flux (#16119) 2019-12-04 13:31:20 -07:00
Christopher M. Wolff ec288a6434
fix(query): update version of Flux in promqltests (#16091) 2019-12-03 11:07:12 -08:00
Jonathan A. Sternberg d7ddcf5abc
feat(query): enable optimized pivot push down rule (#16073)
Use the optimized pivot when the influxdb source is being used.
2019-12-03 09:16:19 -06:00
Christopher M. Wolff 291f7b3e19
build(flux): update Flux to v0.54.0 (#15851) 2019-11-12 08:38:57 -08:00
Christopher M. Wolff 360a3d9d53
build(query): update promqltests to latest Flux version (#15786) 2019-11-06 12:22:42 -08:00
Christopher Wolff 51c92fd0ed test(query): reskip flakey test
https://github.com/influxdata/influxdb/issues/15667
2019-10-30 14:22:59 -07:00
Christopher Wolff 7aa1fccee0 test(query): unskip skipped PromQL transpiler end-to-end .flux tests 2019-10-30 10:40:03 -07:00
Julius Volz e4558257e3 test(query): add PromQL end-to-end tests in go submodule
Signed-off-by: Lorenzo Affetti <lorenzo.affetti@gmail.com>
Signed-off-by: Julius Volz <julius.volz@gmail.com>

move to internal

update flux to v0.50

Revert "move to internal"

This reverts commit bcd4caffbd44135f1dbeac4163cb2a22a751f45a.

promtests/internal --> internal/promtests
2019-10-28 18:59:50 +01:00
Jonathan A. Sternberg 33c3f92329
fix(query/stdlib): fix rewritten pushable expressions when a logical expression is present (#15557)
When `exists` was used in conjunction with any other pushed down
expression, the `exists` was not rewritten properly because the rewrite
did not descend into logical expressions.

This is now fixed so those expressions will be rewritten correctly. This
affected the following form:

    filter(fn: (r) => r._measurement == "cpu" and exists r.host)

It did not affect the following:

    filter(fn: (r) => r._measurement == "cpu")
    |> filter(fn: (r) => exists r.host)
2019-10-23 15:59:20 -07:00
Jonathan A. Sternberg f82e6b2626
chore(query/stdlib): skip flaky tests regarding storage meta queries (#15451) 2019-10-17 09:54:44 -07:00
Jonathan A. Sternberg 74829b025c
refactor(query/stdlib): update flux end to end tests for package subtests (#15392) 2019-10-15 09:18:21 -05:00
Jonathan A. Sternberg 8ac8ecdb31
feat(query/control): include variable memory limits for the controller (#15300)
The controller now supports setting an initial memory limit and setting
a maximum amount of memory that the controller may use separately from
the memory quota per query and the concurrency quota.

This allows the controller to increase the concurrency quota to a larger
number while setting the maximum amount of memory to a lower amount than
would be required for all queries to use 100% of their allowable memory.

Functionally, this means that a query will have a soft limit for an
initial memory byte quota that a query is guaranteed to have, a shared
pool that it is allowed access to in the case it uses more, and a hard
limit that no query may exceed to prevent runaway queries from taking
over the entire pool.

This change is completely backwards compatible with older configurations
as the new options will default to values that mimic the old behavior
where a query is allocated the full amount of its memory quota and the
maximum amount of memory is based on the concurrency quota and this
maximum memory quota.

In addition to the above, this also fixes a bug in the controller that
allowed it to run more than its concurrency as executing queries. This
happened when the results had finished being sent by the executor, but
the query had not yet been read and/or serialized. The executor would be
freed up and would take the next query even though the previous query
hadn't yet been finalized with `Done()`.
2019-10-15 09:18:00 -05:00
Jonathan A. Sternberg eacc1b0d9c
fix(query): update the QueryServiceProxyBridge to check for an error properly (#15353)
The QueryServiceProxyBridge would not check for errors properly because
it would return any error encountered when running the query as a read
error on the `io.Reader`. This made it so that the csv decoder could not
identify if the error was related to the query or if it was related to
reading. The csv decoder needed to tell the difference because an error
with reading from the `io.Reader` needs to be returned as a decoder
error while an error from the query needs to be returned as-is.

Instead of adapting the csv decoder to do that, we instead lazily
initialize the result iterator when `More()` is called and call `Peek()`
on the reader. If no bytes can be read, we assume this was an error
while executing the query and return it as such. If we are able to read
at least one byte, we decode it through the csv decoder.
2019-10-09 11:06:32 -07:00
Lyon Hill 5e1d7f6c69
feat(task): remove preauth (#15286)
* feat(task): remove preauth

* fix(task): remove e2e test that verified preauth
2019-09-26 10:52:24 -06:00
Christopher Wolff 26dbd9225c feat(query/stdlib/experimental): add experimental.to() implementation to OSS 2019-09-20 14:31:58 -07:00
Lorenzo Affetti 9532c9d170 fix(testing): skip unbounded e2e test 2019-09-19 17:51:45 +02:00
Lorenzo Affetti 2a6cfe3c78 fix(query): inject dependencies in context for BucketAccessed 2019-09-19 17:31:13 +02:00
Lorenzo Affetti 3f50cd2af9 Merge branch 'master' into flux-staging-v0.48.x 2019-09-19 17:20:40 +02: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
Lorenzo Affetti ab835c8e0e
refactor(dependencies): use new dependency injection framework (#15174)
refactor(dependencies): use new dependency injection framework
2019-09-19 17:01:17 +02:00
Christopher Wolff eb15b346cc chore: update to Flux v0.47.1 2019-09-18 11:51:46 -07:00
Lorenzo Affetti 95ba072f92
Merge pull request #15137 from influxdata/flux-staging-v0.47.x
build(flux): update Flux to v0.47.0
2019-09-13 19:05:42 +02:00
Jonathan A. Sternberg e99456d9d3
refactor(query/control): update a test to use the arrow allocator interface (#15138)
We are planning to change the allocator interface within flux to use the
arrow allocator. To make the release easier, this updates the test in
advance to use the arrow allocator instead of the to be changed memory
allocator interface from flux.
2019-09-13 11:51:15 -05:00
Lorenzo Affetti 7102febafd fix(testing): skip promql e2e tests 2019-09-13 18:49:00 +02:00
Stuart Carnie d56af6eb29
fix(query): Ensure tags are sorted before passing to PointsWriter
Writes directly to a PointsWriter require the tag key, value pairs
are sorted in lexicographically ascending order. This commit uses
new API from the `models` package to ensure this invariant is
maintained.
2019-09-11 16:37:57 -07:00
Jonathan A. Sternberg bea3a18330
fix(query/stdlib): use auth correctly in the v1.databases() call (#14927)
The `v1.databases()` call did not correctly filter buckets based on
auth. Fortunately, it did not cause any improper permissions such as
allowing a person to see buckets that they had no read access to.

The error instead was that if a user did not have read access to one of
the buckets that was returned, the entire command would fail rather than
filter out the bucket that didn't have permissions.

This changes it so that if the user doesn't gets an unauthorized error
when accessing a bucket, it will filter it from the list instead of
failing. It also changes it so the error message is marked as
`ENotFound` instead of as an internal error.
2019-09-05 10:35:23 -05:00
Nathaniel Cook 454003841a build(flux): upgrade to Flux v0.42.0
Skips a test that requires special dependencies to pass.
2019-08-30 13:02:30 -06:00
Jonathan A. Sternberg ae780ff468
tests(cmd/influxd/launcher): add a launcher test for the secret service (#14813)
The secret service is tested by creating a secret and then attempting to
use it in a flux query. There is one test where accessing the secret
should work and one where it should return that the action is forbidden.
2019-08-27 10:44:46 -05:00
Adam fcfdd2b1ef build(flux): update to latest flux master 2019-08-26 16:46:17 -06:00
Adam f97929614c test(query): roll back some changes to end_to_end_test.go 2019-08-26 16:46:17 -06:00
Adam 945b68b8fd fix(query): finish refactoring the repl and inject the secret service as a dependency 2019-08-26 16:46:17 -06:00
Adam 808ebb9590 fix(query): update usage of interpreter dependencies 2019-08-26 16:46:17 -06:00
Nathaniel Cook 6303e2dcc5 test(query): skip holt_winters_panic test
added executor dependencies where needed
2019-08-26 16:46:17 -06:00
Nathaniel Cook 4b339dd0cf fix(query/to): make orgID default to the context org
This change makes it so that if an org or orgID are missing on calls to the `to` function
that the orgID is retrieved from the request context.

This is consistent with how `from` works.
2019-08-23 11:03:26 -06:00
Nathaniel Cook 6b54abb51e test(query): skip holt_winters_panic test 2019-08-22 13:11:13 -06:00
docmerlin (j. Emrys Landivar) 19fe098888 chore(ci): update go-tools 2019-08-22 10:55:05 -05:00
Jonathan A. Sternberg 11aae144b2
feat(query): wrap the secret service for flux (#14732)
The secret service is wrapped to be compatible with the flux interface
to the secret service.

The organization id is not part of the flux interface so this code
extracts the organization id from the query context so that it can lookup
a secret within the organization.
2019-08-22 10:47:02 -05:00
Nathaniel Cook 7498c06d3f test(query): skip check and http_endpoint Flux tests 2019-08-21 09:59:01 -06:00
Nathaniel Cook 6a0fa44093 fix(query): update code for changes to scoped compiler 2019-08-21 09:59:01 -06:00
Nathaniel Cook 1b8ab3c2f2 fix(query): remove http.to and update test cases that used it 2019-08-21 09:59:01 -06:00
Christopher M. Wolff c61646d0f4 feat(query/stdlib): add an experimental "to" function (#14664) 2019-08-21 09:59:01 -06:00
Nathaniel Cook cd2bfb9b22 refactor(query/stdlib): update tests for new Flux test name conventions (#14669) 2019-08-21 09:59:01 -06:00
Jonathan A. Sternberg b35552721c
fix(query/control): handle flux errors from the table iterator in the controller (#14715) 2019-08-20 12:20:40 -05:00
Stuart Carnie 9d94b7500d
fix(flux): Fix hanging test by ensuring results are read
Closes #14574
2019-08-12 16:47:03 -07:00
Lorenzo Affetti ef238ae064 skipping failing e2e tests 2019-08-06 12:48:32 +02:00
j. Emrys Landivar (docmerlin) b303d54584 perf(query): hoist bucket lookups so we do not look up per table
perf(query): hoist bucket lookups so we do not look up per table
2019-08-05 16:02:33 -05:00
j. Emrys Landivar (docmerlin) 24c1f21e4e WIP 2019-08-05 13:16:51 -05:00
Christopher M. Wolff 42bb664aaf
feat(query): add storage request duration metric (#14534)
influxdata/idpe#4126
2019-08-02 08:53:14 -07:00
Jonathan A. Sternberg e4c89cbe0c
feat(query/stdlib): push down exists operator to storage (#14538)
The `exists` operator now gets pushed down to storage correctly. If
`exists` is used on a tag, then it will be rewritten to `tag != ""`
which is how storage defines if a tag exists. If `not exists` is used,
then it will use `tag == ""` which is how you would query storage for
only if a tag doesn't exist.

The `tag == ""` and `tag != ""` are different. For `tag == ""`, the
predicate is impossible for the storage layer to return true with.
Ideally, we would just rewrite this to return nothing and we wouldn't
bother with even querying storage. Instead, we just do not rewrite this
predicate because it cannot be rewritten to make sense with storage. If
we see `tag != ""`, it is the only one that can be passed through as-is
because `tag != ""` returns the same values as `exists tag`. It will
return true for every non-null value.
2019-08-02 09:31:10 -05:00
Christopher M. Wolff e142f6ca7c
fix(query): add LookupName method to dependency interfaces (needed by flux to()) (#14498) 2019-08-01 10:10:43 -07:00
George b2fe0d1d63
fix(tasks): surface flux errors on pre-auth check (#14492) 2019-07-31 11:46:28 +02:00
Christopher Wolff 3855ad9f33 chore: update Flux to v0.37.2 2019-07-24 12:57:37 -07:00
Christopher Wolff 63c0f40548 fix(query): use auth-wrapped org and bucket services for query 2019-07-19 20:02:53 -06:00
Jonathan A. Sternberg 47b032464f
refactor(query): handle flux errors in the query controller instead of http (#14368)
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.
2019-07-18 11:43:15 -05:00
Jonathan A. Sternberg ee7ff84d8b
feat(query/stdlib): update influxdb sources to use flux error codes (#14346)
Update the influxdb sources to be annotated with flux error codes. This
will enable us to identify different response codes for these
operations.
2019-07-16 09:15:46 -05:00
Nathaniel Cook e59c72b245 fix(tests): update e2e tests for new flux executetest methods 2019-07-12 11:15:58 -06:00
Nathaniel Cook 92a4ee53cf fix(query): skip tests 2019-07-12 11:15:58 -06:00
Jonathan A. Sternberg a0f585bd56
fix(query/stdlib): remove skip from the flux e2e tests (#14253)
The underlying bug that caused them to be flaky has been fixed.
2019-07-03 12:03:22 -05:00
Nathaniel Cook 11a4b911b0 fix(query/influxql): use explicit mergeKey parameter 2019-07-03 09:48:31 -06:00
Jonathan A. Sternberg 3d9b9fe36f
chore(query): disable flaky end to end tests for flux (#14231) 2019-06-28 10:15:47 -05:00
Adam d85ef69e19 Merge remote-tracking branch 'origin/master' into flux-staging 2019-06-19 13:38:49 -04:00
Adam 1d84bf6516 fix(stdlib/testing): skip flaky test regexp_replaceAllString 2019-06-18 16:25:59 -04:00
roshie548 15f66d1b98 moved field declaration line 2019-06-18 08:51:34 -07:00
roshie548 f45d616eaa added test case 2019-06-18 08:51:34 -07:00
roshie548 13b397bb3c fix(stdlib): Fixed to() creating too many rows for multiple fields
If a table has multiple field values, to() no longer writes rows multiple times.
2019-06-18 08:51:34 -07:00
Christopher Wolff e495ca3e27 fix(query): recover from panics during compiler and start steps
Fixes influxdata/idpe#3409.
2019-06-11 08:41:13 -07:00
Jonathan A. Sternberg 65dabb0774
Merge branch 'master' into flux-staging 2019-06-06 11:22:04 -05:00
Lorenzo Affetti 5f8796aca6
Merge pull request #14044 from influxdata/fix/gen-promql
fix(promql): synch generated code
2019-06-05 17:53:51 +02:00
Jonathan A. Sternberg 42c8ce3481
fix(query/stdlib): remove skips for tests that were flaky from table.Do (#14048) 2019-06-03 11:56:25 -05:00
Lorenzo Affetti 6e4c66e21f fix(promql): synch generated code 2019-06-03 17:47:59 +02:00
Jonathan A. Sternberg c6bb1ef4e2
fix(query/control): queue size test was flaky (#14030)
In the QueueSize test, it was possible that after the `done` channel was
closed, one of the queries from the queue would begin executing. If all
three began executing before the shutdown was done, the third would
block on attempting to send a value to the `executing` channel and it
would never finish so the controller would report that shutdown failed.

This increases the queue size to a combination of the concurrency quota
and the queue size so all of the started queries will never block when
sending a signal to the executing channel.
2019-05-31 08:59:45 -05:00
Christopher Wolff 6d3cf4b71e test(query): update typo in Flux in test
This test started failing as a result of influxdata/flux/#1312.
2019-05-30 16:29:31 -07:00
Jonathan A. Sternberg 2b1c1ec143
fix(storage/reads): fix the storage tables to work correctly with multiple transformations (#14016)
The storage table reader will now work correctly when there are multiple
outputs. The table interface now implements the new table and column
reader interfaces and works properly with `execute.CopyTable`. The
source uses `execute.CopyTable` to buffer the table in memory when there
are multiple output transformations.
2019-05-30 12:31:54 -05:00
Jonathan A. Sternberg c560e27e1d
chore(flux): update to Flux v0.31.1 (#14015) 2019-05-29 15:48:23 -05:00
Jonathan A. Sternberg 21c80f3e93
refactor(query/control): move the controller from flux to influxdb (#13991)
The controller implementation is primarily used by influxdb so it
shouldn't be part of the flux repository. This copies the code from flux
to influxdb so it can be removed from the next flux release.
2019-05-29 09:04:34 -05:00
Jonathan A. Sternberg ebdbc394fc
chore(flux): update to Flux v0.31.0 (#14002)
* refactor(storage/reads): update the table implementation for the interface change (#13994)

* chore(flux): update to Flux v0.31.0
2019-05-28 17:24:26 -05:00
docmerlin (j. Emrys Landivar) fa849d5c0b chore(testing) skip flakey test 2019-05-28 10:49:16 -05:00
Nathaniel Cook 8ebd6c8315 chore(query): add missing skip tests from merge 2019-05-15 10:18:08 -06:00
Lorenzo Affetti 44fb090468 test(flux/e2e): export skip list 2019-05-13 19:14:52 +02:00
Adam ae25f0c448 Merge remote-tracking branch 'origin/master' into flux-staging 2019-05-09 15:29:00 -04:00
Jonathan A. Sternberg dd56c23343
fix(query/influxql): update transpiler for moved/renamed code (#13740)
The `databases()` function was moved into the `influxdata/influxdb/v1`
package and so it wouldn't work anymore. The `percentile()` call was
changed to `quantile()` and the argument was changed to `q`. This also
updates `median()` to use `median()` since we now produce AST's and not
the spec so we can use the `median()` definition instead.
2019-05-09 11:22:32 -05:00
Adam 415f698491
Merge pull request #13830 from influxdata/fix/to_heterogeneous
Fix/to heterogeneous
2019-05-08 16:45:46 -04:00
Adam 397c33a0dc fix(stdlib/influxdata): fix influxdb.to function to process heterogeneous tables 2019-05-08 09:37:43 -04:00
jlapacik dc59629f69 fix(influxdb): better error message when range not pushed down
Fixes https://github.com/influxdata/flux/issues/1224.
2019-05-07 09:59:58 -07:00
jlapacik faab75968b refactor(storage): remove Read method from Store interface 2019-05-03 11:02:20 -07:00
jlapacik 7333847e2a refactor(influxdb): remove and/or transfer duplicated tests 2019-05-03 11:02:20 -07:00
jlapacik 0ce05e7ad6 refactor(influxdb): remove old FromProcedureSpec 2019-05-03 11:02:20 -07:00
Lorenzo Affetti 33418aac2c test(flux/e2e): skip flaky window_generate_empty test 2019-05-02 18:19:07 +02:00
jlapacik e50508a349 feat(influxdb): enable group pushdown rule
Closes #13623.
2019-05-01 10:35:10 -07:00
jlapacik 95aa194498 feat(storage): ReadGroup RPC definitions and storage reader 2019-05-01 10:35:10 -07:00
jlapacik 5f87134ca8 feat(query): physical group operation and pushdown rule
test(query): group pushdown rule
2019-05-01 10:35:10 -07:00
Jonathan A. Sternberg 1a254a3293
feat(stdlib): enable the tag keys optimization for meta queries (#13705) 2019-04-30 21:32:47 -05:00
Stuart Carnie fb39ac39ce
fix(storage): Store.Read behavior changed to return unsorted series keys
Closes #13581
2019-04-26 10:38:59 -07:00
Jonathan A. Sternberg 46d2d0012b fix(storage): translate _measurement and _field to the proper strings (#13662)
The RPC call should translate `_measurement` and `_field` to their
proper shortened byte strings when requesting the tag values.

This also fixes the planner rewrites to return the root node even when
no rewrite happened as this is required by the planner.
2019-04-26 10:36:51 -07:00
Nathaniel Cook e651b020b2 refactor(query): enable new planner rules and remove old rules 2019-04-25 11:16:11 -07:00
Ben Johnson 01bfcf822b
Merge point parse & explode (#12377)
Merge point parse & explode
2019-04-24 10:30:16 -06:00
Ben Johnson 272f340c30
Merge point parse & explode. 2019-04-24 10:12:15 -06:00