opentelemetry.sdk.trace.export¶
-
class
opentelemetry.sdk.trace.export.SpanExportResult[source]¶ Bases:
enum.EnumAn enumeration.
-
SUCCESS= 0¶
-
FAILURE= 1¶
-
-
class
opentelemetry.sdk.trace.export.SpanExporter[source]¶ Bases:
objectInterface for exporting spans.
Interface to be implemented by services that want to export recorded in its own format.
To export data this MUST be registered to the :class`opentelemetry.sdk.trace.Tracer` using a
SimpleExportSpanProcessoror aBatchExportSpanProcessor.-
export(spans)[source]¶ Exports a batch of telemetry data.
- Parameters
spans (
Sequence[Span]) – The list ofopentelemetry.trace.Spanobjects to be exported- Return type
- Returns
The result of the export
-
-
class
opentelemetry.sdk.trace.export.SimpleExportSpanProcessor(span_exporter)[source]¶ Bases:
opentelemetry.sdk.trace.SpanProcessorSimple SpanProcessor implementation.
SimpleExportSpanProcessor is an implementation of
SpanProcessorthat passes ended spans directly to the configuredSpanExporter.-
on_start(span)[source]¶ Called when a
opentelemetry.trace.Spanis started.This method is called synchronously on the thread that starts the span, therefore it should not block or throw an exception.
- Parameters
span (
Span) – Theopentelemetry.trace.Spanthat just started.- Return type
None
-
on_end(span)[source]¶ Called when a
opentelemetry.trace.Spanis ended.This method is called synchronously on the thread that ends the span, therefore it should not block or throw an exception.
- Parameters
span (
Span) – Theopentelemetry.trace.Spanthat just ended.- Return type
None
-
shutdown()[source]¶ Called when a
opentelemetry.sdk.trace.Traceris shutdown.- Return type
None
-
-
class
opentelemetry.sdk.trace.export.BatchExportSpanProcessor(span_exporter, max_queue_size=2048, schedule_delay_millis=5000, max_export_batch_size=512)[source]¶ Bases:
opentelemetry.sdk.trace.SpanProcessorBatch span processor implementation.
BatchExportSpanProcessor is an implementation of
SpanProcessorthat batches ended spans and pushes them to the configuredSpanExporter.-
on_start(span)[source]¶ Called when a
opentelemetry.trace.Spanis started.This method is called synchronously on the thread that starts the span, therefore it should not block or throw an exception.
- Parameters
span (
Span) – Theopentelemetry.trace.Spanthat just started.- Return type
None
-
on_end(span)[source]¶ Called when a
opentelemetry.trace.Spanis ended.This method is called synchronously on the thread that ends the span, therefore it should not block or throw an exception.
- Parameters
span (
Span) – Theopentelemetry.trace.Spanthat just ended.- Return type
None
-
force_flush(timeout_millis=30000)[source]¶ Export all ended spans to the configured Exporter that have not yet been exported.
- Parameters
timeout_millis (
int) – The maximum amount of time to wait for spans to be exported.- Return type
bool- Returns
False if the timeout is exceeded, True otherwise.
-
shutdown()[source]¶ Called when a
opentelemetry.sdk.trace.Traceris shutdown.- Return type
None
-
-
class
opentelemetry.sdk.trace.export.ConsoleSpanExporter(out=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>, formatter=<function ConsoleSpanExporter.<lambda>>)[source]¶ Bases:
opentelemetry.sdk.trace.export.SpanExporterImplementation of
SpanExporterthat prints spans to the console.This class can be used for diagnostic purposes. It prints the exported spans to the console STDOUT.
-
export(spans)[source]¶ Exports a batch of telemetry data.
- Parameters
spans (
Sequence[Span]) – The list ofopentelemetry.trace.Spanobjects to be exported- Return type
- Returns
The result of the export
-