[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,
|
VLong: &i,
|
||||||
VType: gen.TagType_LONG,
|
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:
|
case value.FLOAT32:
|
||||||
f := float64(keyValue.Value.AsFloat32())
|
f := float64(keyValue.Value.AsFloat32())
|
||||||
tag = &gen.Tag{
|
tag = &gen.Tag{
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@ package jaeger
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
|
"math"
|
||||||
"os"
|
"os"
|
||||||
"sort"
|
"sort"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
@ -213,6 +214,7 @@ func Test_spanDataToThrift(t *testing.T) {
|
||||||
keyValue := "value"
|
keyValue := "value"
|
||||||
statusCodeValue := int64(2)
|
statusCodeValue := int64(2)
|
||||||
doubleValue := 123.456
|
doubleValue := 123.456
|
||||||
|
uintValue := int64(123)
|
||||||
boolTrue := true
|
boolTrue := true
|
||||||
statusMessage := "this is a problem"
|
statusMessage := "this is a problem"
|
||||||
spanKind := "client"
|
spanKind := "client"
|
||||||
|
|
@ -245,8 +247,8 @@ func Test_spanDataToThrift(t *testing.T) {
|
||||||
Attributes: []kv.KeyValue{
|
Attributes: []kv.KeyValue{
|
||||||
kv.String("key", keyValue),
|
kv.String("key", keyValue),
|
||||||
kv.Float64("double", doubleValue),
|
kv.Float64("double", doubleValue),
|
||||||
// Jaeger doesn't handle Uint tags, this should be ignored.
|
kv.Uint64("uint", uint64(uintValue)),
|
||||||
kv.Uint64("ignored", 123),
|
kv.Uint64("overflows", math.MaxUint64),
|
||||||
},
|
},
|
||||||
MessageEvents: []export.Event{
|
MessageEvents: []export.Event{
|
||||||
{Name: eventNameValue, Attributes: []kv.KeyValue{kv.String("k1", keyValue)}, Time: now},
|
{Name: eventNameValue, Attributes: []kv.KeyValue{kv.String("k1", keyValue)}, Time: now},
|
||||||
|
|
@ -266,6 +268,7 @@ func Test_spanDataToThrift(t *testing.T) {
|
||||||
Tags: []*gen.Tag{
|
Tags: []*gen.Tag{
|
||||||
{Key: "double", VType: gen.TagType_DOUBLE, VDouble: &doubleValue},
|
{Key: "double", VType: gen.TagType_DOUBLE, VDouble: &doubleValue},
|
||||||
{Key: "key", VType: gen.TagType_STRING, VStr: &keyValue},
|
{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: "error", VType: gen.TagType_BOOL, VBool: &boolTrue},
|
||||||
{Key: "status.code", VType: gen.TagType_LONG, VLong: &statusCodeValue},
|
{Key: "status.code", VType: gen.TagType_LONG, VLong: &statusCodeValue},
|
||||||
{Key: "status.message", VType: gen.TagType_STRING, VStr: &statusMessage},
|
{Key: "status.message", VType: gen.TagType_STRING, VStr: &statusMessage},
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue