storage/postgres: pgx client tracing (#5438)

* fix testcontainers docker client using the global tracer provider

* storage/postgres: pgx client tracing

* skip postgres test on macos
This commit is contained in:
Joe Kralicky 2025-01-28 17:10:09 -05:00 committed by GitHub
parent 332d3dc334
commit b5f58997bd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 100 additions and 12 deletions

View file

@ -9,6 +9,7 @@ import (
"time"
"github.com/cenkalti/backoff/v4"
"github.com/exaring/otelpgx"
"github.com/jackc/pgx/v5/pgxpool"
"google.golang.org/protobuf/types/known/fieldmaskpb"
"google.golang.org/protobuf/types/known/timestamppb"
@ -353,6 +354,11 @@ func (backend *Backend) init(ctx context.Context) (serverVersion uint64, pool *p
return serverVersion, nil, err
}
if backend.cfg.tracerProvider != nil {
config.ConnConfig.Tracer = otelpgx.NewTracer(
otelpgx.WithTracerProvider(backend.cfg.tracerProvider))
}
pool, err = pgxpool.NewWithConfig(context.Background(), config)
if err != nil {
return serverVersion, nil, err