我将jaeger全部安装在Docker中,其中包括:
docker run --rm --name jaeger -p 5775:5775/udp -p 6831:6831/udp -p 6832:6832/udp -p 5778:5778 -p 16686:16686 -p 14267:14267 -p 14268:14268 -p 9411:9411 jaegertracing/all-in-one:1.7 下面是我如何初始化跟踪器和跨范围的示例代码。我在我的控制台中得到了日志,但它没有反映在我的Jaeger UI中。
有人能帮我吗?
logging = new LoggingReporter();
SamplerConfiguration sampler = new SamplerConfiguration();
sampler.withType("const");
sampler.withParam(1);
ReporterConfiguration reporter = new ReporterConfiguration();
reporter.withLogSpans(true);
reporter.withSender(sender);
tracer = Configuration.fromEnv("sample_jaeger").withSampler(sampler).withReporter(reporter).getTracer();
Scope scope = tracer.buildSpan("parent-span").startActive(true);
Tags.SAMPLING_PRIORITY.set(scope.span(), 1);
scope.span().setTag("this-is-test", "YUP");
logging.report((JaegerSpan) scope.span());发布于 2018-10-19 14:34:17
你要关闭追踪器和瞄准镜吗?如果您正在使用0.32.0之前的版本,则应该在进程终止之前手动调用tracer.close(),否则缓冲区中的跨度可能不会被分派。
至于作用域,常见的做法是将其包装在一个try-语句中:
try (Scope scope = tracer.buildSpan("parent-span").startActive(true)) {
Tags.SAMPLING_PRIORITY.set(scope.span(), 1);
scope.span().setTag("this-is-test", "YUP");
logging.report((JaegerSpan) scope.span());
}您还可以在https://github.com/yurishkuro/opentracing-tutorial上查看https://github.com/yurishkuro/opentracing-tutorial教程,或者在https://www.katacoda.com/courses/opentracing上查看基于Katacoda的版本。
--编辑
并部署在不同的主机名和端口上。
那你就得告诉追踪者把痕迹发到哪去了。或者导出指向收集器端点的JAEGER_ENDPOINT环境变量,或者设置带有代理位置的JAEGER_AGENT_HOST/JAEGER_AGENT_PORT。您可以在以下网址上检查客户端的可用环境变量:https://www.jaegertracing.io/docs/1.7/client-features/
https://stackoverflow.com/questions/52886127
复制相似问题