TagExcludingSpanEventListener extends StatelessSpanEventListener { @Override public Number onSetTag(String key, Number value) { if (tracingPlugin.getExcludedTags().contains(key)) { return null; } else { return value; } } TagExcludingSpanEventListener(TracingPlugin tracingPlugin); @Override Number onSetTag(String key, Number value); @Override String onSetTag(String key, String value);  }
@Test public void testNoExclude() throws Exception { assertThat(tagExcludingSpanEventListener.onSetTag("foo", "bar")).isEqualTo("bar"); assertThat(tagExcludingSpanEventListener.onSetTag("foo", 1)).isEqualTo(1); }
@Test public void testOtherExclude() throws Exception { when(tracingPlugin.getExcludedTags()).thenReturn(Collections.singleton("bar")); assertThat(tagExcludingSpanEventListener.onSetTag("foo", "bar")).isEqualTo("bar"); assertThat(tagExcludingSpanEventListener.onSetTag("foo", 1)).isEqualTo(1); }
@Test public void testExclude() throws Exception { when(tracingPlugin.getExcludedTags()).thenReturn(Collections.singleton("foo")); assertThat(tagExcludingSpanEventListener.onSetTag("foo", "bar")).isNull(); assertThat(tagExcludingSpanEventListener.onSetTag("foo", 1)).isNull(); }