Skip to content

Added tracing for both otel and logging#29

Merged
djthorpe merged 5 commits intomainfrom
djt/0310/tracer
Mar 10, 2026
Merged

Added tracing for both otel and logging#29
djthorpe merged 5 commits intomainfrom
djt/0310/tracer

Conversation

@djthorpe
Copy link
Copy Markdown
Member

This pull request refactors the tracing functionality in the connection options and pool setup code. The main focus is to simplify how tracers are managed by removing pointer usage, consolidating tracer initialization, and improving how trace functions and OTEL tracers are wired up. Additionally, a new option for setting only the password is introduced.

Tracing refactor and simplification

  • Changed the opt struct to hold a value of tracer instead of a pointer, and updated initialization to use a value (opts.go) [1] [2].
  • Removed the NewTracer and NewOTELTracer constructor functions, and updated WithTrace and WithTracer to directly set fields on the tracer struct (tracer.go, opts.go) [1] [2].
  • Improved wiring of trace functions and OTEL tracers in the pool creation logic, now checking for either and assigning poolconfig.ConnConfig.Tracer as needed (pool.go).

Option improvements

  • Added a new WithPassword option to set the connection password independently from username and database (opts.go).

Copilot AI review requested due to automatic review settings March 10, 2026 12:27
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Refactors how query tracing is configured for the PostgreSQL pool, and adds an option to set the password independently.

Changes:

  • Switch opt from holding a *tracer to embedding a tracer value and set tracer fields directly via options.
  • Update pool creation to wire tracing when either a TraceFn or OTEL tracer is configured.
  • Add WithPassword option; remove exported NewTracer/NewOTELTracer constructors.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
tracer.go Removes exported tracer constructors, leaving tracer configuration to options/field assignment.
pool.go Updates tracer wiring logic to handle TraceFn and OTEL tracer configuration.
opts.go Refactors tracer storage in options, adds WithPassword, and adjusts WithTrace/WithTracer to set tracer fields.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tracer.go
Comment thread pool.go Outdated
Comment thread opts.go
@djthorpe djthorpe self-assigned this Mar 10, 2026
@djthorpe djthorpe merged commit 7749c48 into main Mar 10, 2026
1 check passed
@djthorpe djthorpe deleted the djt/0310/tracer branch March 10, 2026 12:51
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