internal/exectracetest: port database/sql test to the new parser#2790
Merged
Conversation
Port the contrib/database/sql execution tracer test to use the new golang.org/x/exp/trace parser. The test is slightly cleaned up, but for the most part covers the same logic as its predecessor (see #2060). The primary difference is that, rather than hooking into a mock database/sql driver, we use a real one (sqlite3). To simulate a slow operation, the test registers a sleep function and also sleeps on connection. The purpose of this is to ensure, where we can, the tracer tasks cover the whole operation and not just the end of it. We no longer hook into _every_ operation, though, so we drop some time assertions.
nsrip-dd
force-pushed
the
nick.ripley/port-sql-trace-test-parser
branch
from
July 16, 2024 18:32
6fa9882 to
994a9eb
Compare
nsrip-dd
marked this pull request as ready for review
July 16, 2024 18:49
BenchmarksBenchmark execution time: 2024-07-16 18:54:17 Comparing candidate commit 994a9eb in PR branch Found 0 performance improvements and 0 performance regressions! Performance is the same for 47 metrics, 0 unstable metrics. |
darccio
approved these changes
Jul 17, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Port the contrib/database/sql execution tracer test to use the new
golang.org/x/exp/trace parser. The test is slightly cleaned up, but for
the most part covers the same logic as its predecessor (see #2060). The
primary difference is that, rather than hooking into a mock database/sql
driver, we use a real one (sqlite3). To simulate a slow operation, the
test registers a sleep function and also sleeps on connection. The
purpose of this is to ensure, where we can, the tracer tasks cover the
whole operation and not just the end of it. We no longer hook into
every operation, though, so we drop some time assertions.
Motivation
To ensure that our execution tracing integration works properly with
contrib/database/sql, and that it is tested in a way that will keep up with
future changes to the execution tracer.
Reviewer's Checklist
Unsure? Have a question? Request a review!