SamplePriorityDeterminingSpanEventListener extends StatelessSpanEventListener { public void addPreInterceptor(PreExecutionSpanInterceptor interceptor) { interceptor.init(configuration); preInterceptors.add(interceptor); } SamplePriorityDeterminingSpanEventListener(ConfigurationRegistry configuration);  SamplePriorityDeterminingSpanEventListener(ConfigurationRegistry configuration, Iterable<PreExecutionSpanInterceptor> preExecutionSpanInterceptors, Iterable<PostExecutionSpanInterceptor> postExecutionSpanInterceptors); @Override void onStart(SpanWrapper spanWrapper); @Override void onFinish(SpanWrapper spanWrapper, String operationName, long durationNanos); void addPreInterceptor(PreExecutionSpanInterceptor interceptor); void addPostInterceptor(PostExecutionSpanInterceptor interceptor);  }
@Test public void testSetSamplePrioInPreInterceptor() throws Exception { when(tracingPlugin.isSampled(any())).thenReturn(true); samplePriorityDeterminingSpanInterceptor.addPreInterceptor(new PreExecutionSpanInterceptor() { @Override public void interceptReport(PreExecutionInterceptorContext context) { context.shouldNotReport(getClass()); } }); requestMonitor.monitor(new MonitoredMethodRequest(configuration, "testSetSamplePrioInPreInterceptor", () -> { })); assertThat(mockTracer.finishedSpans()).hasSize(1); assertThat(mockTracer.finishedSpans().get(0).tags()).containsEntry(Tags.SAMPLING_PRIORITY.getKey(), 0); }