Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions extra/redisotel/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,23 @@ func reportPoolStats(rdb *redis.Client, conf *config) (metric.Registration, erro
return nil, err
}

waits, err := conf.meter.Int64ObservableUpDownCounter(
"db.client.connections.waits",
metric.WithDescription("The number of times a connection was waited for"),
)
if err != nil {
return nil, err
}

waitsDuration, err := conf.meter.Int64ObservableUpDownCounter(
"db.client.connections.waits_duration",
metric.WithDescription("The total time spent for waiting a connection in nanoseconds"),
metric.WithUnit("ns"),
)
if err != nil {
return nil, err
}

timeouts, err := conf.meter.Int64ObservableUpDownCounter(
"db.client.connections.timeouts",
metric.WithDescription("The number of connection timeouts that have occurred trying to obtain a connection from the pool"),
Expand Down Expand Up @@ -191,6 +208,9 @@ func reportPoolStats(rdb *redis.Client, conf *config) (metric.Registration, erro
o.ObserveInt64(usage, int64(stats.IdleConns), metric.WithAttributeSet(idleAttrs))
o.ObserveInt64(usage, int64(stats.TotalConns-stats.IdleConns), metric.WithAttributeSet(usedAttrs))

o.ObserveInt64(waits, int64(stats.WaitCount), metric.WithAttributeSet(poolAttrs))
o.ObserveInt64(waitsDuration, stats.WaitDurationNs, metric.WithAttributeSet(poolAttrs))

o.ObserveInt64(timeouts, int64(stats.Timeouts), metric.WithAttributeSet(poolAttrs))
o.ObserveInt64(hits, int64(stats.Hits), metric.WithAttributeSet(poolAttrs))
o.ObserveInt64(misses, int64(stats.Misses), metric.WithAttributeSet(poolAttrs))
Expand Down
Loading