-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
node: add status code support to gRPC metrics #409
Conversation
2e964d0
to
4991948
Compare
core/node/rpc/metrics_interceptor.go
Outdated
return next(ctx, req) | ||
resp, err := next(ctx, req) | ||
|
||
s.With(prometheus.Labels{"status": fmt.Sprintf("%d", statusCode(err))}).Inc() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for status, lets use text name - it's way easier to work with metrics then.
also please extract river error, if present, and use it's code, then protocol.Err_name
gives you text name for the given code (works for grpc/connect codes as well).
Underlying error can be extracted by Unwrap
or error.As
core/node/rpc/metrics_interceptor.go
Outdated
unaryInflight: s.metrics.NewGaugeVecEx("grpc_unary_inflight", "gRPC unary calls in flight", "proc"), | ||
openClientStreams: s.metrics.NewGaugeVecEx("grpc_open_client_streams", "gRPC open client streams", "proc"), | ||
openServerStreams: s.metrics.NewGaugeVecEx("grpc_open_server_streams", "gRPC open server streams", "proc"), | ||
rpcDuration: s.rpcDuration, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i'm not sure why durations is initialized this way, I think it can be removed from Service and be moved here for consistently. (also it's "method" on duration and "proc" here, lets unify)
4991948
to
69db95b
Compare
69db95b
to
711a2fc
Compare
711a2fc
to
d4d3c25
Compare
Add the following metrics:
grpc_unary_status_code[proc,status]
, unary calls grouped by procedure and statusgrpc_server_stream_status_code[proc,status]
, server streams grouped by procedure and statusClient streams are more complicated to capture the status code. Since we don't those client streams metrics are not enhanced with status.