Skip to content

Commit

Permalink
send shared zipkin spans by default
Browse files Browse the repository at this point in the history
  • Loading branch information
bergquist committed Jun 5, 2019
1 parent 243875a commit 9eb9d79
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
7 changes: 3 additions & 4 deletions conf/defaults.ini
Original file line number Diff line number Diff line change
Expand Up @@ -552,10 +552,9 @@ sampler_type = const
sampler_param = 1
# Whether or not to use Zipkin span propagation (x-b3- HTTP headers).
zipkin_propagation = false
# If zipkin propagation is enabled, whether or not to use shared RPC spans.
# Setting this to true is the most common setting when using Zipkin elsewhere in
# your infrastructure.
shared_zipkin_spans = false
# Setting this to true disable zipkin propagation.
# Not disabling is the most common setting when using Zipkin elsewhere in your infrastructure.
disable_shared_zipkin_spans = false

#################################### External Image Storage ##############
[external_image_storage]
Expand Down
27 changes: 14 additions & 13 deletions pkg/infra/tracing/tracing.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ func init() {
}

type TracingService struct {
enabled bool
address string
customTags map[string]string
samplerType string
samplerParam float64
log log.Logger
closer io.Closer
useZipkinPropagation bool
useSharedZipkinSpans bool
enabled bool
address string
customTags map[string]string
samplerType string
samplerParam float64
log log.Logger
closer io.Closer
zipkinPropagation bool
disableSharedZipkinSpans bool

Cfg *setting.Cfg `inject:""`
}
Expand Down Expand Up @@ -58,8 +58,8 @@ func (ts *TracingService) parseSettings() {
ts.customTags = splitTagSettings(section.Key("always_included_tag").MustString(""))
ts.samplerType = section.Key("sampler_type").MustString("")
ts.samplerParam = section.Key("sampler_param").MustFloat64(1)
ts.useZipkinPropagation = section.Key("zipkin_propagation").MustBool(false)
ts.useSharedZipkinSpans = section.Key("shared_zipkin_spans").MustBool(false)
ts.zipkinPropagation = section.Key("zipkin_propagation").MustBool(false)
ts.disableSharedZipkinSpans = section.Key("disable_shared_zipkin_spans").MustBool(false)
}

func (ts *TracingService) initGlobalTracer() error {
Expand All @@ -85,13 +85,14 @@ func (ts *TracingService) initGlobalTracer() error {
options = append(options, jaegercfg.Tag(tag, value))
}

if ts.useZipkinPropagation {
if ts.zipkinPropagation {
zipkinPropagator := zipkin.NewZipkinB3HTTPHeaderPropagator()
options = append(options,
jaegercfg.Injector(opentracing.HTTPHeaders, zipkinPropagator),
jaegercfg.Extractor(opentracing.HTTPHeaders, zipkinPropagator),
)
if ts.useSharedZipkinSpans {

if !ts.disableSharedZipkinSpans {
options = append(options, jaegercfg.ZipkinSharedRPCSpan(true))
}
}
Expand Down

0 comments on commit 9eb9d79

Please sign in to comment.