我在 Azure Kubernetes 集群中的监控命名空间中设置了 Jaeger,并部署了我的容器,该容器在监控域中使用 jaeger 客户端库进行了检测。该服务已启动并正在运行,当我在浏览器中指定 :/actuator 时,我可以使用执行器查看跟踪。但是 Jaeger UI 的服务下拉列表中没有填充相同的微服务。
以下是我正在使用的文件。
DemoOpentracingApplication.java
@SpringBootApplication
public class DemoOpentracingApplication {
@Bean
public RestTemplate restTemplate(RestTemplateBuilder restTemplateBuilder) {
return restTemplateBuilder.build();
}
@Bean
public io.opentracing.Tracer jaegerTracer() {
return new Configuration("spribng-boot", new Configuration.SamplerConfiguration(ProbabilisticSampler.TYPE, 1),
new Configuration.ReporterConfiguration()).getTracer();
}
public static void main(String[] args) {
SpringApplication.run(DemoOpentracingApplication.class, args);
}
}
HelloController.java
@RestController
public class HelloController {
@Autowired
private RestTemplate restTemplate;
//private final Counter totalRequests= Counter.build().name("requests_total").help("Total Number of Requests").register();
@Timed(
value= "prometheus.hello.request",
histogram=true,
percentiles= {0.95,0.99},
extraTags= {"version","1.0"}
)
@RequestMapping("/hello")
public String hello() {
return ("Hello From OPenTracing Controller");
}
@Timed(
value= "prometheus.chain.request",
histogram=true,
percentiles= {0.95,0.99},
extraTags= {"version","1.0"}
)
@RequestMapping("/chaining")
public String chaining() {
ResponseEntity<String> response = restTemplate.getForEntity("http://localhost:8080/hello",String.class);
return "Chaining+" + response.getBody();
}
}
POM.xml
.....
<dependency>
<groupId>io.opentracing.contrib</groupId>
<artifactId>opentracing-spring-web-autoconfigure</artifactId>
<version>0.0.4</version>
</dependency>
....
为什么检测服务没有填充到 Kubernetes 的 Jaeger UI 中?