azure.monitor.opentelemetry.exporter package
- class azure.monitor.opentelemetry.exporter.ApplicationInsightsSampler(sampling_ratio: float = 1.0)[source]
Sampler that implements the same probability sampling algorithm as the ApplicationInsights SDKs.
- should_sample(parent_context: Context | None, trace_id: int, name: str, kind: SpanKind | None = None, attributes: Mapping[str, str | bool | int | float | Sequence[str] | Sequence[bool] | Sequence[int] | Sequence[float]] | None = None, links: Sequence[Link] | None = None, trace_state: TraceState | None = None) SamplingResult [source]
- class azure.monitor.opentelemetry.exporter.AzureMonitorLogExporter(**kwargs: Any)[source]
Azure Monitor Log exporter for OpenTelemetry.
Azure Monitor base exporter for OpenTelemetry.
- Keyword Arguments:
api_version (str) – The service API version used. Defaults to latest.
connection_string (str) – The connection string used for your Application Insights resource.
credential (ManagedIdentityCredential/ClientSecretCredential) – Token credential, such as ManagedIdentityCredential or ClientSecretCredential, used for Azure Active Directory (AAD) authentication. Defaults to None.
disable_offline_storage (bool) – 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-<your-instrumentation-key>.
- Return type:
None
- classmethod from_connection_string(conn_str: str, **kwargs: Any) AzureMonitorLogExporter [source]
Create an AzureMonitorLogExporter 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.
- class azure.monitor.opentelemetry.exporter.AzureMonitorMetricExporter(**kwargs: Any)[source]
Azure Monitor Metric exporter for OpenTelemetry.
Azure Monitor base exporter for OpenTelemetry.
- Keyword Arguments:
api_version (str) – The service API version used. Defaults to latest.
connection_string (str) – The connection string used for your Application Insights resource.
credential (ManagedIdentityCredential/ClientSecretCredential) – Token credential, such as ManagedIdentityCredential or ClientSecretCredential, used for Azure Active Directory (AAD) authentication. Defaults to None.
disable_offline_storage (bool) – 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-<your-instrumentation-key>.
- Return type:
None
- classmethod from_connection_string(conn_str: str, **kwargs: Any) AzureMonitorMetricExporter [source]
Create an AzureMonitorMetricExporter 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.
- export(metrics_data: MetricsData, timeout_millis: float = 10000, **kwargs: Any) MetricExportResult [source]
Exports a batch of metric data
- Parameters:
metrics_data (Sequence[MetricsData]) – OpenTelemetry Metric(s) to export.
timeout_millis (float) – The maximum amount of time to wait for each export. Not currently used.
- Returns:
The result of the export.
- Return type:
MetricExportResult
- class azure.monitor.opentelemetry.exporter.AzureMonitorTraceExporter(**kwargs: Any)[source]
Azure Monitor Trace exporter for OpenTelemetry.
Azure Monitor base exporter for OpenTelemetry.
- Keyword Arguments:
api_version (str) – The service API version used. Defaults to latest.
connection_string (str) – The connection string used for your Application Insights resource.
credential (ManagedIdentityCredential/ClientSecretCredential) – Token credential, such as ManagedIdentityCredential or ClientSecretCredential, used for Azure Active Directory (AAD) authentication. Defaults to None.
disable_offline_storage (bool) – 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-<your-instrumentation-key>.
- Return type:
None
- classmethod from_connection_string(conn_str: str, **kwargs: Any) AzureMonitorTraceExporter [source]
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.
- export(spans: Sequence[ReadableSpan], **kwargs: Any) SpanExportResult [source]
Export span data.
- Parameters:
spans (Sequence[Span]) – Open Telemetry Spans to export.
- Returns:
The result of the export.
- Return type:
SpanExportResult