public class RealCallInterceptor extends Object implements InstanceMethodsAroundInterceptor, InstanceConstructorInterceptor
RealCallInterceptor intercept the synchronous http calls by the discovery of okhttp.| Constructor and Description |
|---|
RealCallInterceptor() |
| Modifier and Type | Method and Description |
|---|---|
Object |
afterMethod(EnhancedInstance objInst,
Method method,
Object[] allArguments,
Class<?>[] argumentsTypes,
Object ret)
Get the status code from
Response, when status code greater than 400, it means there was some errors in
the server. |
void |
beforeMethod(EnhancedInstance objInst,
Method method,
Object[] allArguments,
Class<?>[] argumentsTypes,
MethodInterceptResult result)
Get the
Request from EnhancedInstance, then create AbstractSpan and set host,
port, kind, component, url from Request. |
void |
handleMethodException(EnhancedInstance objInst,
Method method,
Object[] allArguments,
Class<?>[] argumentsTypes,
Throwable t) |
void |
onConstruct(EnhancedInstance objInst,
Object[] allArguments) |
public void onConstruct(EnhancedInstance objInst, Object[] allArguments)
onConstruct in interface InstanceConstructorInterceptorpublic void beforeMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes, MethodInterceptResult result) throws Throwable
Request from EnhancedInstance, then create AbstractSpan and set host,
port, kind, component, url from Request. Through the reflection of the way, set the http header
of context data into Request.headers().beforeMethod in interface InstanceMethodsAroundInterceptorresult - change this result, if you want to truncate the method.Throwablepublic Object afterMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes, Object ret) throws Throwable
Response, when status code greater than 400, it means there was some errors in
the server. Finish the AbstractSpan.afterMethod in interface InstanceMethodsAroundInterceptorret - the method's original return value.Throwablepublic void handleMethodException(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes, Throwable t)
handleMethodException in interface InstanceMethodsAroundInterceptorCopyright © 2023 The Apache Software Foundation. All rights reserved.