gRPC migration update
Change-Id: Icdd1a824948fa994cd36bd121c962f5ecf74e3cf
diff --git a/vendor/github.com/uber/jaeger-client-go/tracer.go b/vendor/github.com/uber/jaeger-client-go/tracer.go
index 8a3fc97..9a627be 100644
--- a/vendor/github.com/uber/jaeger-client-go/tracer.go
+++ b/vendor/github.com/uber/jaeger-client-go/tracer.go
@@ -216,10 +216,10 @@
options.StartTime = t.timeNow()
}
- // Predicate whether the given span context is a valid reference
- // which may be used as parent / debug ID / baggage items source
- isValidReference := func(ctx SpanContext) bool {
- return ctx.IsValid() || ctx.isDebugIDContainerOnly() || len(ctx.baggage) != 0
+ // Predicate whether the given span context is an empty reference
+ // or may be used as parent / debug ID / baggage items source
+ isEmptyReference := func(ctx SpanContext) bool {
+ return !ctx.IsValid() && !ctx.isDebugIDContainerOnly() && len(ctx.baggage) == 0
}
var references []Reference
@@ -235,7 +235,7 @@
reflect.ValueOf(ref.ReferencedContext)))
continue
}
- if !isValidReference(ctxRef) {
+ if isEmptyReference(ctxRef) {
continue
}
@@ -245,14 +245,17 @@
continue
}
- references = append(references, Reference{Type: ref.Type, Context: ctxRef})
+ if ctxRef.IsValid() {
+ // we don't want empty context that contains only debug-id or baggage
+ references = append(references, Reference{Type: ref.Type, Context: ctxRef})
+ }
if !hasParent {
parent = ctxRef
hasParent = ref.Type == opentracing.ChildOfRef
}
}
- if !hasParent && isValidReference(parent) {
+ if !hasParent && !isEmptyReference(parent) {
// If ChildOfRef wasn't found but a FollowFromRef exists, use the context from
// the FollowFromRef as the parent
hasParent = true
@@ -317,7 +320,7 @@
sp.references = references
sp.firstInProcess = rpcServer || sp.context.parentID == 0
- if !sp.isSamplingFinalized() {
+ if !sp.context.isSamplingFinalized() {
decision := t.sampler.OnCreateSpan(sp)
sp.applySamplingDecision(decision, false)
}
@@ -410,7 +413,7 @@
// calling client-side span, but obviously the server side span is
// no longer a root span of the trace.
func (t *Tracer) emitNewSpanMetrics(sp *Span, newTrace bool) {
- if !sp.isSamplingFinalized() {
+ if !sp.context.isSamplingFinalized() {
t.metrics.SpansStartedDelayedSampling.Inc(1)
if newTrace {
t.metrics.TracesStartedDelayedSampling.Inc(1)
@@ -434,9 +437,11 @@
}
func (t *Tracer) reportSpan(sp *Span) {
- if !sp.isSamplingFinalized() {
+ ctx := sp.SpanContext()
+
+ if !ctx.isSamplingFinalized() {
t.metrics.SpansFinishedDelayedSampling.Inc(1)
- } else if sp.context.IsSampled() {
+ } else if ctx.IsSampled() {
t.metrics.SpansFinishedSampled.Inc(1)
} else {
t.metrics.SpansFinishedNotSampled.Inc(1)
@@ -445,7 +450,7 @@
// Note: if the reporter is processing Span asynchronously then it needs to Retain() the span,
// and then Release() it when no longer needed.
// Otherwise, the span may be reused for another trace and its data may be overwritten.
- if sp.context.IsSampled() {
+ if ctx.IsSampled() {
t.reporter.Report(sp)
}