简体   繁体   English

Spring 执行器为 traceId spanId 和 parentId 公开 /trace 或 /tracing 端点

[英]Spring Actuator to expose /trace or /tracing endpoint for traceId spanId and parentId

Small question regarding SpringBoot actuator and a possible /trace /tracing endpoint please.关于 SpringBoot 执行器和可能的 /trace /tracing 端点的小问题。

I am referring to tracing, as in traceId, spanId and parentId please.我指的是跟踪,如 traceId、spanId 和 parentId。

Currently, actuator can expose endpoints like /metrics or /prometheus for metrics (which are not traces).目前,执行器可以公开端点,如 /metrics 或 /prometheus 用于度量(不是跟踪)。

While SpringBoot apps can send, "push" those metrics directly to a backend metrics server, a popular construct is to expose the /metrics or /prometheus endpoint, so some sort of "poll" system (similar to prometheus agent, metrics beat) which can periodically call the endpoint so the agent will then send it to the backend metrics server.虽然 SpringBoot 应用程序可以将这些指标直接“推送”到后端指标服务器,但一种流行的结构是公开 /metrics 或 /prometheus 端点,因此某种“轮询”系统(类似于 prometheus 代理,metrics beat)可以定期调用端点,以便代理将其发送到后端指标服务器。

Some similar construct for /trace /tracing to expose open telemetry, open tracing information can be equality as interesting in my opinion. /trace /tracing 的一些类似结构公开了开放遥测,开放跟踪信息在我看来可能同样有趣。

What I tried:我尝试了什么:

I went to expose the /httptrace endpoint from actuator, and added micrometer-tracing to my classpath, hoping trace information would be available.我去公开执行器的 /httptrace 端点,并将 micrometer-tracing 添加到我的类路径中,希望跟踪信息可用。

However, the /httptrace endpoint information is not related at all to traces (as in traceId, spanId parentId).但是,/httptrace 端点信息与跟踪完全无关(如 traceId、spanId parentId)。

Question: what is the equivalent in order for actuator to expose trace, tracing information please?问题:执行器公开跟踪信息的等价物是什么?请问跟踪信息?

Thank you谢谢

I think you can use this: "httptrace" endpoint of Spring Boot Actuator doesn't exist anymore with Spring Boot 2.2.0我想你可以使用这个: Spring Boot Actuator 的“httptrace”端点不再存在于 Spring Boot 2.2.0

Basically as a workaround, add this configuration to the Spring environment:基本上作为解决方法,将此配置添加到 Spring 环境:

management.endpoints.web.exposure.include: httptrace

and provide an HttpTraceRepository bean like this:并像这样提供一个 HttpTraceRepository bean:

@Configuration
// @Profile("actuator-endpoints")
// if you want: register bean only if profile is set
public class HttpTraceActuatorConfiguration {

    @Bean
    public HttpTraceRepository httpTraceRepository() {
        return new InMemoryHttpTraceRepository();
    }

}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何通过勇敢的追踪打印 traceId 和 spanId? - How to print traceId and spanId with brave tracing? 带有 Micrometer Tracing 的 Spring Boot 3 Webflux 应用程序未在控制台日志中显示 traceId 和 spanId - Spring Boot 3 Webflux application with Micrometer Tracing not showing traceId and spanId in the console logs 无法在 Spring Cloud Sleuth 中观察到 TraceId 和 SpanId - Can not observe TraceId & SpanId in Spring Cloud Sleuth 清除/跟踪Spring Boot执行器端点 - Clear /trace Spring Boot actuator endpoint 迁移到 Spring Boot 3 后 TraceId 和 SpanId 不可用 - TraceId and SpanId not available after migrating to Spring Boot 3 Spring Boot 2x执行器http跟踪不跟踪主体 - Spring boot 2x actuator http trace not tracing body 将弹簧执行器的健康端点暴露在不同的地方是好事还是坏事? - Expose spring actuator health endpoint on a different is a good thing or bad thing? Spring sleuth with SpringBoot (log correlation) - Traceid & SpanId 未显示 - Spring sleuth with SpringBoot (log correlation) - Traceid & SpanId Not displayed Spring启动器将跟踪端点信息写入文件 - Spring boot actuator write trace endpoint info into a file Sleuth 不会在 Spring Boot 应用程序中打印 spanId、traceId - Sleuth doesnt print spanId,traceId in spring boot application
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM