public final class Tracers extends Object
Trace主要分为几个阶段:
0:开始
1:客户端发送请求前 (异步要特殊处理)
1.1 异步结束
2. 服务端收到请求后
3. 服务端返回响应后
3.1 返回正常响应
3.2 返回异常响应
4. 客户端收到响应后 (异步要特殊处理)
4.1 收到正常响应
4.2 收到异常响应
其它:
记录profiler日志
同步情况下,1和4在同一个线程,2和3在同一个线程。
异步情况下,1和1.1在同一个线程,2和3在同一个线程,4在一个线程
| 构造器和说明 |
|---|
Tracers() |
| 限定符和类型 | 方法和说明 |
|---|---|
static void |
checkState()
检查状态,在结束调用的时候进行调用,防止资源泄露
|
static void |
clientAsyncAfterSend(SofaRequest request)
1.1.
|
static void |
clientAsyncReceivedPrepare()
4.3 客户端异步收到响应,做准备,例如设置到上下文
|
static void |
clientBeforeSend(SofaRequest request)
1:客户端发送请求前
|
static void |
clientReceived(SofaRequest request,
SofaResponse response,
Throwable throwable)
4.
|
static Tracer |
getTracer() |
static boolean |
isEnable()
是否启动Tracer
|
static void |
profile(String profileApp,
String code,
String message)
记录日志
|
static void |
serverReceived(SofaRequest request)
2.
|
static void |
serverSend(SofaRequest request,
SofaResponse response,
Throwable throwable)
3.
|
static void |
startRpc(SofaRequest request)
0:开始
|
public static Tracer getTracer()
public static boolean isEnable()
public static void startRpc(SofaRequest request)
request - 调用请求public static void clientBeforeSend(SofaRequest request)
request - 调用请求public static void serverReceived(SofaRequest request)
request - 调用请求public static void serverSend(SofaRequest request, SofaResponse response, Throwable throwable)
request - 调用请求response - 调用响应throwable - 异常public static void clientReceived(SofaRequest request, SofaResponse response, Throwable throwable)
request - 调用请求response - 调用响应throwable - 异常public static void clientAsyncAfterSend(SofaRequest request)
request - 请求public static void clientAsyncReceivedPrepare()
public static void profile(String profileApp, String code, String message)
profileApp - 应用code - 编码message - 消息public static void checkState()
Copyright © 2008–2018 The Ant Financial. All rights reserved.