Skip to content

Commit

Permalink
feat: include instance and system attrs with DB stats
Browse files Browse the repository at this point in the history
  • Loading branch information
sudo-suhas committed Aug 10, 2023
1 parent 9b7f898 commit 6f9bc99
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion internal/store/postgres/postgres.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
6 changes: 5 additions & 1 deletion pkg/worker/pgq/pgq_processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit 6f9bc99

Please sign in to comment.