PatPanda
PatPanda

Reputation: 5070

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

Upvotes: 0

Views: 537

Answers (1)

Nahuel Giani
Nahuel Giani

Reputation: 570

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

}

Upvotes: 0

Related Questions