|
28 | 28 | import com.navercorp.pinpoint.plugin.reactor.netty.HttpCallContext;
|
29 | 29 | import com.navercorp.pinpoint.plugin.reactor.netty.HttpCallContextAccessor;
|
30 | 30 | import com.navercorp.pinpoint.plugin.reactor.netty.ReactorNettyConstants;
|
31 |
| -import reactor.netty.ConnectionObserver; |
32 | 31 |
|
33 | 32 | public class HttpIOHandlerObserverOnStateChangeInterceptor extends AsyncContextSpanEventSimpleAroundInterceptor {
|
34 | 33 | // The request has been prepared and ready for I/O handler to be invoked
|
@@ -95,10 +94,12 @@ public void doInBeforeTrace(SpanEventRecorder recorder, AsyncContext asyncContex
|
95 | 94 | } else if (isClosed(rawState)) {
|
96 | 95 | if (target instanceof HttpCallContextAccessor) {
|
97 | 96 | final HttpCallContext httpCallContext = ((HttpCallContextAccessor) target)._$PINPOINT$_getHttpCallContext();
|
98 |
| - final IntBooleanIntBooleanValue value = new IntBooleanIntBooleanValue((int) httpCallContext.getWriteElapsedTime(), httpCallContext.isWriteFail(), (int) httpCallContext.getReadElapsedTime(), httpCallContext.isReadFail()); |
99 |
| - recorder.recordAttribute(AnnotationKey.HTTP_IO, value); |
100 |
| - // Clear HttpCallContext |
101 |
| - ((HttpCallContextAccessor) target)._$PINPOINT$_setHttpCallContext(null); |
| 97 | + if (httpCallContext != null) { |
| 98 | + final IntBooleanIntBooleanValue value = new IntBooleanIntBooleanValue((int) httpCallContext.getWriteElapsedTime(), httpCallContext.isWriteFail(), (int) httpCallContext.getReadElapsedTime(), httpCallContext.isReadFail()); |
| 99 | + recorder.recordAttribute(AnnotationKey.HTTP_IO, value); |
| 100 | + // Clear HttpCallContext |
| 101 | + ((HttpCallContextAccessor) target)._$PINPOINT$_setHttpCallContext(null); |
| 102 | + } |
102 | 103 | }
|
103 | 104 | final String value = "CLOSED " + rawState;
|
104 | 105 | recorder.recordAttribute(AnnotationKey.HTTP_INTERNAL_DISPLAY, value);
|
|
0 commit comments