From b25946e59cdaa54a01781cca2553a60a581773ef Mon Sep 17 00:00:00 2001 From: Tobias Grieger Date: Wed, 28 Oct 2020 13:06:50 +0100 Subject: [PATCH] tracing: improve comment on otSpan Release note: None --- pkg/util/log/BUILD.bazel | 1 + pkg/util/tracing/BUILD.bazel | 1 + pkg/util/tracing/span.go | 11 ++++++++--- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/pkg/util/log/BUILD.bazel b/pkg/util/log/BUILD.bazel index c835d17566da..3fa097003eae 100644 --- a/pkg/util/log/BUILD.bazel +++ b/pkg/util/log/BUILD.bazel @@ -145,6 +145,7 @@ go_test( "//vendor/github.com/kr/pretty", "//vendor/github.com/pmezard/go-difflib/difflib", "//vendor/github.com/stretchr/testify/assert", + "//vendor/github.com/stretchr/testify/require", "//vendor/golang.org/x/net/trace", ] + select({ "@io_bazel_rules_go//go/platform:aix": [ diff --git a/pkg/util/tracing/BUILD.bazel b/pkg/util/tracing/BUILD.bazel index 1e8fca620df2..c181e61562b2 100644 --- a/pkg/util/tracing/BUILD.bazel +++ b/pkg/util/tracing/BUILD.bazel @@ -6,6 +6,7 @@ go_library( "annotate.go", "annotate_nocgo.go", "grpc_interceptor.go", + "recording.go", "shadow.go", "span.go", "tags.go", diff --git a/pkg/util/tracing/span.go b/pkg/util/tracing/span.go index aad1cc2595d0..760b299112f9 100644 --- a/pkg/util/tracing/span.go +++ b/pkg/util/tracing/span.go @@ -145,10 +145,15 @@ func (s *crdbSpan) isRecording() bool { return s != nil && atomic.LoadInt32(&s.recording) != 0 } +// otSpan is a span for an external opentracing compatible tracer +// such as lightstep, zipkin, jaeger, etc. type otSpan struct { - // TODO(tbg): see if we can lose the shadowTr here and rely on shadowSpan.Tracer(). - // Probably not - but worth checking. - // TODO(tbg): consider renaming 'shadow' -> 'ot' or 'external'. + // shadowTr is the shadowTracer this span was created from. We need + // to hold on to it separately because shadowSpan.Tracer() returns + // the wrapper tracer and we lose the ability to find out + // what tracer it is. This is important when deriving children from + // this span, as we want to avoid mixing different tracers, which + // would otherwise be the result of cluster settings changed. shadowTr *shadowTracer shadowSpan opentracing.Span }