Package io.opencensus.testing.export
Class TestHandler
- java.lang.Object
-
- io.opencensus.trace.export.SpanExporter.Handler
-
- io.opencensus.testing.export.TestHandler
-
public final class TestHandler extends SpanExporter.Handler
ASpanExporter.Handlerfor testing only.- Since:
- 0.9
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.Objectmonitorprivate java.util.List<SpanData>spanDataList
-
Constructor Summary
Constructors Constructor Description TestHandler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidexport(java.util.Collection<SpanData> spanDataList)Exports a list of sampled (seeTraceOptions.isSampled())Spans using the immutable representationSpanData.java.util.List<SpanData>waitForExport(int numberOfSpans)Waits until we received numberOfSpans spans to export.
-
-
-
Field Detail
-
monitor
private final java.lang.Object monitor
-
spanDataList
private final java.util.List<SpanData> spanDataList
-
-
Method Detail
-
export
public void export(java.util.Collection<SpanData> spanDataList)
Description copied from class:SpanExporter.HandlerExports a list of sampled (seeTraceOptions.isSampled())Spans using the immutable representationSpanData.This may be called from a different thread than the one that called
Span.end().Implementation SHOULD not block the calling thread. It should execute the export on a different thread if possible.
- Specified by:
exportin classSpanExporter.Handler- Parameters:
spanDataList- a list ofSpanDataobjects to be exported.
-
waitForExport
@Nullable public java.util.List<SpanData> waitForExport(int numberOfSpans)
Waits until we received numberOfSpans spans to export. Returns the list of exportedSpanDataobjects, otherwisenullif the current thread is interrupted.- Parameters:
numberOfSpans- the number of minimum spans to be collected.- Returns:
- the list of exported
SpanDataobjects, otherwisenullif the current thread is interrupted. - Since:
- 0.9
-
-