diff --git a/exporters/trace/jaeger/jaeger.go b/exporters/trace/jaeger/jaeger.go index 05a29e2d0e0..778560f2eb8 100644 --- a/exporters/trace/jaeger/jaeger.go +++ b/exporters/trace/jaeger/jaeger.go @@ -324,6 +324,22 @@ func keyValueToTag(keyValue kv.KeyValue) *gen.Tag { VLong: &i, VType: gen.TagType_LONG, } + case value.UINT32: + i := int64(keyValue.Value.AsUint32()) + tag = &gen.Tag{ + Key: string(keyValue.Key), + VLong: &i, + VType: gen.TagType_LONG, + } + case value.UINT64: + // we'll ignore the value if it overflows + if i := int64(keyValue.Value.AsUint64()); i >= 0 { + tag = &gen.Tag{ + Key: string(keyValue.Key), + VLong: &i, + VType: gen.TagType_LONG, + } + } case value.FLOAT32: f := float64(keyValue.Value.AsFloat32()) tag = &gen.Tag{ diff --git a/exporters/trace/jaeger/jaeger_test.go b/exporters/trace/jaeger/jaeger_test.go index 0ad4ded05d2..7f28a6c6fa1 100644 --- a/exporters/trace/jaeger/jaeger_test.go +++ b/exporters/trace/jaeger/jaeger_test.go @@ -17,6 +17,7 @@ package jaeger import ( "context" "encoding/binary" + "math" "os" "sort" "testing" @@ -213,6 +214,7 @@ func Test_spanDataToThrift(t *testing.T) { keyValue := "value" statusCodeValue := int64(2) doubleValue := 123.456 + uintValue := int64(123) boolTrue := true statusMessage := "this is a problem" spanKind := "client" @@ -245,8 +247,8 @@ func Test_spanDataToThrift(t *testing.T) { Attributes: []kv.KeyValue{ kv.String("key", keyValue), kv.Float64("double", doubleValue), - // Jaeger doesn't handle Uint tags, this should be ignored. - kv.Uint64("ignored", 123), + kv.Uint64("uint", uint64(uintValue)), + kv.Uint64("overflows", math.MaxUint64), }, MessageEvents: []export.Event{ {Name: eventNameValue, Attributes: []kv.KeyValue{kv.String("k1", keyValue)}, Time: now}, @@ -266,6 +268,7 @@ func Test_spanDataToThrift(t *testing.T) { Tags: []*gen.Tag{ {Key: "double", VType: gen.TagType_DOUBLE, VDouble: &doubleValue}, {Key: "key", VType: gen.TagType_STRING, VStr: &keyValue}, + {Key: "uint", VType: gen.TagType_LONG, VLong: &uintValue}, {Key: "error", VType: gen.TagType_BOOL, VBool: &boolTrue}, {Key: "status.code", VType: gen.TagType_LONG, VLong: &statusCodeValue}, {Key: "status.message", VType: gen.TagType_STRING, VStr: &statusMessage},