mirror of https://github.com/status-im/consul.git
agent/grpc: rename metrics
These new names should make it easier to add counter metics with similar prefixes
This commit is contained in:
parent
c82d6aa4ff
commit
5319ba02b0
|
@ -60,7 +60,7 @@ func (c *statsHandler) HandleConn(_ context.Context, s stats.ConnStats) {
|
|||
// Decrement!
|
||||
count = atomic.AddUint64(&c.activeConns, ^uint64(0))
|
||||
}
|
||||
c.metrics.SetGauge([]string{"grpc", label, "active_conns"}, float32(count))
|
||||
c.metrics.SetGauge([]string{"grpc", label, "connections"}, float32(count))
|
||||
}
|
||||
|
||||
type activeStreamCounter struct {
|
||||
|
@ -79,10 +79,10 @@ func (i *activeStreamCounter) Intercept(
|
|||
handler grpc.StreamHandler,
|
||||
) error {
|
||||
count := atomic.AddUint64(&i.count, 1)
|
||||
i.metrics.SetGauge([]string{"grpc", "server", "active_streams"}, float32(count))
|
||||
i.metrics.SetGauge([]string{"grpc", "server", "streams"}, float32(count))
|
||||
defer func() {
|
||||
count := atomic.AddUint64(&i.count, ^uint64(0))
|
||||
i.metrics.SetGauge([]string{"grpc", "server", "active_streams"}, float32(count))
|
||||
i.metrics.SetGauge([]string{"grpc", "server", "streams"}, float32(count))
|
||||
}()
|
||||
|
||||
return handler(srv, ss)
|
||||
|
|
|
@ -80,10 +80,10 @@ func TestHandler_EmitsStats(t *testing.T) {
|
|||
|
||||
cmpMetricCalls := cmp.AllowUnexported(metricCall{})
|
||||
expectedGauge := []metricCall{
|
||||
{key: []string{"testing", "grpc", "server", "active_conns"}, val: 1},
|
||||
{key: []string{"testing", "grpc", "server", "active_streams"}, val: 1},
|
||||
{key: []string{"testing", "grpc", "server", "active_conns"}, val: 0},
|
||||
{key: []string{"testing", "grpc", "server", "active_streams"}, val: 0},
|
||||
{key: []string{"testing", "grpc", "server", "connections"}, val: 1},
|
||||
{key: []string{"testing", "grpc", "server", "streams"}, val: 1},
|
||||
{key: []string{"testing", "grpc", "server", "connections"}, val: 0},
|
||||
{key: []string{"testing", "grpc", "server", "streams"}, val: 0},
|
||||
}
|
||||
assertDeepEqual(t, expectedGauge, sink.gaugeCalls, cmpMetricCalls)
|
||||
|
||||
|
|
Loading…
Reference in New Issue