xuanyu66 commented on issue #6105:
URL: https://github.com/apache/skywalking/issues/6105#issuecomment-752920565
> > My suggestion would be disable the `sampling` mechanism to stop creating
the TracingContext. What do you think?
>
> This is a good way, our customized version provides another way, support
dynamic close all plugins, but dynamic switches can only be applied to a
limited number of plugins. like is,
>
> ```
> public Object intercept(@This Object obj, @AllArguments Object[]
allArguments, @SuperCall Callable<?> zuper,
> @Origin Method method) throws Throwable {
>
> if (!DynamicPluginService.shouldTrace(targetClassName)) {
> return zuper.call();
> }
>
> EnhancedInstance targetObject = (EnhancedInstance) obj;
>
> MethodInterceptResult result = new MethodInterceptResult();
> try {
> interceptor.beforeMethod(targetObject, method, allArguments,
method.getParameterTypes(), result);
> } catch (Throwable t) {
> logger.error(t, "class[{}] before method[{}] intercept
failure", obj.getClass(), method.getName());
> }
>
> Object ret = null;
> try {
> if (!result.isContinue()) {
> ret = result._ret();
> } else {
> ret = zuper.call();
> }
> } catch (Throwable t) {
> try {
> interceptor.handleMethodException(targetObject, method,
allArguments, method.getParameterTypes(), t);
> } catch (Throwable t2) {
> logger.error(t2, "class[{}] handle method[{}] exception
failure", obj.getClass(), method.getName());
> }
> throw t;
> } finally {
> try {
> ret = interceptor.afterMethod(targetObject, method,
allArguments, method.getParameterTypes(), ret);
> } catch (Throwable t) {
> logger.error(t, "class[{}] after method[{}] intercept
failure", obj.getClass(), method.getName());
> }
> }
> return ret;
> }
> ```
Thanks for suggestion.
----------------------------------------------------------------
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]