mirror of
https://github.com/pomerium/pomerium.git
synced 2025-07-16 16:26:16 +02:00
telmetry: add databroker storage metrics and tracing (#1161)
* telmetry: add databroker storage metrics and tracing
This commit is contained in:
parent
29fb96a955
commit
3c4513a91e
12 changed files with 255 additions and 15 deletions
34
internal/telemetry/metrics/kv_test.go
Normal file
34
internal/telemetry/metrics/kv_test.go
Normal file
|
@ -0,0 +1,34 @@
|
|||
package metrics
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/gomodule/redigo/redis"
|
||||
"go.opencensus.io/metric/metricdata"
|
||||
)
|
||||
|
||||
func Test_AddRedisMetrics(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
tests := []struct {
|
||||
name string
|
||||
stat redis.PoolStats
|
||||
want int64
|
||||
}{
|
||||
{"redis_conns", redis.PoolStats{ActiveCount: 7}, 7},
|
||||
{"redis_idle_conns", redis.PoolStats{IdleCount: 3}, 3},
|
||||
{"redis_wait_count_total", redis.PoolStats{WaitCount: 2}, 2},
|
||||
}
|
||||
|
||||
labelValues := []metricdata.LabelValue{
|
||||
metricdata.NewLabelValue("redis"),
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
AddRedisMetrics(func() redis.PoolStats { return tt.stat })
|
||||
testMetricRetrieval(registry.registry.Read(), t, labelValues, tt.want, tt.name)
|
||||
})
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue