Skip to content

Commit

Permalink
allow additional metric configuration in ReportDBStatsMetrics (#33)
Browse files Browse the repository at this point in the history
  • Loading branch information
steved authored Nov 24, 2024
1 parent f8f117c commit 68c1f9a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions metrics/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@ func newConfig() *config {
}

// ReportDBStatsMetrics reports DBStats metrics using OpenTelemetry Metrics API.
func ReportDBStatsMetrics(db *sql.DB) {
func ReportDBStatsMetrics(db *sql.DB, opts ...metric.ObserveOption) {
cfg := newConfig()

if cfg.meter == nil {
cfg.meter = cfg.meterProvider.Meter(instrumName)
}

meter := cfg.meter
opts := cfg.opts
opts = append(cfg.opts, opts...)

maxOpenConns, _ := meter.Int64ObservableGauge(
"go.sql.connections_max_open",
Expand Down

0 comments on commit 68c1f9a

Please sign in to comment.