AzureMonitorTraceExporter Class

Azure Monitor Trace exporter for OpenTelemetry.

Azure Monitor base exporter for OpenTelemetry.

Inheritance
azure.monitor.opentelemetry.exporter.export._base.BaseExporter
AzureMonitorTraceExporter
opentelemetry.sdk.trace.export.SpanExporter
AzureMonitorTraceExporter

Constructor

AzureMonitorTraceExporter(**kwargs: Any)

Keyword-Only Parameters

Name Description
api_version
str

The service API version used. Defaults to latest.

connection_string
str

The connection string used for your Application Insights resource.

credential
<xref:<xref:ManagedIdentityCredential/ClientSecretCredential>>

Token credential, such as ManagedIdentityCredential or ClientSecretCredential, used for Azure Active Directory (AAD) authentication. Defaults to None.

disable_offline_storage

Determines whether to disable storing failed telemetry records for retry. Defaults to False.

storage_directory
str

Storage path in which to store retry files. Defaults to <tempfile.gettempdir()>/opentelemetry-python-.

Methods

export

Export span data.

force_flush

Hint to ensure that the export of any spans the exporter has received prior to the call to ForceFlush SHOULD be completed as soon as possible, preferably before returning from this method.

from_connection_string

Create an AzureMonitorTraceExporter from a connection string. This is the recommended way of instantiation if a connection string is passed in explicitly. If a user wants to use a connection string provided by environment variable, the constructor of the exporter can be called directly.

shutdown

Shuts down the exporter.

Called when the SDK is shut down.

export

Export span data.

export(spans: Sequence[ReadableSpan], **kwargs: Any) -> SpanExportResult

Parameters

Name Description
spans
Required
Sequence[<xref:opentelemetry.trace.Span>]

Open Telemetry Spans to export.

Returns

Type Description
<xref:opentelemetry.sdk.trace.export.SpanExportResult>

The result of the export.

force_flush

Hint to ensure that the export of any spans the exporter has received prior to the call to ForceFlush SHOULD be completed as soon as possible, preferably before returning from this method.

force_flush(timeout_millis: int = 30000) -> bool

Parameters

Name Description
timeout_millis
default value: 30000

from_connection_string

Create an AzureMonitorTraceExporter from a connection string. This is the recommended way of instantiation if a connection string is passed in explicitly. If a user wants to use a connection string provided by environment variable, the constructor of the exporter can be called directly.

from_connection_string(conn_str: str, **kwargs: Any) -> AzureMonitorTraceExporter

Parameters

Name Description
conn_str
Required
str

The connection string to be used for authentication.

Keyword-Only Parameters

Name Description
api_version
str

The service API version used. Defaults to latest.

Returns

Type Description

an instance of ~AzureMonitorTraceExporter

shutdown

Shuts down the exporter.

Called when the SDK is shut down.

shutdown() -> None