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.Handler
for testing only.- Since:
- 0.9
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.Object
monitor
private java.util.List<SpanData>
spanDataList
-
Constructor Summary
Constructors Constructor Description TestHandler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
export(java.util.Collection<SpanData> spanDataList)
Exports a list of sampled (seeTraceOptions.isSampled()
)Span
s 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.Handler
Exports a list of sampled (seeTraceOptions.isSampled()
)Span
s 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:
export
in classSpanExporter.Handler
- Parameters:
spanDataList
- a list ofSpanData
objects 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 exportedSpanData
objects, otherwisenull
if the current thread is interrupted.- Parameters:
numberOfSpans
- the number of minimum spans to be collected.- Returns:
- the list of exported
SpanData
objects, otherwisenull
if the current thread is interrupted. - Since:
- 0.9
-
-