opentelemetry-java-instrumentation
opentelemetry-java-instrumentation copied to clipboard
Add http.route to HTTP client requests and extract from Spring WebClient
Adds the semantic attribute http.route to the list of attributes supported by HTTP client requests, indicating a templated URI used when making the HTTP request as supported by the client framework.
Adds support for extracting that templated URI from the ClientRequest attributes when using Spring WebClient. This is based on the Spring actuator implementation for Spring Boot 2.x that extracts the URI template and formats it for the purposes of reporting to Micrometer:
https://github.com/spring-projects/spring-boot/blob/2.7.x/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/reactive/client/WebClientExchangeTags.java#L68
This implementation returns null if the attribute is not found to avoid reporting raw URIs.