com.nike.wingtips.Tracer.getSpanLifecycleListeners()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(7.5k)|赞(0)|评价(0)|浏览(145)

本文整理了Java中com.nike.wingtips.Tracer.getSpanLifecycleListeners()方法的一些代码示例,展示了Tracer.getSpanLifecycleListeners()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Tracer.getSpanLifecycleListeners()方法的具体详情如下:
包路径:com.nike.wingtips.Tracer
类名称:Tracer
方法名:getSpanLifecycleListeners

Tracer.getSpanLifecycleListeners介绍

暂无

代码示例

代码示例来源:origin: Nike-Inc/wingtips

@Test
public void addSpanLifecycleListener_should_work_as_advertised() {
  // given
  SpanLifecycleListener listener = mock(SpanLifecycleListener.class);
  assertThat(Tracer.getInstance().getSpanLifecycleListeners()).isEmpty();
  // when
  Tracer.getInstance().addSpanLifecycleListener(listener);
  // then
  assertThat(Tracer.getInstance().getSpanLifecycleListeners()).hasSize(1);
  assertThat(Tracer.getInstance().getSpanLifecycleListeners().get(0)).isEqualTo(listener);
}

代码示例来源:origin: Nike-Inc/wingtips

private void clearTracerSpanLifecycleListeners() {
  List<SpanLifecycleListener> listeners = new ArrayList<>(Tracer.getInstance().getSpanLifecycleListeners());
  for (SpanLifecycleListener listener : listeners) {
    Tracer.getInstance().removeSpanLifecycleListener(listener);
  }
}

代码示例来源:origin: Nike-Inc/wingtips

@Test
public void constructor_does_not_register_WingtipsToZipkinLifecycleListener_when_props_shouldApplyWingtipsToZipkinLifecycleListener_returns_false() {
  // given
  WingtipsZipkinProperties props = mock(WingtipsZipkinProperties.class);
  doReturn(false).when(props).shouldApplyWingtipsToZipkinLifecycleListener();
  // when
  new WingtipsWithZipkinSpringBootConfiguration(props);
  // then
  assertThat(Tracer.getInstance().getSpanLifecycleListeners()).isEmpty();
  verify(props).shouldApplyWingtipsToZipkinLifecycleListener();
  verifyNoMoreInteractions(props);
}

代码示例来源:origin: Nike-Inc/wingtips

private void removeSpanRecorderLifecycleListener() {
  List<SpanLifecycleListener> listeners = new ArrayList<>(Tracer.getInstance().getSpanLifecycleListeners());
  for (SpanLifecycleListener listener : listeners) {
    if (listener instanceof SpanRecorder) {
      Tracer.getInstance().removeSpanLifecycleListener(listener);
    }
  }
}

代码示例来源:origin: Nike-Inc/wingtips

private void clearTracerSpanLifecycleListeners() {
  List<SpanLifecycleListener> listeners = new ArrayList<>(Tracer.getInstance().getSpanLifecycleListeners());
  for (SpanLifecycleListener listener : listeners) {
    Tracer.getInstance().removeSpanLifecycleListener(listener);
  }
}

代码示例来源:origin: Nike-Inc/wingtips

private void removeSpanRecorderLifecycleListener() {
  List<SpanLifecycleListener> listeners = new ArrayList<>(Tracer.getInstance().getSpanLifecycleListeners());
  for (SpanLifecycleListener listener : listeners) {
    if (listener instanceof SpanRecorder) {
      Tracer.getInstance().removeSpanLifecycleListener(listener);
    }
  }
}

代码示例来源:origin: Nike-Inc/riposte

private void removeSpanRecorderLifecycleListener() {
  List<SpanLifecycleListener> listeners = new ArrayList<>(Tracer.getInstance().getSpanLifecycleListeners());
  for (SpanLifecycleListener listener : listeners) {
    if (listener instanceof SpanRecorder) {
      Tracer.getInstance().removeSpanLifecycleListener(listener);
    }
  }
}

代码示例来源:origin: Nike-Inc/riposte

private void removeSpanRecorderLifecycleListener() {
  List<SpanLifecycleListener> listeners = new ArrayList<>(Tracer.getInstance().getSpanLifecycleListeners());
  for (SpanLifecycleListener listener : listeners) {
    if (listener instanceof SpanRecorder) {
      Tracer.getInstance().removeSpanLifecycleListener(listener);
    }
  }
}

代码示例来源:origin: Nike-Inc/wingtips

@Test
public void constructor_does_not_register_WingtipsToZipkinLifecycleListener_when_props_shouldApplyWingtipsToZipkinLifecycleListener_returns_false() {
  // given
  WingtipsZipkinProperties props = mock(WingtipsZipkinProperties.class);
  doReturn(false).when(props).shouldApplyWingtipsToZipkinLifecycleListener();
  // when
  new WingtipsWithZipkinSpringBootConfiguration(props, null);
  // then
  assertThat(Tracer.getInstance().getSpanLifecycleListeners()).isEmpty();
  verify(props).shouldApplyWingtipsToZipkinLifecycleListener();
  verifyNoMoreInteractions(props);
}

代码示例来源:origin: Nike-Inc/wingtips

private void clearTracerSpanLifecycleListeners() {
  List<SpanLifecycleListener> listeners = new ArrayList<>(Tracer.getInstance().getSpanLifecycleListeners());
  for (SpanLifecycleListener listener : listeners) {
    Tracer.getInstance().removeSpanLifecycleListener(listener);
  }
}

代码示例来源:origin: Nike-Inc/wingtips

private void clearTracerSpanLifecycleListeners() {
  List<SpanLifecycleListener> listeners = new ArrayList<>(Tracer.getInstance().getSpanLifecycleListeners());
  for (SpanLifecycleListener listener : listeners) {
    Tracer.getInstance().removeSpanLifecycleListener(listener);
  }
}

代码示例来源:origin: Nike-Inc/wingtips

private void clearTracerSpanLifecycleListeners() {
  List<SpanLifecycleListener> listeners = new ArrayList<>(Tracer.getInstance().getSpanLifecycleListeners());
  for (SpanLifecycleListener listener : listeners) {
    Tracer.getInstance().removeSpanLifecycleListener(listener);
  }
}

代码示例来源:origin: Nike-Inc/wingtips

private void removeSpanRecorderLifecycleListener() {
  List<SpanLifecycleListener> listeners = new ArrayList<>(Tracer.getInstance().getSpanLifecycleListeners());
  for (SpanLifecycleListener listener : listeners) {
    if (listener instanceof SpanRecorder) {
      Tracer.getInstance().removeSpanLifecycleListener(listener);
    }
  }
}

代码示例来源:origin: Nike-Inc/wingtips

private void removeSpanRecorderLifecycleListener() {
  List<SpanLifecycleListener> listeners = new ArrayList<>(Tracer.getInstance().getSpanLifecycleListeners());
  for (SpanLifecycleListener listener : listeners) {
    if (listener instanceof SpanRecorder) {
      Tracer.getInstance().removeSpanLifecycleListener(listener);
    }
  }
}

代码示例来源:origin: Nike-Inc/wingtips

private void clearTracerSpanLifecycleListeners() {
  List<SpanLifecycleListener> listeners = new ArrayList<>(Tracer.getInstance().getSpanLifecycleListeners());
  for (SpanLifecycleListener listener : listeners) {
    Tracer.getInstance().removeSpanLifecycleListener(listener);
  }
}

代码示例来源:origin: Nike-Inc/wingtips

private void clearTracerSpanLifecycleListeners() {
  List<SpanLifecycleListener> listeners = new ArrayList<>(Tracer.getInstance().getSpanLifecycleListeners());
  for (SpanLifecycleListener listener : listeners) {
    Tracer.getInstance().removeSpanLifecycleListener(listener);
  }
}

代码示例来源:origin: Nike-Inc/wingtips

@Test
public void addSpanLifecycleListener_should_do_nothing_if_passed_null() {
  // given
  assertThat(Tracer.getInstance().getSpanLifecycleListeners()).isEmpty();
  // when
  Tracer.getInstance().addSpanLifecycleListener(null);
  // then
  assertThat(Tracer.getInstance().getSpanLifecycleListeners()).isEmpty();
}

代码示例来源:origin: Nike-Inc/wingtips

public static void resetTracing() {
  MDC.clear();
  Tracer.getInstance().unregisterFromThread();
  List<SpanLifecycleListener> listeners = new ArrayList<>(Tracer.getInstance().getSpanLifecycleListeners());
  for (SpanLifecycleListener listener : listeners) {
    Tracer.getInstance().removeSpanLifecycleListener(listener);
  }
}

代码示例来源:origin: Nike-Inc/wingtips

private void resetTracing() {
  MDC.clear();
  Tracer.getInstance().unregisterFromThread();
  List<SpanLifecycleListener> listeners = new ArrayList<>(Tracer.getInstance().getSpanLifecycleListeners());
  for (SpanLifecycleListener listener : listeners) {
    Tracer.getInstance().removeSpanLifecycleListener(listener);
  }
}

代码示例来源:origin: Nike-Inc/wingtips

private void resetTracer() {
  Tracer.getInstance().completeRequestSpan();
  Tracer.getInstance().setRootSpanSamplingStrategy(new SampleAllTheThingsStrategy());
  for (SpanLifecycleListener listener : new ArrayList<>(Tracer.getInstance().getSpanLifecycleListeners())) {
    Tracer.getInstance().removeSpanLifecycleListener(listener);
  }
  Tracer.getInstance().setSpanLoggingRepresentation(Tracer.SpanLoggingRepresentation.JSON);
}

相关文章