use of io.opencensus.testing.export.TestHandler in project instrumentation-java by census-instrumentation.
the class TraceWebAsyncClientAutoConfigurationTest method setup.
@Before
public void setup() {
handler = new TestHandler();
SpanExporter exporter = Tracing.getExportComponent().getSpanExporter();
exporter.registerHandler("testing", handler);
TraceParams params = Tracing.getTraceConfig().getActiveTraceParams().toBuilder().setSampler(Samplers.alwaysSample()).build();
Tracing.getTraceConfig().updateActiveTraceParams(params);
}
use of io.opencensus.testing.export.TestHandler in project instrumentation-java by census-instrumentation.
the class HttpServletFilterIntegrationTests method setup.
@Before
@Override
public void setup() {
super.setup();
handler = new TestHandler();
SpanExporter exporter = Tracing.getExportComponent().getSpanExporter();
exporter.registerHandler("testing", handler);
TraceParams params = Tracing.getTraceConfig().getActiveTraceParams().toBuilder().setSampler(Samplers.alwaysSample()).build();
Tracing.getTraceConfig().updateActiveTraceParams(params);
}
use of io.opencensus.testing.export.TestHandler in project instrumentation-java by census-instrumentation.
the class SpanExporterImplTest method exportSpansToMultipleServices.
@Test
public void exportSpansToMultipleServices() {
SpanExporterImpl spanExporter = SpanExporterImpl.create(4, Duration.create(1, 0));
StartEndHandler startEndHandler = new StartEndHandlerImpl(spanExporter, runningSpanStore, sampledSpanStore, new SimpleEventQueue());
spanExporter.registerHandler("test.service", serviceHandler);
TestHandler serviceHandler2 = new TestHandler();
spanExporter.registerHandler("test.service2", serviceHandler2);
RecordEventsSpanImpl span1 = createSampledEndedSpan(startEndHandler, SPAN_NAME_1);
RecordEventsSpanImpl span2 = createSampledEndedSpan(startEndHandler, SPAN_NAME_2);
List<SpanData> exported1 = serviceHandler.waitForExport(2);
List<SpanData> exported2 = serviceHandler2.waitForExport(2);
assertThat(exported1).containsExactly(span1.toSpanData(), span2.toSpanData());
assertThat(exported2).containsExactly(span1.toSpanData(), span2.toSpanData());
}
use of io.opencensus.testing.export.TestHandler in project instrumentation-java by census-instrumentation.
the class CensusSpringAspectTest method setup.
@Before
public void setup() {
handler = new TestHandler();
SpanExporter exporter = Tracing.getExportComponent().getSpanExporter();
exporter.registerHandler("testing", handler);
TraceParams params = Tracing.getTraceConfig().getActiveTraceParams().toBuilder().setSampler(Samplers.alwaysSample()).build();
Tracing.getTraceConfig().updateActiveTraceParams(params);
}
Aggregations