From 6f9bc99f470f2fbdc48ba16e0c45b64417ace045 Mon Sep 17 00:00:00 2001 From: Suhas Karanth Date: Thu, 10 Aug 2023 14:02:44 +0530 Subject: [PATCH] feat: include instance and system attrs with DB stats --- internal/store/postgres/postgres.go | 6 +++++- pkg/worker/pgq/pgq_processor.go | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/internal/store/postgres/postgres.go b/internal/store/postgres/postgres.go index fac19ee3..a238a5d8 100644 --- a/internal/store/postgres/postgres.go +++ b/internal/store/postgres/postgres.go @@ -115,7 +115,11 @@ func NewClient(ctx context.Context, cfg Config) (*Client, error) { return nil, fmt.Errorf("ping DB: %w", err) } - if err := otelsql.RecordStats(db); err != nil { + if err := otelsql.RecordStats( + db, + otelsql.WithSystem(semconv.DBSystemPostgreSQL), + otelsql.WithInstanceName("default"), + ); err != nil { return nil, err } diff --git a/pkg/worker/pgq/pgq_processor.go b/pkg/worker/pgq/pgq_processor.go index 91c5e8df..100ff835 100644 --- a/pkg/worker/pgq/pgq_processor.go +++ b/pkg/worker/pgq/pgq_processor.go @@ -51,7 +51,11 @@ func NewProcessor(ctx context.Context, cfg Config) (*Processor, error) { return nil, fmt.Errorf("new pgq processor: %w", err) } - if err := otelsql.RecordStats(db); err != nil { + if err := otelsql.RecordStats( + db, + otelsql.WithSystem(semconv.DBSystemPostgreSQL), + otelsql.WithInstanceName("pgq"), + ); err != nil { return nil, err }