Skip to content

Commit

Permalink
Render grpc_status metric label as number (#2480)
Browse files Browse the repository at this point in the history
Fixes linkerd/linkerd2#11449

The `grpc_status` metric label is rendered as a long form, human readable string value in the proxy metrics.  For example:

```
response_total{direction="outbound", [...], classification="failure",grpc_status="Unknown error",error=""} 1
```

This is because of the Display impl for Code.  We explicitly convert to an i32 so this renders as a number instead:

```
response_total{direction="outbound", [...] ,classification="failure",grpc_status="2",error=""} 1
```

Signed-off-by: Alex Leong <alex@buoyant.io>
  • Loading branch information
adleong authored and hawkw committed Oct 26, 2023
1 parent a3e9499 commit aebaf41
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion linkerd/app/core/src/metrics.rs
Expand Up @@ -422,7 +422,7 @@ impl FmtLabels for Class {
"classification=\"{}\",grpc_status=\"{}\",error=\"\"",
class(res.is_ok()),
match res {
Ok(code) | Err(code) => code,
Ok(code) | Err(code) => <i32>::from(*code),
}
),

Expand Down

0 comments on commit aebaf41

Please sign in to comment.