@Test void shouldTagIpV6Only() { when(request.getRemoteAddr()).thenReturn("2001:db8::ff00:42:8329"); when(request.getRemoteHost()).thenReturn("2001:db8::ff00:42:8329"); when(request.getRemotePort()).thenReturn(42000); unit.onRequest(request, span); assertThat(span.tags(), hasEntry("peer.address", "2001:db8::ff00:42:8329:42000")); assertThat(span.tags(), hasEntry("peer.ipv6", "2001:db8::ff00:42:8329")); assertThat(span.tags(), hasEntry("peer.port", 42000)); assertThat(span.tags(), not(hasKey("peer.hostname"))); assertThat(span.tags(), not(hasKey("peer.ipv4"))); }
@Override public void onRequest(final HttpServletRequest request, final Span span) { final String ip = request.getRemoteAddr(); final String hostname = request.getRemoteHost(); final int port = request.getRemotePort(); span.setTag(PEER_ADDRESS, hostname + ":" + port); span.setTag(PEER_PORT, port); if (!ip.equals(hostname)) { span.setTag(PEER_HOSTNAME, hostname); } if (isProbablyIPv6(ip)) { span.setTag(PEER_HOST_IPV6, ip); } else { span.setTag(PEER_HOST_IPV4, ip); } }
PeerSpanDecorator implements SpanDecorator { @Override public void onRequest(final HttpServletRequest request, final Span span) { final String ip = request.getRemoteAddr(); final String hostname = request.getRemoteHost(); final int port = request.getRemotePort(); span.setTag(PEER_ADDRESS, hostname + ":" + port); span.setTag(PEER_PORT, port); if (!ip.equals(hostname)) { span.setTag(PEER_HOSTNAME, hostname); } if (isProbablyIPv6(ip)) { span.setTag(PEER_HOST_IPV6, ip); } else { span.setTag(PEER_HOST_IPV4, ip); } } }
PeerSpanDecorator implements SpanDecorator { @Override public void onRequest(final HttpServletRequest request, final Span span) { final String ip = request.getRemoteAddr(); final String hostname = request.getRemoteHost(); final int port = request.getRemotePort(); span.setTag(PEER_ADDRESS, hostname + ":" + port); span.setTag(PEER_PORT, port); if (!ip.equals(hostname)) { span.setTag(PEER_HOSTNAME, hostname); } if (isProbablyIPv6(ip)) { span.setTag(PEER_HOST_IPV6, ip); } else { span.setTag(PEER_HOST_IPV4, ip); } }  }
PeerSpanDecorator implements SpanDecorator { @Override public void onRequest(final HttpServletRequest request, final Span span) { final String ip = request.getRemoteAddr(); final String hostname = request.getRemoteHost(); final int port = request.getRemotePort(); span.setTag(PEER_ADDRESS, hostname + ":" + port); span.setTag(PEER_PORT, port); if (!ip.equals(hostname)) { span.setTag(PEER_HOSTNAME, hostname); } if (isProbablyIPv6(ip)) { span.setTag(PEER_HOST_IPV6, ip); } else { span.setTag(PEER_HOST_IPV4, ip); } }  @Override void onRequest(final HttpServletRequest request, final Span span); }
PeerSpanDecorator implements SpanDecorator { @Override public void onRequest(final HttpServletRequest request, final Span span) { final String ip = request.getRemoteAddr(); final String hostname = request.getRemoteHost(); final int port = request.getRemotePort(); span.setTag(PEER_ADDRESS, hostname + ":" + port); span.setTag(PEER_PORT, port); if (!ip.equals(hostname)) { span.setTag(PEER_HOSTNAME, hostname); } if (isProbablyIPv6(ip)) { span.setTag(PEER_HOST_IPV6, ip); } else { span.setTag(PEER_HOST_IPV4, ip); } }  @Override void onRequest(final HttpServletRequest request, final Span span);  }