ardacuhadaroglu opened a new issue, #13938:
URL: https://github.com/apache/skywalking/issues/13938

   ### Search before asking
   
   - [x] I had searched in the 
[issues](https://github.com/apache/skywalking/issues?q=is%3Aissue) and found no 
similar issues.
   
   
   ### Apache SkyWalking Component
   
   Java Agent (apache/skywalking-java)
   
   ### What happened
   
   When using plugin.http.include_http_headers configuration with a Spring Boot 
3.5.7 application running on embedded Tomcat 10.x (Jakarta EE), the specified 
HTTP headers are never collected or displayed in the trace span tags.
   
   The tomcat-10x-plugin correctly creates the Entry Span and 
plugin.tomcat.collect_http_params=true works as expected (query parameters 
appear in tags). However, plugin.http.include_http_headers has no effect 
regardless of configuration.
   
   Root Cause Analysis:
   
   The AbstractMethodInterceptor.java in the mvc-annotation-commons module 
imports javax.servlet.http.HttpServletRequest:
   
   ```java
   import javax.servlet.http.HttpServletRequest;
   import javax.servlet.http.HttpServletResponse;
   ```
   
   Since Spring Boot 3.x / Spring MVC 6.x uses the jakarta.servlet namespace 
exclusively, the header collection logic that depends on 
javax.servlet.http.HttpServletRequest silently fails at runtime. The 
mvc-annotation-6.x-plugin loads successfully and instruments controller classes 
(no WARN logs), but the shared commons interceptor code that handles 
include_http_headers cannot operate on jakarta.servlet request objects.
   
   Agent configuration used:
   
   ```properties
   
plugin.springmvc.collect_http_params=${SW_PLUGIN_SPRINGMVC_COLLECT_HTTP_PARAMS:true}
   
plugin.tomcat.collect_http_params=${SW_PLUGIN_TOMCAT_COLLECT_HTTP_PARAMS:true}
   
plugin.http.include_http_headers=${SW_PLUGIN_HTTP_INCLUDE_HTTP_HEADERS:Authorization,User-Agent,Content-Type,X-Trace-Id}
   
plugin.http.http_headers_length_threshold=${SW_PLUGIN_HTTP_HTTP_HEADERS_LENGTH_THRESHOLD:2048}
   ```
   
   ### What you expected to happen
   
   When plugin.http.include_http_headers is configured with header names (e.g., 
Authorization,User-Agent,Content-Type,X-Trace-Id), those headers should appear 
as tags (e.g., http.headers) in the Entry Span of the trace when using the 
mvc-annotation-6.x-plugin with a Jakarta EE / Spring Boot 3.x application.
   
   ### How to reproduce
   
   1- Create a Spring Boot 3.5.7 application with a simple REST controller:
   
   ```java
   @RestController
   public class TestController {
       @GetMapping("/test")
       public String test() {
           return "ok";
       }
   }
   ```
   
   2- Download SkyWalking Java Agent 9.6.0.
   3- Copy optional-plugins/apm-springmvc-annotation-6.x-plugin-9.6.0.jar into 
the plugins/ directory.
   
   4- Configure agent.config:
   
   ```properties
   
plugin.springmvc.collect_http_params=${SW_PLUGIN_SPRINGMVC_COLLECT_HTTP_PARAMS:true}
   
plugin.http.include_http_headers=${SW_PLUGIN_HTTP_INCLUDE_HTTP_HEADERS:Authorization,User-Agent,Content-Type}
   
plugin.http.http_headers_length_threshold=${SW_PLUGIN_HTTP_HTTP_HEADERS_LENGTH_THRESHOLD:2048}
   ```
   
   5- Start the application with the agent:
   
   ```bash
   java -javaagent:/path/to/skywalking-agent.jar \
        -Dskywalking.agent.service_name=test-service \
        -jar application.jar
   ```
   
   6- Send a request with headers:
   
   ```bash
   curl "http://localhost:8080/test?testParam=hello"; \
     -H "Authorization: Bearer test-token" \
     -H "Content-Type: application/json" \
     -H "User-Agent: TestAgent/1.0"
   ```
   
   7- Open SkyWalking UI → Trace → click the Entry Span → check Tags section.
   
   Actual result: Only http.params tag is present with testParam=hello. No 
header-related tags appear.
   
   Expected result: An http.headers tag should be present containing the 
specified header values.
   
   ### Anything else
   
   - Agent version: 9.6.0 (build 9.6.0-8c649c4)
   - Java version: 25
   - Spring Boot version: 3.5.7
   - OS: Linux
   
   ### Are you willing to submit a pull request to fix on your own?
   
   - [ ] Yes I am willing to submit a pull request on my own!
   
   ### Code of Conduct
   
   - [x] I agree to follow this project's [Code of 
Conduct](https://www.apache.org/foundation/policies/conduct)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: 
[email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to