我希望使用Zipkin配置我的Opentracing。我正在通过以下链接进行此jaeger-client配置:https://github.com/jaegertracing/jaeger-client-go/blob/master/zipkin/README.md#NewZipkinB3HTTPHeaderPropagator。
我有以下代码,但JaegerUI中没有显示我的报告。以下是我在go中的配置:
func initJaegerZipkin(service string) (opentracing.Tracer, io.Closer) {
cfg, err := jconfig.FromEnv()
if err != nil {
log.Error("cannot parse Jaeger env vars")
}
zipkinPropagator := zipkin.NewZipkinB3HTTPHeaderPropagator()
injector := jaeger.TracerOptions.Injector(opentracing.HTTPHeaders, zipkinPropagator)
extractor := jaeger.TracerOptions.Extractor(opentracing.HTTPHeaders, zipkinPropagator)
// Zipkin shares span ID between client and server spans; it must be enabled via the following option.
zipkinSharedRPCSpan := jaeger.TracerOptions.ZipkinSharedRPCSpan(true)
cfg.ServiceName = service
cfg.Sampler.Type = jaeger.SamplerTypeConst
cfg.Sampler.Param = 1
cfg.Reporter.LogSpans = true
//add
jLogger := jaegerlog.StdLogger
//jMetricsFactory := metrics.NullFactory
sampler := jaeger.NewConstSampler(true)
reporter := jaeger.NewLoggingReporter(jLogger) //NewNullReporter()
tracer, closer := jaeger.NewTracer(
"myService",
sampler, // as usual
reporter, // as usual
injector,
extractor,
zipkinSharedRPCSpan,
)
// Set the singleton opentracing.Tracer with the Jaeger tracer.
opentracing.SetGlobalTracer(tracer)
return tracer, closer
}
我的docker-compose文件具有jaeger docker镜像,如下所示:
jaeger:
image: jaegertracing/all-in-one:latest
environment:
- COLLECTOR_ZIPKIN_HTTP_PORT=9411
ports:
- '6831:6831/udp'
- '16686:16686'
- '6832:6832/udp'
- '5778:5778'
- '14268:14268'
- '9411:9411'
zipkin报告是否应该显示在另一个应用程序中?我想念什么?。
谢谢