You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by GitBox <gi...@apache.org> on 2020/12/06 14:48:50 UTC

[GitHub] [skywalking] haoyann commented on a change in pull request #5960: fix springmvc reactive api can't collect HTTP statusCode

haoyann commented on a change in pull request #5960:
URL: https://github.com/apache/skywalking/pull/5960#discussion_r537053445



##########
File path: apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-5.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/mvc/v5/InvokeInterceptor.java
##########
@@ -41,6 +52,23 @@ public void beforeMethod(final EnhancedInstance objInst,
                       .put(RESPONSE_KEY_IN_RUNTIME_CONTEXT, new ReactiveResponseHolder(exchange.getResponse()));
         ContextManager.getRuntimeContext()
                       .put(REQUEST_KEY_IN_RUNTIME_CONTEXT, new ReactiveRequestHolder(exchange.getRequest()));
+
+        ContextCarrier carrier = new ContextCarrier();
+        CarrierItem next = carrier.items();
+        HttpHeaders headers = exchange.getRequest().getHeaders();
+        while (next.hasNext()) {
+            next = next.next();
+            List<String> header = headers.get(next.getHeadKey());
+            if (header != null && header.size() > 0) {
+                next.setHeadValue(header.get(0));
+            }
+        }
+
+        AbstractSpan span = ContextManager.createEntrySpan(exchange.getRequest().getURI().getPath(), carrier);

Review comment:
       beacuse spring webflux chang httpCode after org.apache.skywalking.apm.plugin.spring.mvc.commons.interceptor.AbstractMethodInterceptor, so need create new span to collect httpCode.




----------------------------------------------------------------
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:
users@infra.apache.org