Skip to content

fix: Tracer.logConnectionDetails defaults to true#80

Open
trygve-baerland wants to merge 8 commits into
exaring:mainfrom
trygve-baerland:main
Open

fix: Tracer.logConnectionDetails defaults to true#80
trygve-baerland wants to merge 8 commits into
exaring:mainfrom
trygve-baerland:main

Conversation

@trygve-baerland
Copy link
Copy Markdown

From my understanding, the Tracer.logConnectionDetails is meant to default to true (going by how the config struct is initialized in NewTracer), and using WithDisableConnectionDetailsInAttributes to set it to false.

This PR is a fix so the tracer behaves as described above.

I've also added a table of tests making assertions about what attributes are present in traces under different configurations. Since these tests set up a mock pg connection, the changes to tests are quite verbose. I'll be more than happy to get any suggestions on better ways of testing the attributes behaviour (or any other suggestions, for that matter).

obitech added 5 commits May 12, 2026 08:12
The golang.org/x/lint/golint tool was archived in 2020. Replace the
Makefile's `lint` target with `golangci-lint run ./...` and drop the
now-unused `deps` target that installed the archived binary. CI gains
a `golangci-lint` step using golangci/golangci-lint-action@v9 so the
same check runs in pull requests.
Define an unexported spanNameCtxKey struct in
TestTracer_sqlOperationNameFromCtx instead of using a bare string
as the context.WithValue key. Mirrors the startTimeCtxKey{} pattern
already used in tracer.go and silences staticcheck SA1029.
@trygve-baerland
Copy link
Copy Markdown
Author

I see now that this was previously solved by #69, but looks to have been inadvertently reverted by #67.

Sorry for not doing my due diligence before creating this PR.

@obitech
Copy link
Copy Markdown
Member

obitech commented May 13, 2026

Oh boy, thanks for catching this (again). Could you potentially rebase your PR onto #79 and refactor the tests to use testify? I expect 79 to land soon and will merge yours right after. Thank you!

@trygve-baerland
Copy link
Copy Markdown
Author

No problem, @obitech, I can do that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants