mirror of
https://github.com/zitadel/zitadel.git
synced 2025-12-23 15:06:44 +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
This commit is contained in:
@@ -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