wu-sheng commented on a change in pull request #5348:
URL: https://github.com/apache/skywalking/pull/5348#discussion_r473474208
##########
File path:
apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-commons/src/main/java/org/apache/skywalking/apm/plugin/spring/mvc/commons/interceptor/AbstractMethodInterceptor.java
##########
@@ -208,4 +218,32 @@ private void collectHttpParam(HttpServletRequest request,
AbstractSpan span) {
Tags.HTTP.PARAMS.set(span, tagValue);
}
}
+
+ private boolean shouldCollectHeader() {
+ List<String> includeHeaders =
SpringMVCPluginConfig.Plugin.Http.INCLUDE_HTTP_HEADERS;
+ return !CollectionUtil.isEmpty(includeHeaders) ;
+ }
+
+ private void collectHttpHeaders(HttpServletRequest request, AbstractSpan
span) {
+ final Enumeration<String> headerNames = request.getHeaderNames();
+ if (headerNames == null) {
+ return;
+ }
+ final List<String> headersList = new LinkedList<>();
+
SpringMVCPluginConfig.Plugin.Http.INCLUDE_HTTP_HEADERS.stream().filter(headerName
-> request.getHeaders(headerName) != null).forEach(headerName -> {
+ Enumeration<String> headerValues = request.getHeaders(headerName);
+ List<String> valueList = Collections.list(headerValues);
+ if (!CollectionUtil.isEmpty(valueList)) {
+ String headerValue = valueList.toString();
+ headersList.add(headerName + "=" + headerValue);
+ }
+ });
+
+ if (!headersList.isEmpty()) {
+ String tagValue =
headersList.stream().collect(Collectors.joining("\n"));
+ tagValue =
SpringMVCPluginConfig.Plugin.Http.HTTP_HEADERS_LENGTH_THRESHOLD > 0 ?
Review comment:
According to your comments, `use negative values to keep and send the
complete headers.`, where is the logic of that? Please consider to correct the
comments or logic :) They should be matched.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]