-
Notifications
You must be signed in to change notification settings - Fork 720
Description
Issue Description
The Brave library has compatibility issues with Spring Boot 4 (which uses Spring Framework 6.2+). Specifically, the brave.spring.web.TracingClientHttpRequestInterceptor class uses deprecated/removed APIs that no longer exist in the latest Spring Framework versions.
Environment
- Brave version:
brave-instrumentation-spring-web:6.3.0(and potentially other recent versions) - Spring Boot version: 4.x
- Spring Framework version: 6.2.x
- Java version: [Your Java version]
Problem Details
1. Missing getRawStatusCode() method
The ClientHttpResponse interface in Spring Framework 6.2+ no longer includes the getRawStatusCode() method.
Current code in TracingClientHttpRequestInterceptor.java (line 129):
int result = response != null ? response.getRawStatusCode() : 0;Issue: The ClientHttpResponse interface now only provides:
HttpStatusCode getStatusCode()- returns anHttpStatusCodeobject instead of a raw intString getStatusText()
Reference: [Spring Framework ClientHttpResponse interface](https://github.com/spring-projects/spring-framework/blob/main/spring-web/src/main/java/org/springframework/http/client/ClientHttpResponse.java)
2. Type compatibility issues with request wrapper
There appear to be additional type incompatibilities with the HttpRequestWrapper class used in the interceptor, though the specific details need further investigation.
Expected Behavior
The Brave instrumentation should work seamlessly with Spring Boot 4 / Spring Framework 6.2+ without compilation errors.
Proposed Solution
Update the TracingClientHttpRequestInterceptor class to use the new Spring Framework 6.2+ APIs:
// Instead of:
int result = response != null ? response.getRawStatusCode() : 0;
// Use:
int result = response != null ? response.getStatusCode().value() : 0;Steps to Reproduce
- Create a Spring Boot 4 project with the following dependency:
<dependency>
<groupId>io.zipkin.brave</groupId>
<artifactId>brave-instrumentation-spring-web</artifactId>
<version>6.3.0</version>
</dependency>- Try to compile the project
- Observe compilation errors related to missing methods
Additional Context
This issue affects anyone trying to upgrade to Spring Boot 4 while using Brave for distributed tracing. The changes in Spring Framework 6.2 removed several deprecated methods, requiring updates to third-party libraries.
Related Issues
- Spring Framework migration guide: [Spring Framework 6.2 What's New](https://github.com/spring-projects/spring-framework/wiki/What's-New-in-Spring-Framework-6.x#whats-new-in-version-62)