opentelemetry-java-instrumentation icon indicating copy to clipboard operation
opentelemetry-java-instrumentation copied to clipboard

Add http.route to HTTP client requests and extract from Spring WebClient

Open HaloFour opened this issue 1 year ago • 0 comments

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.

HaloFour avatar Feb 10 '24 01:02 HaloFour