Add Tracing Header Context Name option for Jaeger
This commit is contained in:
parent
f0ee2890b2
commit
156f6b8d3c
17 changed files with 327 additions and 49 deletions
18
vendor/github.com/uber/jaeger-client-go/jaeger_thrift_span.go
generated
vendored
18
vendor/github.com/uber/jaeger-client-go/jaeger_thrift_span.go
generated
vendored
|
@ -38,7 +38,7 @@ func BuildJaegerThrift(span *Span) *j.Span {
|
|||
Flags: int32(span.context.flags),
|
||||
StartTime: startTime,
|
||||
Duration: duration,
|
||||
Tags: buildTags(span.tags),
|
||||
Tags: buildTags(span.tags, span.tracer.options.maxTagValueLength),
|
||||
Logs: buildLogs(span.logs),
|
||||
References: buildReferences(span.references),
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ func BuildJaegerProcessThrift(span *Span) *j.Process {
|
|||
func buildJaegerProcessThrift(tracer *Tracer) *j.Process {
|
||||
process := &j.Process{
|
||||
ServiceName: tracer.serviceName,
|
||||
Tags: buildTags(tracer.tags),
|
||||
Tags: buildTags(tracer.tags, tracer.options.maxTagValueLength),
|
||||
}
|
||||
if tracer.process.UUID != "" {
|
||||
process.Tags = append(process.Tags, &j.Tag{Key: TracerUUIDTagKey, VStr: &tracer.process.UUID, VType: j.TagType_STRING})
|
||||
|
@ -63,10 +63,10 @@ func buildJaegerProcessThrift(tracer *Tracer) *j.Process {
|
|||
return process
|
||||
}
|
||||
|
||||
func buildTags(tags []Tag) []*j.Tag {
|
||||
func buildTags(tags []Tag, maxTagValueLength int) []*j.Tag {
|
||||
jTags := make([]*j.Tag, 0, len(tags))
|
||||
for _, tag := range tags {
|
||||
jTag := buildTag(&tag)
|
||||
jTag := buildTag(&tag, maxTagValueLength)
|
||||
jTags = append(jTags, jTag)
|
||||
}
|
||||
return jTags
|
||||
|
@ -84,16 +84,16 @@ func buildLogs(logs []opentracing.LogRecord) []*j.Log {
|
|||
return jLogs
|
||||
}
|
||||
|
||||
func buildTag(tag *Tag) *j.Tag {
|
||||
func buildTag(tag *Tag, maxTagValueLength int) *j.Tag {
|
||||
jTag := &j.Tag{Key: tag.key}
|
||||
switch value := tag.value.(type) {
|
||||
case string:
|
||||
vStr := truncateString(value)
|
||||
vStr := truncateString(value, maxTagValueLength)
|
||||
jTag.VStr = &vStr
|
||||
jTag.VType = j.TagType_STRING
|
||||
case []byte:
|
||||
if len(value) > maxAnnotationLength {
|
||||
value = value[:maxAnnotationLength]
|
||||
if len(value) > maxTagValueLength {
|
||||
value = value[:maxTagValueLength]
|
||||
}
|
||||
jTag.VBinary = value
|
||||
jTag.VType = j.TagType_BINARY
|
||||
|
@ -150,7 +150,7 @@ func buildTag(tag *Tag) *j.Tag {
|
|||
jTag.VBool = &vBool
|
||||
jTag.VType = j.TagType_BOOL
|
||||
default:
|
||||
vStr := truncateString(stringify(value))
|
||||
vStr := truncateString(stringify(value), maxTagValueLength)
|
||||
jTag.VStr = &vStr
|
||||
jTag.VType = j.TagType_STRING
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue