Class SpanExporterImpl
- java.lang.Object
-
- io.opencensus.trace.export.SpanExporter
-
- io.opencensus.implcore.trace.export.SpanExporterImpl
-
public final class SpanExporterImpl extends SpanExporter
Implementation of theSpanExporter
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
SpanExporterImpl.ReportDroppedSpans
private static class
SpanExporterImpl.ReportPushedSpans
private static class
SpanExporterImpl.ReportReferencedSpans
private static class
SpanExporterImpl.Worker
-
Nested classes/interfaces inherited from class io.opencensus.trace.export.SpanExporter
SpanExporter.Handler
-
-
Field Summary
Fields Modifier and Type Field Description private static DerivedLongCumulative
droppedSpans
private static java.util.logging.Logger
logger
private static DerivedLongCumulative
pushedSpans
private static DerivedLongGauge
referencedSpans
private SpanExporterImpl.Worker
worker
private java.lang.Thread
workerThread
-
Constructor Summary
Constructors Modifier Constructor Description private
SpanExporterImpl(SpanExporterImpl.Worker worker)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addSpan(RecordEventsSpanImpl span)
Adds a Span to the exporting service.(package private) static SpanExporterImpl
create(int bufferSize, Duration scheduleDelay)
Constructs aSpanExporterImpl
that exports theSpanData
asynchronously.(package private) void
flush()
(package private) long
getDroppedSpans()
(package private) long
getPushedSpans()
(package private) long
getReferencedSpans()
(package private) java.lang.Thread
getServiceExporterThread()
void
registerHandler(java.lang.String name, SpanExporter.Handler handler)
Registers a new service handler that is used by the library to exportSpanData
for sampled spans (seeTraceOptions.isSampled()
).(package private) void
shutdown()
void
unregisterHandler(java.lang.String name)
Unregisters the service handler with the provided name.-
Methods inherited from class io.opencensus.trace.export.SpanExporter
getNoopSpanExporter
-
-
-
-
Field Detail
-
logger
private static final java.util.logging.Logger logger
-
droppedSpans
private static final DerivedLongCumulative droppedSpans
-
pushedSpans
private static final DerivedLongCumulative pushedSpans
-
referencedSpans
private static final DerivedLongGauge referencedSpans
-
worker
private final SpanExporterImpl.Worker worker
-
workerThread
private final java.lang.Thread workerThread
-
-
Constructor Detail
-
SpanExporterImpl
private SpanExporterImpl(SpanExporterImpl.Worker worker)
-
-
Method Detail
-
create
static SpanExporterImpl create(int bufferSize, Duration scheduleDelay)
Constructs aSpanExporterImpl
that exports theSpanData
asynchronously.Starts a separate thread that wakes up every
scheduleDelay
and exports any available spans data. If the number of buffered SpanData objects is greater thanbufferSize
then the thread wakes up sooner.- Parameters:
bufferSize
- the size of the buffered span data.scheduleDelay
- the maximum delay.
-
addSpan
public void addSpan(RecordEventsSpanImpl span)
Adds a Span to the exporting service.- Parameters:
span
- theSpan
to be added.
-
registerHandler
public void registerHandler(java.lang.String name, SpanExporter.Handler handler)
Description copied from class:SpanExporter
Registers a new service handler that is used by the library to exportSpanData
for sampled spans (seeTraceOptions.isSampled()
).- Specified by:
registerHandler
in classSpanExporter
- Parameters:
name
- the name of the service handler. Must be unique for each service.handler
- the service handler that is called for each ended sampled span.
-
unregisterHandler
public void unregisterHandler(java.lang.String name)
Description copied from class:SpanExporter
Unregisters the service handler with the provided name.- Specified by:
unregisterHandler
in classSpanExporter
- Parameters:
name
- the name of the service handler that will be unregistered.
-
flush
void flush()
-
shutdown
void shutdown()
-
getServiceExporterThread
java.lang.Thread getServiceExporterThread()
-
getDroppedSpans
long getDroppedSpans()
-
getReferencedSpans
long getReferencedSpans()
-
getPushedSpans
long getPushedSpans()
-
-