Skip to content

Commit b486221

Browse files
universe/db/postgres: Add db.namespace to all PG traces. (#1375)
1 parent bf8ef01 commit b486221

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

internal/cli/cmd/cluster/cmd.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ func NewClusterCmd(hidden bool) *cobra.Command {
6161
cmd.AddCommand(NewCreateCmd())
6262
cmd.AddCommand(NewListCmd())
6363
cmd.AddCommand(NewSshCmd())
64+
cmd.AddCommand(NewVncCmd())
6465
cmd.AddCommand(NewKubectlCmd())
6566
cmd.AddCommand(NewBuildCmd())
6667
cmd.AddCommand(NewLogsCmd())

universe/db/postgres/resource.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010

1111
"github.com/exaring/otelpgx"
1212
"github.com/jackc/pgx/v5/pgxpool"
13+
semconv "go.opentelemetry.io/otel/semconv/v1.26.0"
1314
"go.opentelemetry.io/otel/trace"
1415
"namespacelabs.dev/foundation/framework/resources"
1516
postgrespb "namespacelabs.dev/foundation/library/database/postgres"
@@ -42,7 +43,8 @@ func NewDatabaseFromConnectionUriWithOverrides(ctx context.Context, db *postgres
4243

4344
var t trace.Tracer
4445
if tp != nil {
45-
config.ConnConfig.Tracer = otelpgx.NewTracer(otelpgx.WithTracerProvider(tp))
46+
config.ConnConfig.Tracer = otelpgx.NewTracer(otelpgx.WithTracerProvider(tp),
47+
otelpgx.WithAttributes(semconv.DBNamespace(config.ConnConfig.Database)))
4648
t = tp.Tracer("namespacelabs.dev/foundation/universe/db/postgres")
4749
}
4850

0 commit comments

Comments
 (0)