Merge pull request #470 from ascrutae/fix/spring-annotation-issue

fix the operation name of spring mvc span is incorrect
This commit is contained in:
吴晟 Wu Sheng 2017-09-27 16:13:57 +08:00 committed by GitHub
commit e51abb3018
1 changed files with 5 additions and 1 deletions

View File

@ -24,7 +24,11 @@ public class ControllerConstructorInterceptor implements InstanceConstructorInte
String basePath = "";
RequestMapping basePathRequestMapping = objInst.getClass().getAnnotation(RequestMapping.class);
if (basePathRequestMapping != null) {
basePath = basePathRequestMapping.value()[0];
if (basePathRequestMapping.value().length > 0) {
basePath = basePathRequestMapping.value()[0];
} else if (basePathRequestMapping.path().length > 0) {
basePath = basePathRequestMapping.path()[0];
}
}
PathMappingCache pathMappingCache = new PathMappingCache(basePath);
objInst.setSkyWalkingDynamicField(pathMappingCache);