-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
EXPLAIN ANALYZE implementation #8947
Conversation
a4c3a73
to
53833d2
Compare
@jsternberg I've broken the PR into multiple commits so it is easier for you to see the changes |
53833d2
to
f55a785
Compare
Godeps
Outdated
@@ -17,8 +17,10 @@ github.com/peterh/liner 88609521dc4b6c858fd4c98b628147da928ce4ac | |||
github.com/philhofer/fwd 1612a298117663d7bc9a760ae20d383413859798 | |||
github.com/retailnext/hllpp 38a7bb71b483e855d35010808143beaf05b67f9d | |||
github.com/spaolacci/murmur3 0d12bf811670bf6a1a63828dfbd003eded177fce | |||
github.com/stretchr/testify 890a5c3458b43e6104ff5da8dfa139d013d77544 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unless there's a compelling reason, I would prefer we didn't add a testing framework. Is this from custom code or is it a dependency on some copied code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with not using other testing packages. This package is included only to leverage the assertion package testify/assert
. It removes a lot of noise from unit tests when asserting for expected behavior / values. If the assertion fails, it will generate a standard t.Error, t.Fail, etc. For more complex types, like collections, diffs will also be produced.
testify/assert
contains APIs for simplifying a number of scenarios and uses the standard Go *testing.T
type to report errors or failures. Some example
- assert.PanicsWithValue – asserts the code panics and returns an expected value. Much simpler than writing
defer
s, etc
Others I like include:
assert.NotNil
assert.NoError
assert.Empty
assert.Equal
This little introduction is helpful. You can also review the docs for the available assertions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm aware of this testing package. But, we don't use it anywhere else and I don't like the idea of including an additional dependency for only one section of code. Introducing this likely means that it will start being used in other locations and the unit tests won't have the same pattern anymore. They don't currently, but adding additional unit test patterns to a code base that already has a bunch seems like too much to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed in favor of pkg/testing/assert
tsdb/engine/tsm1/engine.go
Outdated
@@ -18,11 +18,15 @@ import ( | |||
"sync/atomic" | |||
"time" | |||
|
|||
"strconv" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be grouped with the other imports. I've noticed Gogland seems to do this a lot.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
coordinator/shard_mapper_test.go
Outdated
@@ -74,7 +75,7 @@ func TestLocalShardMapper(t *testing.T) { | |||
t.Fatalf("unexpected number of shard mappings: %d", len(m.ShardMap)) | |||
} | |||
|
|||
if _, err := ic.CreateIterator(measurement, query.IteratorOptions{}); err != nil { | |||
if _, err := ic.CreateIterator(context.TODO(), measurement, query.IteratorOptions{}); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you modify these various context.TODO()
calls to what they're supposed to be?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll change them to Background
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@@ -0,0 +1,32 @@ | |||
package tracing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a doc.go
file to this package to explain the behavior? I think I've figured it out, but it's a bit confusing and I don't see very many doc comments.
If I'm correctly, you create a Trace
at the beginning of the thing you want to trace. You then use the Span
to create child spans. All spans are managed by the Trace
and each Span
only keeps track of its own level. It does not keep track of anything else.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
947dadf
to
82340a5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Squash the commits and just one comment. I'm approving in advance.
LICENSE_OF_DEPENDENCIES.md
Outdated
@@ -25,3 +25,5 @@ | |||
- github.com/uber-go/zap [MIT LICENSE](https://github.com/uber-go/zap/blob/master/LICENSE.txt) | |||
- golang.org/x/crypto [BSD LICENSE](https://github.com/golang/crypto/blob/master/LICENSE) | |||
- jquery 2.1.4 [MIT LICENSE](https://github.com/jquery/jquery/blob/master/LICENSE.txt) | |||
- github.com/xlab/treeprint [MIT LICENSE](https://github.com/xlab/treeprint/blob/master/LICENSE) | |||
- github.com/stretchr/testify [MIT LICENSE](https://github.com/stretchr/testify/blob/master/LICENSE) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This license needs to be removed if we aren't using this dependency.
* Introduces EXPLAIN ANALYZE command, which produces a detailed tree of operations used to execute the query. introduce context.Context to APIs metrics package * create groups of named measurements * safe for concurrent access tracing package EXPLAIN ANALYZE implementation for OSS Serialize EXPLAIN ANALYZE traces from remote nodes use context.Background for tests group with other stdlib packages additional documentation and remove unused API use influxdb/pkg/testing/assert remove testify reference
cef90a4
to
e931387
Compare
EXPLAIN ANALYZE SELECT ... will measure a number of counters whilst
executing the query. All data is processed, providing an accurate
account of blocks that were decoded, cursors created for each
expression in a SELECT statement.
The total planning and execution times are measured.
Required for all non-trivial PRs