/** Alternative to {@link #getStatus}, but for Servlet 2.5+ */ @Override public Collection<KeyValueAnnotation> responseAnnotations() { return Collections.singleton( KeyValueAnnotation.create("http.status_code", String.valueOf(httpStatus)) ); } }
public Collection<KeyValueAnnotation> requestAnnotations() { SocketAddress socketAddress = null; if (socketAddress != null) { KeyValueAnnotation remoteAddrAnnotation = KeyValueAnnotation.create( "DRPC_REMOTE_ADDR", socketAddress.toString()); return Collections.singleton(remoteAddrAnnotation); } else { return Collections.emptyList(); } } }
/** * Handle a client response. * * @param adapter Adapter that hides implementation details. */ public void handle(ClientResponseAdapter adapter) { try { for (KeyValueAnnotation annotation : adapter.responseAnnotations()) { clientTracer.submitBinaryAnnotation(annotation.getKey(), annotation.getValue()); } } finally { clientTracer.setClientReceived(); } } }
@Override public Collection<KeyValueAnnotation> responseAnnotations() { int httpStatus = response.getHttpStatusCode(); if ((httpStatus < 200) || (httpStatus > 299)) { KeyValueAnnotation statusAnnotation = KeyValueAnnotation.create(TraceKeys.HTTP_STATUS_CODE, String.valueOf(httpStatus)); return Arrays.asList(statusAnnotation); } return Collections.EMPTY_LIST; } }
/** * Handle a client response. * * @param adapter Adapter that hides implementation details. */ public void handle(ClientResponseAdapter adapter) { try { for (KeyValueAnnotation annotation : adapter.responseAnnotations()) { clientTracer.submitBinaryAnnotation(annotation.getKey(), annotation.getValue()); } } finally { clientTracer.setClientReceived(); } } }
@Override public Collection<KeyValueAnnotation> responseAnnotations() { int httpStatus = response.getHttpStatusCode(); if ((httpStatus < 200) || (httpStatus > 299)) { return Collections.singleton(KeyValueAnnotation.create( "http.status_code", String.valueOf(httpStatus))); } return Collections.emptyList(); }
public void handle(ServerResponseAdapter adapter) { // We can submit this in any case. When server state is not set or // we should not trace this request nothing will happen. LOGGER.fine("Sending server send."); try { for(KeyValueAnnotation annotation : adapter.responseAnnotations()) { serverTracer.submitBinaryAnnotation(annotation.getKey(), annotation.getValue()); } serverTracer.setServerSend(); } finally { serverTracer.clearCurrentSpan(); } } }
@Override public Collection<KeyValueAnnotation> responseAnnotations() { KeyValueAnnotation statusAnnotation = KeyValueAnnotation.create( TraceKeys.HTTP_STATUS_CODE, String.valueOf(response.getHttpStatusCode())); return Arrays.asList(statusAnnotation); } }
public void handle(ServerResponseAdapter adapter) { // We can submit this in any case. When server state is not set or // we should not trace this request nothing will happen. LOGGER.fine("Sending server send."); try { for(KeyValueAnnotation annotation : adapter.responseAnnotations()) { serverTracer.submitBinaryAnnotation(annotation.getKey(), annotation.getValue()); } serverTracer.setServerSend(); } finally { serverTracer.clearCurrentSpan(); } } }
@Override public Collection<KeyValueAnnotation> requestAnnotations() { URI uri = request.getUri(); KeyValueAnnotation annotation = KeyValueAnnotation.create(TraceKeys.HTTP_URL, uri.toString()); return Arrays.asList(annotation); }
/** * Handles outgoing request. * * @param adapter The adapter deals with implementation specific details. */ public void handle(ClientRequestAdapter adapter) { SpanId context = clientTracer.startNewSpan(adapter.getSpanName()); if (context == null) { // We will not trace this request. adapter.addSpanIdToRequest(null); } else { adapter.addSpanIdToRequest(context); for (KeyValueAnnotation annotation : adapter.requestAnnotations()) { clientTracer.submitBinaryAnnotation(annotation.getKey(), annotation.getValue()); } recordClientSentAnnotations(adapter.serverAddress()); } }
@Override public Collection<KeyValueAnnotation> responseAnnotations() { return Collections.singleton(KeyValueAnnotation.create( "http.status_code", String.valueOf(response.getHttpStatusCode()))); } }
/** * Handles outgoing request. * * @param adapter The adapter deals with implementation specific details. */ public void handle(ClientRequestAdapter adapter) { SpanId spanId = clientTracer.startNewSpan(adapter.getSpanName()); if (spanId == null) { // We will not trace this request. adapter.addSpanIdToRequest(null); } else { adapter.addSpanIdToRequest(spanId); for (KeyValueAnnotation annotation : adapter.requestAnnotations()) { clientTracer.submitBinaryAnnotation(annotation.getKey(), annotation.getValue()); } recordClientSentAnnotations(adapter.serverAddress()); } }
@Override public Collection<KeyValueAnnotation> requestAnnotations() { SocketAddress socketAddress = context.getRemoteAddress(); if (socketAddress != null) { KeyValueAnnotation remoteAddrAnnotation = KeyValueAnnotation.create( DubboKeys.DUBBO_REMOTE_ADDR, socketAddress.toString()); return Collections.singleton(remoteAddrAnnotation); } else { return Collections.emptyList(); } } }
@Override @SuppressWarnings("unchecked") public Collection<KeyValueAnnotation> responseAnnotations() { return result.hasException() ? Collections.singletonList(KeyValueAnnotation.create(DubboKeys.DUBBO_EXCEPTION_NAME, result.toString())): Collections.<KeyValueAnnotation>emptyList(); }
@Override public Collection<KeyValueAnnotation> responseAnnotations() { return result.hasException() ? Collections.singletonList(KeyValueAnnotation.create(DubboKeys.DUBBO_EXCEPTION_NAME, result.toString())): Collections.<KeyValueAnnotation>emptyList(); } }
@Override public Collection<KeyValueAnnotation> requestAnnotations() { KeyValueAnnotation uriAnnotation = KeyValueAnnotation.create( TraceKeys.HTTP_URL, serverRequest.getUri().toString()); return Collections.singleton(uriAnnotation); }