@ -36,7 +36,7 @@ func (c *statsHandler) HandleRPC(_ context.Context, s stats.RPCStats) {
}
}
switch s . ( type ) {
switch s . ( type ) {
case * stats . InHeader :
case * stats . InHeader :
c . metrics . IncrCounter ( [ ] string { "grpc" , label , "request" }, 1 )
c . metrics . IncrCounter ( [ ] string { "grpc" , label , "request" , "count" }, 1 )
}
}
}
}
@ -56,6 +56,7 @@ func (c *statsHandler) HandleConn(_ context.Context, s stats.ConnStats) {
switch s . ( type ) {
switch s . ( type ) {
case * stats . ConnBegin :
case * stats . ConnBegin :
count = atomic . AddUint64 ( & c . activeConns , 1 )
count = atomic . AddUint64 ( & c . activeConns , 1 )
c . metrics . IncrCounter ( [ ] string { "grpc" , label , "connection" , "count" } , 1 )
case * stats . ConnEnd :
case * stats . ConnEnd :
// Decrement!
// Decrement!
count = atomic . AddUint64 ( & c . activeConns , ^ uint64 ( 0 ) )
count = atomic . AddUint64 ( & c . activeConns , ^ uint64 ( 0 ) )
@ -80,6 +81,7 @@ func (i *activeStreamCounter) Intercept(
) error {
) error {
count := atomic . AddUint64 ( & i . count , 1 )
count := atomic . AddUint64 ( & i . count , 1 )
i . metrics . SetGauge ( [ ] string { "grpc" , "server" , "streams" } , float32 ( count ) )
i . metrics . SetGauge ( [ ] string { "grpc" , "server" , "streams" } , float32 ( count ) )
i . metrics . IncrCounter ( [ ] string { "grpc" , "server" , "stream" , "count" } , 1 )
defer func ( ) {
defer func ( ) {
count := atomic . AddUint64 ( & i . count , ^ uint64 ( 0 ) )
count := atomic . AddUint64 ( & i . count , ^ uint64 ( 0 ) )
i . metrics . SetGauge ( [ ] string { "grpc" , "server" , "streams" } , float32 ( count ) )
i . metrics . SetGauge ( [ ] string { "grpc" , "server" , "streams" } , float32 ( count ) )