简体   繁体   中英

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.

I am referring to tracing, as in traceId, spanId and parentId please.

Currently, actuator can expose endpoints like /metrics or /prometheus for metrics (which are not traces).

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.

Some similar construct for /trace /tracing to expose open telemetry, open tracing information can be equality as interesting in my opinion.

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.

However, the /httptrace endpoint information is not related at all to traces (as in 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

Basically as a workaround, add this configuration to the Spring environment:

management.endpoints.web.exposure.include: httptrace

and provide an HttpTraceRepository bean like this:

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

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

}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM