Class TimeLimitedHandler
java.lang.Object
io.opencensus.trace.export.SpanExporter.Handler
io.opencensus.exporter.trace.util.TimeLimitedHandler
An abstract class that allows different tracing services to export recorded data for sampled
spans in their own format within a given time frame. If export does not complete within the time
frame, spans will be dropped and no retries will be performed.
Only extend this class if the client APIs don't support timeout natively. If there is a timeout option in the client APIs (for example Stackdriver Trace V2 API allows you to set timeout), use that instead.
To export data this MUST be register to to the ExportComponent using SpanExporter.registerHandler(String, Handler)
.
- Since:
- 0.22
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
TimeLimitedHandler
(Duration deadline, String exportSpanName) -
Method Summary
Modifier and TypeMethodDescriptionvoid
export
(Collection<SpanData> spanDataList) Exports a list of sampled (seeTraceOptions.isSampled()
)Span
s using the immutable representationSpanData
.private static void
handleException
(Exception e, String logMessage) private Scope
abstract void
timeLimitedExport
(Collection<SpanData> spanDataList) Exports a list of sampled (seeTraceOptions.isSampled()
)Span
s using the immutable representationSpanData
, within the givendeadline
of thisTimeLimitedHandler
.
-
Field Details
-
logger
-
tracer
-
lowProbabilitySampler
-
deadline
-
exportSpanName
-
-
Constructor Details
-
TimeLimitedHandler
-
-
Method Details
-
timeLimitedExport
Exports a list of sampled (seeTraceOptions.isSampled()
)Span
s using the immutable representationSpanData
, within the givendeadline
of thisTimeLimitedHandler
.- Parameters:
spanDataList
- a list ofSpanData
objects to be exported.- Throws:
Exception
- throws exception when failed to export.- Since:
- 0.22
-
export
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.
-
newExportScope
-
handleException
-