forked from sofastack/sofa-rpc
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3b3fab1
commit 90ca2b5
Showing
2 changed files
with
41 additions
and
43 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,7 +19,6 @@ | |
import com.alipay.sofa.rpc.tracer.Tracers; | ||
|
||
/** | ||
* | ||
* @author <a href="mailto:[email protected]">zhanggeng</a> | ||
*/ | ||
public class SofaTracerSubscriber extends Subscriber { | ||
|
@@ -34,17 +33,15 @@ public void onEvent(Event originEvent) { | |
if (eventClass == ClientStartInvokeEvent.class) { | ||
ClientStartInvokeEvent event = (ClientStartInvokeEvent) originEvent; | ||
Tracers.startRpc(event.getRequest()); | ||
} | ||
|
||
else if (eventClass == ClientBeforeSendEvent.class) { | ||
} else if (eventClass == ClientBeforeSendEvent.class) { | ||
ClientBeforeSendEvent event = (ClientBeforeSendEvent) originEvent; | ||
Tracers.clientBeforeSend(event.getRequest()); | ||
} else if (eventClass == ClientAfterSendEvent.class) { | ||
// 异步发送完毕 | ||
ClientAfterSendEvent event = (ClientAfterSendEvent) originEvent; | ||
Tracers.clientAsyncAfterSend(event.getRequest()); | ||
} | ||
|
||
// else if (eventClass == ClientAfterSendEvent.class) { | ||
// // 异步发送完毕 | ||
// } | ||
|
||
// else if (eventClass == ClientSyncReceiveEvent.class) { | ||
// // 同步返回结果 | ||
// } | ||
|
@@ -55,31 +52,23 @@ else if (eventClass == ClientAsyncReceiveEvent.class) { | |
Tracers.clientAsyncReceivedPrepare(); | ||
// 记录收到返回 | ||
Tracers.clientReceived(event.getRequest(), event.getResponse(), event.getThrowable()); | ||
} | ||
|
||
else if (eventClass == ClientEndInvokeEvent.class) { | ||
} else if (eventClass == ClientEndInvokeEvent.class) { | ||
ClientEndInvokeEvent event = (ClientEndInvokeEvent) originEvent; | ||
if (!event.getRequest().isAsync()) { | ||
// 因为同步调用重试行为,需要放到最后才能算 received | ||
Tracers.clientReceived(event.getRequest(), event.getResponse(), event.getThrowable()); | ||
} | ||
// 检查下状态 | ||
Tracers.checkState(); | ||
} | ||
|
||
else if (eventClass == ServerReceiveEvent.class) { | ||
} else if (eventClass == ServerReceiveEvent.class) { | ||
ServerReceiveEvent event = (ServerReceiveEvent) originEvent; | ||
// 接到请求 | ||
Tracers.serverReceived(event.getRequest()); | ||
} | ||
|
||
else if (eventClass == ServerSendEvent.class) { | ||
} else if (eventClass == ServerSendEvent.class) { | ||
// 发送响应 | ||
ServerSendEvent event = (ServerSendEvent) originEvent; | ||
Tracers.serverSend(event.getRequest(), event.getResponse(), event.getThrowable()); | ||
} | ||
|
||
else if (eventClass == ServerEndHandleEvent.class) { | ||
} else if (eventClass == ServerEndHandleEvent.class) { | ||
// 检查下状态 | ||
Tracers.checkState(); | ||
} | ||
|
This file contains 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