[jaeger] Stop ignoring uints (#945)
* Stop ignoring uints * Ignore values that overflow
This commit is contained in:
parent
4f3fab3ba7
commit
d6ad4d4d6e
|
|
@ -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{
|
||||
|
|
|
|||
|
|
@ -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},
|
||||
|
|
|
|||
Loading…
Reference in New Issue