@Test void shouldNotTag() { unit.onRequest(exchange, span); assertThat(span.tags(), not(hasKey("peer.address"))); assertThat(span.tags(), not(hasKey("peer.port"))); assertThat(span.tags(), not(hasKey("peer.hostname"))); assertThat(span.tags(), not(hasKey("peer.ipv4"))); assertThat(span.tags(), not(hasKey("peer.ipv6"))); }
@Override public void onRequest(final ServerWebExchange exchange, final Span span) { final ServerHttpRequest request = exchange.getRequest(); Optional.ofNullable(request.getRemoteAddress()).ifPresent(address -> { final String hostname = address.getHostString(); final int port = address.getPort(); span.setTag(PEER_ADDRESS, hostname + ":" + port); span.setTag(PEER_PORT, port); @Nullable final InetAddress ip = address.getAddress(); if (ip == null) { span.setTag(PEER_HOSTNAME, hostname); } else { if (!hostname.equals(ip.getHostAddress())) { span.setTag(PEER_HOSTNAME, hostname); } tagIfMatch(span, Inet4Address.class, PEER_HOST_IPV4, ip); tagIfMatch(span, Inet6Address.class, PEER_HOST_IPV6, ip); } }); }
PeerSpanDecorator implements SpanDecorator { @Override public void onRequest(final ServerWebExchange exchange, final Span span) { final ServerHttpRequest request = exchange.getRequest(); Optional.ofNullable(request.getRemoteAddress()).ifPresent(address -> { final String hostname = address.getHostString(); final int port = address.getPort(); span.setTag(PEER_ADDRESS, hostname + ":" + port); span.setTag(PEER_PORT, port); @Nullable final InetAddress ip = address.getAddress(); if (ip == null) { span.setTag(PEER_HOSTNAME, hostname); } else { if (!hostname.equals(ip.getHostAddress())) { span.setTag(PEER_HOSTNAME, hostname); } tagIfMatch(span, Inet4Address.class, PEER_HOST_IPV4, ip); tagIfMatch(span, Inet6Address.class, PEER_HOST_IPV6, ip); } }); } }
PeerSpanDecorator implements SpanDecorator { @Override public void onRequest(final ServerWebExchange exchange, final Span span) { final ServerHttpRequest request = exchange.getRequest(); Optional.ofNullable(request.getRemoteAddress()).ifPresent(address -> { final String hostname = address.getHostString(); final int port = address.getPort(); span.setTag(PEER_ADDRESS, hostname + ":" + port); span.setTag(PEER_PORT, port); @Nullable final InetAddress ip = address.getAddress(); if (ip == null) { span.setTag(PEER_HOSTNAME, hostname); } else { if (!hostname.equals(ip.getHostAddress())) { span.setTag(PEER_HOSTNAME, hostname); } tagIfMatch(span, Inet4Address.class, PEER_HOST_IPV4, ip); tagIfMatch(span, Inet6Address.class, PEER_HOST_IPV6, ip); } }); }  }
PeerSpanDecorator implements SpanDecorator { @Override public void onRequest(final ServerWebExchange exchange, final Span span) { final ServerHttpRequest request = exchange.getRequest(); Optional.ofNullable(request.getRemoteAddress()).ifPresent(address -> { final String hostname = address.getHostString(); final int port = address.getPort(); span.setTag(PEER_ADDRESS, hostname + ":" + port); span.setTag(PEER_PORT, port); @Nullable final InetAddress ip = address.getAddress(); if (ip == null) { span.setTag(PEER_HOSTNAME, hostname); } else { if (!hostname.equals(ip.getHostAddress())) { span.setTag(PEER_HOSTNAME, hostname); } tagIfMatch(span, Inet4Address.class, PEER_HOST_IPV4, ip); tagIfMatch(span, Inet6Address.class, PEER_HOST_IPV6, ip); } }); }  @Override void onRequest(final ServerWebExchange exchange, final Span span); }
PeerSpanDecorator implements SpanDecorator { @Override public void onRequest(final ServerWebExchange exchange, final Span span) { final ServerHttpRequest request = exchange.getRequest(); Optional.ofNullable(request.getRemoteAddress()).ifPresent(address -> { final String hostname = address.getHostString(); final int port = address.getPort(); span.setTag(PEER_ADDRESS, hostname + ":" + port); span.setTag(PEER_PORT, port); @Nullable final InetAddress ip = address.getAddress(); if (ip == null) { span.setTag(PEER_HOSTNAME, hostname); } else { if (!hostname.equals(ip.getHostAddress())) { span.setTag(PEER_HOSTNAME, hostname); } tagIfMatch(span, Inet4Address.class, PEER_HOST_IPV4, ip); tagIfMatch(span, Inet6Address.class, PEER_HOST_IPV6, ip); } }); }  @Override void onRequest(final ServerWebExchange exchange, final Span span); @API(status = EXPERIMENTAL)
    static final Tag<String> PEER_ADDRESS; }