[GitHub] candyleer commented on issue #1325: Fix #1280: Modify tomcat interceptor

2018-06-08 Thread GitBox
candyleer commented on issue #1325: Fix #1280: Modify tomcat interceptor
URL: 
https://github.com/apache/incubator-skywalking/pull/1325#issuecomment-395663060
 
 
   good idea
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] candyleer commented on issue #1325: Fix #1280: Modify tomcat interceptor

2018-06-08 Thread GitBox
candyleer commented on issue #1325: Fix #1280: Modify tomcat interceptor
URL: 
https://github.com/apache/incubator-skywalking/pull/1325#issuecomment-395659003
 
 
   in the class 
`org.apache.skywalking.apm.plugin.spring.mvc.commons.interceptor.AbstractMethodInterceptor`
   * if more than one entry span are created in the same thread,entry span will 
be override
   * so in `beforeMethod`,the forward error request will override the request 
which user request.
   so
   ```
@Override
   public void beforeMethod(EnhancedInstance objInst, Method method, 
Object[] allArguments, Class[] argumentsTypes,
   MethodInterceptResult result) throws Throwable {
   
   EnhanceRequireObjectCache pathMappingCache = 
(EnhanceRequireObjectCache)objInst.getSkyWalkingDynamicField();
   String requestURL = pathMappingCache.findPathMapping(method);
   if (requestURL == null) {
   requestURL = getRequestURL(method);
   pathMappingCache.addPathMapping(method, requestURL);
   requestURL = pathMappingCache.findPathMapping(method);
   }
   
   String hystrixIsolateStrategy = 
(String)ContextManager.getRuntimeContext().get(ISOLATE_STRATEGY_KEY_IN_RUNNING_CONTEXT);
   HttpServletRequest request = 
(HttpServletRequest)ContextManager.getRuntimeContext().get(REQUEST_KEY_IN_RUNTIME_CONTEXT);
   
   if (hystrixIsolateStrategy != null) {
   ContextManager.createLocalSpan(requestURL);
   } else if (request != null) {
   ContextCarrier contextCarrier = new ContextCarrier();
   CarrierItem next = contextCarrier.items();
   while (next.hasNext()) {
   next = next.next();
   next.setHeadValue(request.getHeader(next.getHeadKey()));
   }
   
   AbstractSpan span = ContextManager.createEntrySpan(requestURL, 
contextCarrier);
   Tags.URL.set(span, request.getRequestURL().toString());
   Tags.HTTP.METHOD.set(span, request.getMethod());
   span.setComponent(ComponentsDefine.SPRING_MVC_ANNOTATION);
   SpanLayer.asHttp(span);
   }
   }
   ```
   the code in this forward error situation will create two entry span and  
they are in the same thread,so  span and tag info will be overide so the info 
may be not correct.
   eg.
   the operation name is "/hello",but the tag url maybe 
''http://127.0.0.1:8080/error'


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] candyleer commented on issue #1325: Fix #1280: Modify tomcat interceptor

2018-06-08 Thread GitBox
candyleer commented on issue #1325: Fix #1280: Modify tomcat interceptor
URL: 
https://github.com/apache/incubator-skywalking/pull/1325#issuecomment-395659003
 
 
   in the class 
`org.apache.skywalking.apm.plugin.spring.mvc.commons.interceptor.AbstractMethodInterceptor`
   * if more than one entry span are created in the same thread,entry span will 
be override
   * so in `beforeMethod`,the forward error request will override the request 
which user request.
   so
   ```
@Override
   public void beforeMethod(EnhancedInstance objInst, Method method, 
Object[] allArguments, Class[] argumentsTypes,
   MethodInterceptResult result) throws Throwable {
   
   EnhanceRequireObjectCache pathMappingCache = 
(EnhanceRequireObjectCache)objInst.getSkyWalkingDynamicField();
   String requestURL = pathMappingCache.findPathMapping(method);
   if (requestURL == null) {
   requestURL = getRequestURL(method);
   pathMappingCache.addPathMapping(method, requestURL);
   requestURL = pathMappingCache.findPathMapping(method);
   }
   
   String hystrixIsolateStrategy = 
(String)ContextManager.getRuntimeContext().get(ISOLATE_STRATEGY_KEY_IN_RUNNING_CONTEXT);
   HttpServletRequest request = 
(HttpServletRequest)ContextManager.getRuntimeContext().get(REQUEST_KEY_IN_RUNTIME_CONTEXT);
   
   if (hystrixIsolateStrategy != null) {
   ContextManager.createLocalSpan(requestURL);
   } else if (request != null) {
   ContextCarrier contextCarrier = new ContextCarrier();
   CarrierItem next = contextCarrier.items();
   while (next.hasNext()) {
   next = next.next();
   next.setHeadValue(request.getHeader(next.getHeadKey()));
   }
   
   AbstractSpan span = ContextManager.createEntrySpan(requestURL, 
contextCarrier);
   Tags.URL.set(span, request.getRequestURL().toString());
   Tags.HTTP.METHOD.set(span, request.getMethod());
   span.setComponent(ComponentsDefine.SPRING_MVC_ANNOTATION);
   SpanLayer.asHttp(span);
   }
   }
   ```
   the code in this forward error situation will create two entry span and  
they are in the same thread,so  span and tag info will be overide so the info 
may be not correct


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] candyleer commented on issue #1325: Fix #1280: Modify tomcat interceptor

2018-06-08 Thread GitBox
candyleer commented on issue #1325: Fix #1280: Modify tomcat interceptor
URL: 
https://github.com/apache/incubator-skywalking/pull/1325#issuecomment-395659003
 
 
   in the class 
`org.apache.skywalking.apm.plugin.spring.mvc.commons.interceptor.AbstractMethodInterceptor`
   * if more than one entry span are created in the same thread,entry span will 
be override
   * so in `beforeMethod`,the forward error request will override the request 
which user request.
   so
   ```
@Override
   public void beforeMethod(EnhancedInstance objInst, Method method, 
Object[] allArguments, Class[] argumentsTypes,
   MethodInterceptResult result) throws Throwable {
   
   EnhanceRequireObjectCache pathMappingCache = 
(EnhanceRequireObjectCache)objInst.getSkyWalkingDynamicField();
   String requestURL = pathMappingCache.findPathMapping(method);
   if (requestURL == null) {
   requestURL = getRequestURL(method);
   pathMappingCache.addPathMapping(method, requestURL);
   requestURL = pathMappingCache.findPathMapping(method);
   }
   
   String hystrixIsolateStrategy = 
(String)ContextManager.getRuntimeContext().get(ISOLATE_STRATEGY_KEY_IN_RUNNING_CONTEXT);
   HttpServletRequest request = 
(HttpServletRequest)ContextManager.getRuntimeContext().get(REQUEST_KEY_IN_RUNTIME_CONTEXT);
   
   if (hystrixIsolateStrategy != null) {
   ContextManager.createLocalSpan(requestURL);
   } else if (request != null) {
   ContextCarrier contextCarrier = new ContextCarrier();
   CarrierItem next = contextCarrier.items();
   while (next.hasNext()) {
   next = next.next();
   next.setHeadValue(request.getHeader(next.getHeadKey()));
   }
   
   AbstractSpan span = ContextManager.createEntrySpan(requestURL, 
contextCarrier);
   Tags.URL.set(span, request.getRequestURL().toString());
   Tags.HTTP.METHOD.set(span, request.getMethod());
   span.setComponent(ComponentsDefine.SPRING_MVC_ANNOTATION);
   SpanLayer.asHttp(span);
   }
   }
   ```
   the code in this forward error situation will create two entry span and  
they are in the same thread,so  span and tag info will be overide so we the 
info may be not correct


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] candyleer commented on issue #1325: Fix #1280: Modify tomcat interceptor

2018-06-08 Thread GitBox
candyleer commented on issue #1325: Fix #1280: Modify tomcat interceptor
URL: 
https://github.com/apache/incubator-skywalking/pull/1325#issuecomment-395659003
 
 
   in the class 
`org.apache.skywalking.apm.plugin.spring.mvc.commons.interceptor.AbstractMethodInterceptor`
   * if more than one entry span are created in the same thread,entry span will 
merge
   * so in `beforeMethod`,the forward error request will override the request 
which user request.
   so
   ```
@Override
   public void beforeMethod(EnhancedInstance objInst, Method method, 
Object[] allArguments, Class[] argumentsTypes,
   MethodInterceptResult result) throws Throwable {
   
   EnhanceRequireObjectCache pathMappingCache = 
(EnhanceRequireObjectCache)objInst.getSkyWalkingDynamicField();
   String requestURL = pathMappingCache.findPathMapping(method);
   if (requestURL == null) {
   requestURL = getRequestURL(method);
   pathMappingCache.addPathMapping(method, requestURL);
   requestURL = pathMappingCache.findPathMapping(method);
   }
   
   String hystrixIsolateStrategy = 
(String)ContextManager.getRuntimeContext().get(ISOLATE_STRATEGY_KEY_IN_RUNNING_CONTEXT);
   HttpServletRequest request = 
(HttpServletRequest)ContextManager.getRuntimeContext().get(REQUEST_KEY_IN_RUNTIME_CONTEXT);
   
   if (hystrixIsolateStrategy != null) {
   ContextManager.createLocalSpan(requestURL);
   } else if (request != null) {
   ContextCarrier contextCarrier = new ContextCarrier();
   CarrierItem next = contextCarrier.items();
   while (next.hasNext()) {
   next = next.next();
   next.setHeadValue(request.getHeader(next.getHeadKey()));
   }
   
   AbstractSpan span = ContextManager.createEntrySpan(requestURL, 
contextCarrier);
   Tags.URL.set(span, request.getRequestURL().toString());
   Tags.HTTP.METHOD.set(span, request.getMethod());
   span.setComponent(ComponentsDefine.SPRING_MVC_ANNOTATION);
   SpanLayer.asHttp(span);
   }
   }
   ```
   the code in this forward error situation will create two entry span and  
they are in the same thread,so  span and tag info will be overide


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] candyleer commented on issue #1325: Fix #1280: Modify tomcat interceptor

2018-06-08 Thread GitBox
candyleer commented on issue #1325: Fix #1280: Modify tomcat interceptor
URL: 
https://github.com/apache/incubator-skywalking/pull/1325#issuecomment-395659003
 
 
   in the class 
`org.apache.skywalking.apm.plugin.spring.mvc.commons.interceptor.AbstractMethodInterceptor`
   * if more than one entry span are created,entry span will merge
   * so in `beforeMethod`,the forward error request will override the request 
which user request.
   so
   ```
@Override
   public void beforeMethod(EnhancedInstance objInst, Method method, 
Object[] allArguments, Class[] argumentsTypes,
   MethodInterceptResult result) throws Throwable {
   
   EnhanceRequireObjectCache pathMappingCache = 
(EnhanceRequireObjectCache)objInst.getSkyWalkingDynamicField();
   String requestURL = pathMappingCache.findPathMapping(method);
   if (requestURL == null) {
   requestURL = getRequestURL(method);
   pathMappingCache.addPathMapping(method, requestURL);
   requestURL = pathMappingCache.findPathMapping(method);
   }
   
   String hystrixIsolateStrategy = 
(String)ContextManager.getRuntimeContext().get(ISOLATE_STRATEGY_KEY_IN_RUNNING_CONTEXT);
   HttpServletRequest request = 
(HttpServletRequest)ContextManager.getRuntimeContext().get(REQUEST_KEY_IN_RUNTIME_CONTEXT);
   
   if (hystrixIsolateStrategy != null) {
   ContextManager.createLocalSpan(requestURL);
   } else if (request != null) {
   ContextCarrier contextCarrier = new ContextCarrier();
   CarrierItem next = contextCarrier.items();
   while (next.hasNext()) {
   next = next.next();
   next.setHeadValue(request.getHeader(next.getHeadKey()));
   }
   
   AbstractSpan span = ContextManager.createEntrySpan(requestURL, 
contextCarrier);
   Tags.URL.set(span, request.getRequestURL().toString());
   Tags.HTTP.METHOD.set(span, request.getMethod());
   span.setComponent(ComponentsDefine.SPRING_MVC_ANNOTATION);
   SpanLayer.asHttp(span);
   }
   }
   ```
   the code in this forward error situation will create two entry span and  
they are in the same thread,so  span and tag info will be overide


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] candyleer commented on issue #1325: Fix #1280: Modify tomcat interceptor

2018-06-08 Thread GitBox
candyleer commented on issue #1325: Fix #1280: Modify tomcat interceptor
URL: 
https://github.com/apache/incubator-skywalking/pull/1325#issuecomment-395658256
 
 
   wait a moment  ,i will show you the reason


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] candyleer commented on issue #1325: Fix #1280: Modify tomcat interceptor

2018-06-08 Thread GitBox
candyleer commented on issue #1325: Fix #1280: Modify tomcat interceptor
URL: 
https://github.com/apache/incubator-skywalking/pull/1325#issuecomment-395657915
 
 
   @ascrutae @wu-sheng I have tried this solution, but this will trigger other 
problem


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services