/** 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(); } } }
@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; } }
@Override public Collection<KeyValueAnnotation> responseAnnotations() { return Collections.singleton(KeyValueAnnotation.create( "http.status_code", String.valueOf(response.getHttpStatusCode()))); } }
@Override public Collection<KeyValueAnnotation> requestAnnotations() { KeyValueAnnotation uriAnnotation = KeyValueAnnotation.create( TraceKeys.HTTP_URL, serverRequest.getUri().toString()); return Collections.singleton(uriAnnotation); }
@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(); }
@Override public Collection<KeyValueAnnotation> responseAnnotations() { KeyValueAnnotation statusAnnotation = KeyValueAnnotation.create( TraceKeys.HTTP_STATUS_CODE, String.valueOf(response.getHttpStatusCode())); return Arrays.asList(statusAnnotation); } }
@Override public Collection<KeyValueAnnotation> requestAnnotations() { URI uri = request.getUri(); KeyValueAnnotation annotation = KeyValueAnnotation.create(TraceKeys.HTTP_URL, uri.toString()); return Arrays.asList(annotation); }
@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( "http.url", request.getUri().toString()); return Collections.singleton(uriAnnotation); }
@Override public Collection<KeyValueAnnotation> requestAnnotations() { return Collections.singleton(KeyValueAnnotation.create( "http.url", request.getUri().toString())); }
@Override public Collection<KeyValueAnnotation> responseAnnotations() { List<KeyValueAnnotation> annotations = new ArrayList<KeyValueAnnotation>(); if(exception != null){ KeyValueAnnotation keyValueAnnotation= KeyValueAnnotation.create("exception",exception.getMessage()); annotations.add(keyValueAnnotation); }else{ if(rpcResult.hasException()){ KeyValueAnnotation keyValueAnnotation= KeyValueAnnotation.create("exception",rpcResult.getException().getMessage()); annotations.add(keyValueAnnotation); }else{ KeyValueAnnotation keyValueAnnotation= KeyValueAnnotation.create("status","success"); annotations.add(keyValueAnnotation); } } return annotations; }
@Override public Collection<KeyValueAnnotation> responseAnnotations() { List<KeyValueAnnotation> annotations = new ArrayList<KeyValueAnnotation>(); if(!rpcResult.hasException()){ KeyValueAnnotation keyValueAnnotation= KeyValueAnnotation.create("server_result","true"); annotations.add(keyValueAnnotation); }else { KeyValueAnnotation keyValueAnnotation= KeyValueAnnotation.create("exception",rpcResult.getException().getMessage()); annotations.add(keyValueAnnotation); } return annotations; } }
/** Alternative to {@link #getStatus}, but for Servlet 2.5+ */ @Override public Collection<KeyValueAnnotation> responseAnnotations() { String status = getHeader("status"); String message = getHeader("message"); if(StringUtils.isNotEmpty(status)) { if (Integer.parseInt(status) != 0) { KeyValueAnnotation keyValueAnnotation1 = KeyValueAnnotation.create(DubboKeys.HTTP_STATUS, status); KeyValueAnnotation keyValueAnnotation2 = KeyValueAnnotation.create(DubboKeys.HTTP_MESSAGE, message); return Lists.newArrayList(keyValueAnnotation1 ,keyValueAnnotation2); } } return Collections.singleton( KeyValueAnnotation.create(zipkin.TraceKeys.HTTP_STATUS_CODE, String.valueOf(httpStatus)) ); } }
@SuppressWarnings("unchecked") public Collection<KeyValueAnnotation> responseAnnotations() { return !result.hasException() ? Collections.<KeyValueAnnotation>emptyList() : Collections.singletonList(KeyValueAnnotation.create("error", result.getException().getMessage())); }
@Override public Collection<KeyValueAnnotation> requestAnnotations() { return Collections.singletonList(KeyValueAnnotation.create("url", RpcContext.getContext().getUrl().toString())); }
public Collection<KeyValueAnnotation> requestAnnotations() { Service ls = (Service) invocation.getArguments()[0]; Map data = ls.getData(); KeyValueAnnotation an = KeyValueAnnotation.create("params", JsonUtils.map2Json(data)); return Collections.singletonList(an); }
@Override public Collection<KeyValueAnnotation> requestAnnotations() { String ipAddr = RpcContext.getContext().getUrl().getIp(); InetSocketAddress inetSocketAddress = RpcContext.getContext().getRemoteAddress(); final String clientName = clientNameProvider.resolveClientName(RpcContext.getContext()); serverTracer.setServerReceived(IPConversion.convertToInt(ipAddr),inetSocketAddress.getPort(),clientName); InetSocketAddress socketAddress = RpcContext.getContext().getLocalAddress(); if (socketAddress != null) { KeyValueAnnotation remoteAddrAnnotation = KeyValueAnnotation.create("address", socketAddress.toString()); return Collections.singleton(remoteAddrAnnotation); } else { return Collections.emptyList(); } }