I know. The method I intercept is Dispatcher.dispatch. And In the org.apache.skywalking.apm.plugin.mrd.DispatcherInterceptor#beforeMethod There is some code " FullHttpResponse response = simpleHttpResponse.getHttpResponse();" The getHttpResponse method has different returnType in different version.
在 2020/12/29 上午11:34,“Sheng Wu”<[email protected]> 写入: Hi Do you know the instrumentation#InstanceMethodsInterceptPoint could add `ReturnType` as a match condition? Sheng Wu 吴晟 Twitter, wusheng1108 Li BingLong(智能平台) <[email protected]> 于2020年12月29日周二 上午11:32写道: > Its not the method intercepted throw error. > For example, in the following code, simpleHttpResponse.getHttpResponse() > throws error because different version has different returnType. > > @Override > public Object afterMethod(EnhancedInstance objInst, Method method, > Object[] allArguments, Class<?>[] argumentsTypes, > Object ret) throws Throwable { > > SimpleHttpResponse simpleHttpResponse = (SimpleHttpResponse) > allArguments[1]; > FullHttpResponse response = simpleHttpResponse.getHttpResponse(); > > AbstractSpan span = ContextManager.activeSpan(); > if (response.status().code() >= 400) { > span.errorOccurred(); > Tags.STATUS_CODE.set(span, > Integer.toString(response.status().code())); > } > ContextManager.stopSpan(span); > return ret; > } > > 在 2020/12/28 下午11:16,“Sheng Wu”<[email protected]> 写入: > > You could create this kind of scenario, yes, definitely. > My question is, SkyWalking's agent technology is for resolving tracing > and > metrics collection, which related to RPC related methods mostly, and > only > very few parameter types or methods. > You are keeping changing codes, but not randomly, and if the method is > not > matching for instrumentation declaration, SkyWalking agent core will > automatically ignore it already. > > Why still you are facing `invoke error`? If you define instrumentation > only > by class name and method name, yes, for some internal codes, maybe. > But why > don't you provide more accurate match rules? > > Sheng Wu 吴晟 > Twitter, wusheng1108 > > > Li BingLong(智能平台) <[email protected]> 于2020年12月28日周一 > 下午10:36写道: > > > It is a real case in our inner project "http-server" which is build > using > > netty. > > Usually we add one or more class to add a new future.Then update the > > version, Gray released. > > > > Recently, I resolve the netty conflict using maven shade plugin and > update > > the version.All version not equal to the target version will using > > different instrumentation. > > I think this logic is very difficult to express by the witness class. > > > > On the other hand, If people have to use the Uranus project to find a > > witness, It's a little more expensive to resolve the problem. > > Think about this: If I have a runtime method invoke error,Why should > I use > > a witness class to resolve it? > > > > > > 在 2020/12/28 下午8:18,“Sheng Wu”<[email protected]> 写入: > > > > Hi > > > > I am not sure whether this is a real case. Is there really > existing > > case 2 > > versions including 100% the same codes? > > There is a project created by the community called, uranus, > which you > > could > > find on the website. > > https://skywalking.apache.org/docs/ > > > > This is a tool to help on locating witness class. > > > > Sheng Wu 吴晟 > > Twitter, wusheng1108 > > > > > > Li BingLong(智能平台) <[email protected]> 于2020年12月28日周一 > > 下午7:33写道: > > > > > Sometimes its too difficult to find a witness class. > > > Maybe the version 2 has all class in version 1.How can I > define a > > > instrumentation if I want the version 1 to be instrument? > > > In my opinion,we usually want to instrument a specified > method. If we > > > dont have other ways,some code about a method may be a good > “witness > > > code”other than witness class. > > > > > > > > >
