未验证 提交 901e8d84 编写于 作者: S simonlei 提交者: GitHub

Fix issue #5795 (#5797)

* Fix issue #5795 

Fix the issue: nutz plugin throw NPE at afterMethod, cause traceid keep unchange for the thread

* fix the style and modify the CHANGES.md
Co-authored-by: wu-sheng's avatar吴晟 Wu Sheng <wu.sheng@foxmail.com>
Co-authored-by: Nsimonlei <simonlei@tencent.com>
Co-authored-by: Nkezhenxu94 <kezhenxu94@apache.org>
上级 c32caab6
......@@ -15,6 +15,7 @@ Release Notes.
* Make the okhttp3 plugin to support Java 14
* Polish tracing context related codes.
* Add the plugin for async-http-client 2.x
* Fix NPE in the nutz plugin.
#### OAP-Backend
* Add the `@SuperDataset` annotation for BrowserErrorLog.
......
......@@ -63,11 +63,12 @@ public class SenderSendInterceptor implements InstanceMethodsAroundInterceptor {
public Object afterMethod(final EnhancedInstance objInst, final Method method, final Object[] allArguments,
final Class<?>[] argumentsTypes, Object ret) throws Throwable {
Response response = (Response) ret;
int statusCode = response.getStatus();
AbstractSpan span = ContextManager.activeSpan();
if (statusCode >= 400) {
if (response == null || response.getStatus() >= 400) {
span.errorOccurred();
Tags.STATUS_CODE.set(span, Integer.toString(statusCode));
if (response != null)
Tags.STATUS_CODE.set(span, Integer.toString(response.getStatus()));
}
ContextManager.stopSpan();
return ret;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册