Search in sources :

Example 1 with ConnectionGetter

use of com.navercorp.pinpoint.plugin.okhttp.ConnectionGetter in project pinpoint by naver.

the class HttpEngineConnectMethodInterceptor method doInAfterTrace.

@Override
protected void doInAfterTrace(SpanEventRecorder recorder, Object target, Object[] args, Object result, Throwable throwable) {
    if (target instanceof ConnectionGetter) {
        Connection connection = ((ConnectionGetter) target)._$PINPOINT$_getConnection();
        if (connection != null) {
            final StringBuilder sb = new StringBuilder();
            sb.append(connection.getRoute().getAddress().getUriHost()).append(":");
            sb.append(connection.getRoute().getAddress().getUriPort());
            recorder.recordAttribute(AnnotationKey.HTTP_INTERNAL_DISPLAY, sb.toString());
        }
    }
    recorder.recordApi(methodDescriptor);
    recorder.recordServiceType(OkHttpConstants.OK_HTTP_CLIENT_INTERNAL);
    recorder.recordException(throwable);
}
Also used : Connection(com.squareup.okhttp.Connection) ConnectionGetter(com.navercorp.pinpoint.plugin.okhttp.ConnectionGetter)

Aggregations

ConnectionGetter (com.navercorp.pinpoint.plugin.okhttp.ConnectionGetter)1 Connection (com.squareup.okhttp.Connection)1