Jaeger 中未显示 Jaeger 服务 UI

Jaeger Service not shown in Jaeger UI

我在 Docker 中安装了 jaeger:

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());

您要关闭示踪剂和瞄准镜吗?如果您使用的是 0.32.0 之前的版本,您应该在进程终止之前手动调用 tracer.close(),否则缓冲区中的跨度可能不会被调度。

至于范围,通常将其包装在 try-with-resources 语句中:

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 or the Katacoda-based version at https://www.katacoda.com/courses/opentracing

查看 OpenTracing 教程

-- 编辑

and is deployed on a different hostname and port

然后你需要告诉跟踪器将跟踪发送到哪里。要么导出 JAEGER_ENDPOINT 环境变量,指向收集器端点,要么设置 JAEGER_AGENT_HOST/JAEGER_AGENT_PORT,其中包含代理的位置。您可以在以下 URL 上检查您的客户端可用的环境变量:https://www.jaegertracing.io/docs/1.7/client-features/