mirror of https://github.com/docker/cli.git
Merge pull request #4985 from laurazard/otel-exit-code-int
otel: capture exit code as int64
This commit is contained in:
commit
b2fe82a23e
|
@ -3,7 +3,6 @@ package command
|
|||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
|
@ -110,7 +109,7 @@ func attributesFromError(err error) []attribute.KeyValue {
|
|||
}
|
||||
attrs = append(attrs, attribute.String("command.error.type", otelErrorType(err)))
|
||||
}
|
||||
attrs = append(attrs, attribute.String("command.status.code", strconv.Itoa(exitCode)))
|
||||
attrs = append(attrs, attribute.Int("command.status.code", exitCode))
|
||||
|
||||
return attrs
|
||||
}
|
||||
|
|
|
@ -159,7 +159,7 @@ func TestAttributesFromError(t *testing.T) {
|
|||
testName: "no error",
|
||||
err: nil,
|
||||
expected: []attribute.KeyValue{
|
||||
attribute.String("command.status.code", "0"),
|
||||
attribute.Int("command.status.code", 0),
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -167,7 +167,7 @@ func TestAttributesFromError(t *testing.T) {
|
|||
err: statusError{StatusCode: 127},
|
||||
expected: []attribute.KeyValue{
|
||||
attribute.String("command.error.type", "generic"),
|
||||
attribute.String("command.status.code", "127"),
|
||||
attribute.Int("command.status.code", 127),
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -175,7 +175,7 @@ func TestAttributesFromError(t *testing.T) {
|
|||
err: context.Canceled,
|
||||
expected: []attribute.KeyValue{
|
||||
attribute.String("command.error.type", "canceled"),
|
||||
attribute.String("command.status.code", "1"),
|
||||
attribute.Int("command.status.code", 1),
|
||||
},
|
||||
},
|
||||
} {
|
||||
|
|
Loading…
Reference in New Issue