Skip to content

Conversation

darccio
Copy link
Member

@darccio darccio commented Aug 12, 2025

What does this PR do?

Detects lib/pq usage to avoid inserting SQLCommenter comments for DBM-APM link.

Additionally, does small refactors done in the scope to simplify code.

Upstream PR for fixing the root cause in lib/pq: lib/pq#1198

Motivation

Avoid COPY statements breaking like:

error: sql: expected 0 arguments, got N

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.
  • New code is free of linting errors. You can check this by running ./scripts/lint.sh locally.
  • 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!

@darccio darccio requested review from a team as code owners August 12, 2025 16:32
@github-actions github-actions bot added the apm:ecosystem contrib/* related feature requests or bugs label Aug 12, 2025
@pr-commenter
Copy link

pr-commenter bot commented Aug 12, 2025

Benchmarks

Benchmark execution time: 2025-08-13 10:19:59

Comparing candidate commit 5fadd4a in PR branch dario.castane/langplat-726/avoid-dbm-apm-link-on-libpq-copy with baseline commit 66aa2dd in branch main.

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

@datadog-datadog-prod-us1
Copy link

datadog-datadog-prod-us1 bot commented Aug 12, 2025

⚠️ Tests

⚠️ Warnings

🧪 2 Tests failed

TestPostgres from github.com/DataDog/dd-trace-go/contrib/database/sql/v2 (Datadog)
Failed

=== RUN   TestPostgres
--- FAIL: TestPostgres (0.00s)
TestPostgres/Query from github.com/DataDog/dd-trace-go/contrib/database/sql/v2 (Datadog)
Failed

=== RUN   TestPostgres/Query
    sql.go:124: 
        	Error Trace:	/home/runner/work/dd-trace-go/dd-trace-go/instrumentation/testutils/sql/sql.go:124
        	Error:      	Expected nil, but got: &pq.Error{Severity:"ERROR", Code:"42P01", Message:"relation \"testsql\" does not exist", Detail:"", Hint:"", Position:"148", InternalPosition:"", InternalQuery:"", Where:"", Schema:"", Table:"", Column:"", DataTypeName:"", Constraint:"", File:"parse_relation.c", Line:"1449", Routine:"parserOpenTable"}
        	Test:       	TestPostgres/Query
    sql.go:302: 
        	Error Trace:	/home/runner/work/dd-trace-go/dd-trace-go/instrumentation/testutils/sql/sql.go:302
        	            				/home/runner/work/dd-trace-go/dd-trace-go/instrumentation/testutils/sql/sql.go:145
...

ℹ️ Info

❄️ No new flaky tests detected

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 5fadd4a | Docs | Was this helpful? Give us feedback!

@darccio darccio force-pushed the dario.castane/langplat-726/avoid-dbm-apm-link-on-libpq-copy branch from fb1a339 to 5fadd4a Compare August 13, 2025 10:07
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant