-
Notifications
You must be signed in to change notification settings - Fork 379
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
support reactor #228
support reactor #228
Conversation
2. add sofa examples webflux
2. add flux test case and fix bug with flux operation
2. support spring webflux via spring aop
|
||
<dependency> | ||
<groupId>com.alipay.sofa</groupId> | ||
<artifactId>sofa-tracer-springmvc-plugin</artifactId> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里感觉不用依赖 springmvc 的插件,部分重复代码冗余一份,既然分开两个插件,就应该相互独立开
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
复用度很高, 抽取一个sofa-tracer-web-base-plugin ?
...lux-plugin/src/main/java/com/alipay/sofa/tracer/plugins/webflux/WebfluxSofaTracerFilter.java
Show resolved
Hide resolved
...r-core/src/main/java/com/alipay/common/tracer/core/reactor/SofaTracerReactorTransformer.java
Outdated
Show resolved
Hide resolved
tracer-core/src/main/java/com/alipay/common/tracer/core/reactor/SofaTracerSpanContainer.java
Outdated
Show resolved
Hide resolved
tracer-core/src/test/java/com/alipay/common/tracer/core/reactor/base/ReactorTracer.java
Show resolved
Hide resolved
tracer-core/src/test/java/com/alipay/common/tracer/core/reactor/base/ReactorTracer.java
Show resolved
Hide resolved
@ConditionalOnMissingBean | ||
static public HookRegisteringBeanDefinitionRegistryPostProcessor hookRegisteringBeanDefinitionRegistryPostProcessor(ConfigurableApplicationContext context) { | ||
return new HookRegisteringBeanDefinitionRegistryPostProcessor(context); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
HookRegisteringBeanDefinitionRegistryPostProcessor 的作用域应该不仅仅是在WebfluxSofaTracerFilterConfiguration 中,应该对于 reactor 组件生效,然后通过例如 com.alipay.sofa.tracer.reactor.enabled 来控制是否启用 reactor 组件的埋点
|
||
import com.alipay.common.tracer.core.reactor.SofaTracerReactorSubscriber; | ||
import org.apache.commons.logging.Log; | ||
import org.apache.commons.logging.LogFactory; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
无用的引入可以移除掉
import org.apache.commons.logging.LogFactory; | ||
import org.reactivestreams.Publisher; | ||
import org.springframework.beans.BeansException; | ||
import org.springframework.beans.factory.BeanFactory; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
移除没有用到的引用
import org.springframework.context.ConfigurableApplicationContext; | ||
import reactor.core.CoreSubscriber; | ||
import reactor.core.Fuseable; | ||
import reactor.core.Scannable; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
同上
import reactor.core.publisher.Hooks; | ||
import reactor.core.publisher.Mono; | ||
import reactor.core.publisher.Operators; | ||
import reactor.util.context.Context; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
同上
import reactor.core.publisher.Operators; | ||
import reactor.util.context.Context; | ||
|
||
import java.util.function.BooleanSupplier; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
同上
Hooks.resetOnEachOperator(SOFA_TRACE_REACTOR_KEY); | ||
} | ||
|
||
private final ConfigurableApplicationContext context; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
context 这里貌似没有什么具体的作用,是否可以考虑移除掉
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.core.Ordered; | ||
import org.springframework.core.annotation.Order; | ||
import org.springframework.web.server.WebFilter; | ||
import reactor.core.publisher.Hooks; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
无用引用
Hi, @shengxiang205 can you split this PR into two smaller PR? One is about the feature, and another is about code format. |
public class SpringWebfluxJsonStatReporter extends SpringWebfluxStatReporter { | ||
|
||
/*** | ||
* 输出拼接器 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
新的代码注释中不要添加中文,建议都以 English
描述
// 这里强制刷一次 | ||
appender.flush(); | ||
} catch (Throwable t) { | ||
SelfLog.error("统计日志<" + statTracerName + ">输出异常", t); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
换为 English 日志输出,还有注释也换为 English 吧。
// 这里强制刷一次 | ||
appender.flush(); | ||
} catch (Throwable t) { | ||
SelfLog.error("统计日志<" + statTracerName + ">输出异常", t); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
English
@@ -29,6 +29,10 @@ | |||
<groupId>com.alipay.sofa</groupId> | |||
<artifactId>sofa-tracer-springmvc-plugin</artifactId> | |||
</dependency> | |||
<dependency> | |||
<groupId>com.alipay.sofa</groupId> | |||
<artifactId>sofa-tracer-webflux-plugin</artifactId> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
另外,sofa-tracer-webflux-plugin
模块下需要补充一个 readme.md
描述对该插件的使用方式,可以参考下其他插件的编写方式哈。 @glmapper 正式发布后,使用文档也记得放到 RELEASE Notes 里面。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
另外,
sofa-tracer-webflux-plugin
模块下需要补充一个readme.md
描述对该插件的使用方式,可以参考下其他插件的编写方式哈。 @glmapper 正式发布后,使用文档也记得放到 RELEASE Notes 里面。
文档部分随着发布报告一起同步,@shengxiang205 可以参考 https://github.com/glmapper/tarcer-test-samples 这个工程将 README 补充下
@@ -43,6 +44,7 @@ | |||
|
|||
/** | |||
* convent sofaTracerSpan model to zipKinSpan model | |||
* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这次怎么这么多代码格式化哈?之前的代码格式化的插件是有什么问题吗?如果有的话,格式化也建议单独一个 PR 哈。
@ujjboy @guanchao-yang all requested changes has been solved |
@shengxiang205 本周计划先发布 2.4.1-SNAPSHOT 版本,这个 PR 你看下还是否有修改或者优化 |
这个 PR 暂时先关闭,历史问题,暂无驱动 |
Motivation:
Modification:
add reactor transaction to keep global sofa tracer span
and keep and restore global sofa tracer span
Result:
Fixes #227