Skywalking: The webflux-plugin is not working properly

Created on 8 Nov 2019  ·  5Comments  ·  Source: apache/skywalking

Please answer these questions before submitting your issue.

  • Why do you submit this issue?
  • [ ] Question or discussion
  • [X] Bug
  • [ ] Requirement
  • [ ] Feature or performance improvement

Question

  • What do you want to know?
    The webflux-plugin is not working properly
    because WebFlux is Reactive Programming ,plugin use ThreadLocal is not working properly

webflux-plugin 并不能正常工作,因为 WebFlux 是响应式编程。 处理的线程会发生变化,插件内部使用ThreadLocal 根本不能获取到原来线程的信息,还会因为未能正确关闭span信息 导致ThreadLocal一直没有释放


Bug

  • What happen?
    this is debug msg:
    image
    image
    image
    webflux-plugins Intercept 3 method ,the thread has changed when the method is executed

Requirement or improvement

  • Need to deal with it without relying on ThreadLocal
agent bug plugin

Most helpful comment

I have a idea, can use Mono doFinally method , and put TraceContext into SkyWalkingDynamicField of ServerWebExchange . collect the span when the Mono ends.
I have implemented it in a test environment and it works fine.
I can submit new PR to fix

All 5 comments

@cyejing You could check the test at https://github.com/apache/skywalking/tree/master/test/plugin/scenarios/webflux-scenario, and get the idea what is the difference.

@zhaoyuguang Maybe we just support part of it. I remember we just support webflux + Spring MVC, rather than real Reactive framework. You know better than me.

Indeed, as @cyejing said, The webflux plugin doesn't perform well after using reactive improvements, I am thinking about whether there is a better solution, such as webflux agent implementation similar to webflux interceptor, Can add a help wanted tag to see if there is any webflux expert to give some advising?

I have a idea, can use Mono doFinally method , and put TraceContext into SkyWalkingDynamicField of ServerWebExchange . collect the span when the Mono ends.
I have implemented it in a test environment and it works fine.
I can submit new PR to fix

I have a problem. method of Mono doFinally parameter is Consumer , this is java8 api java.util.function.Consumer . but agent pom set <compiler.version>1.6</compiler.version> .
Is there any good way?

You could add an optional plugin, which could use the jdk8 compile level.

Was this page helpful?
0 / 5 - 0 ratings