mirror of
https://github.com/zitadel/zitadel.git
synced 2025-12-30 15:37:12 +00:00
fix(metrics): incorrect mapping of grpc status codes in the grpc_server_grpc_status_code_total metric (#10989)
# Which Problems Are Solved
Requests without errors were mapped being mapped to GRPC status code
`Unknown`, which were then being mapped as HTTP `500` status code.
# How the Problems Are Solved
By deriving the grpc status codes from the error only when there's an
error.
When the error is `nil`, the grpc status code is set to 0 (`OK`).
# Additional Changes
N/A
# Additional Context
- Closes #10884
(cherry picked from commit da63abd1ad)
This commit is contained in:
committed by
Livio Spring
parent
6661e3d7c6
commit
c164ba80dd
@@ -75,7 +75,10 @@ func RegisterGrpcTotalRequestCounter(ctx context.Context) {
|
||||
}
|
||||
|
||||
func RegisterGrpcRequestCodeCounter(ctx context.Context, path string, err error) {
|
||||
statusCode := connect.CodeOf(err)
|
||||
statusCode := connect.Code(codes.OK)
|
||||
if err != nil {
|
||||
statusCode = connect.CodeOf(err)
|
||||
}
|
||||
var labels = map[string]attribute.Value{
|
||||
GrpcMethod: attribute.StringValue(path),
|
||||
ReturnCode: attribute.IntValue(runtime.HTTPStatusFromCode(codes.Code(statusCode))),
|
||||
|
||||
Reference in New Issue
Block a user