fix: 修复Gateway网关使用Webflux,导致skywalking日志打印traceId失效.#262
Open
YuFizz wants to merge 2 commits intoYunaiV:master-jdk17from
Open
fix: 修复Gateway网关使用Webflux,导致skywalking日志打印traceId失效.#262YuFizz wants to merge 2 commits intoYunaiV:master-jdk17from
YuFizz wants to merge 2 commits intoYunaiV:master-jdk17from
Conversation
|
有问题不敢承认,删除issue是吧?难道这是你们留下的后门?心虚了? 复现接口
|
2 similar comments
|
有问题不敢承认,删除issue是吧?难道这是你们留下的后门?心虚了? 复现接口
|
|
有问题不敢承认,删除issue是吧?难道这是你们留下的后门?心虚了? 复现接口
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
解决方案:
使用Webflux的插件以及包工具,手动获取TraceId后设置到MDC.(WebFluxSkyWalkingTraceContext.traceId(exchange))
解决步骤:
1、首先下载Skywalking Agent后,查看Plugin文件夹下是否存在Weblux以及Gateway相关的jar包,如果不存在需要从option-plugin文件夹进行拷贝。
2、引入依赖 apm-toolkit-webflux,与Skywalking版本一致
3、编写工具类或者直接通过方法获取
4、编写过滤器:gateway.filter 下的GlobalFilter,设置优先顺序执行 (不能是WebFliter)。
5、Gateway异常处理需要重新获取
注意:本次修复测试skywalking的版本依赖于9.4.0,而项目中版本为9.5.0。每个版本的Agent可能存在不同,请使用时注意版本问题。