Skip to content
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

internal/exectracetest: port database/sql test to the new parser #2790

Merged
merged 2 commits into from
Jul 17, 2024

Conversation

nsrip-dd
Copy link
Contributor

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

  • Changed code has unit tests for its functionality at or near 100% coverage.
  • System-Tests covering this feature have been added and enabled with the va.b.c-dev version tag.
  • There is a benchmark for any new code, or changes to existing code.
  • If this interacts with the agent in a new way, a system test has been added.
  • Add an appropriate team label so this PR gets put in the right place for the release notes.
  • Non-trivial go.mod changes, e.g. adding new modules, are reviewed by @DataDog/dd-trace-go-guild.

Unsure? Have a question? Request a review!

@github-actions github-actions bot added the apm:ecosystem contrib/* related feature requests or bugs label Jul 16, 2024
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 nsrip-dd force-pushed the nick.ripley/port-sql-trace-test-parser branch from 6fa9882 to 994a9eb Compare July 16, 2024 18:32
@nsrip-dd nsrip-dd marked this pull request as ready for review July 16, 2024 18:49
@nsrip-dd nsrip-dd requested review from a team as code owners July 16, 2024 18:49
@pr-commenter
Copy link

pr-commenter bot commented Jul 16, 2024

Benchmarks

Benchmark execution time: 2024-07-16 18:54:17

Comparing candidate commit 994a9eb in PR branch nick.ripley/port-sql-trace-test-parser with baseline commit d3a6549 in branch main.

Found 0 performance improvements and 0 performance regressions! Performance is the same for 47 metrics, 0 unstable metrics.

@nsrip-dd nsrip-dd enabled auto-merge (squash) July 17, 2024 12:11
@nsrip-dd nsrip-dd merged commit 0a6bcb7 into main Jul 17, 2024
184 of 185 checks passed
@nsrip-dd nsrip-dd deleted the nick.ripley/port-sql-trace-test-parser branch July 17, 2024 12:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
apm:ecosystem contrib/* related feature requests or bugs no-changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants