'What is the difference between AzureMonitorTraceExporter and AzureMonitorSpanExporter?

from azure.core.settings import settings
from azure.core.tracing.ext.opentelemetry_span import OpenTelemetrySpan
settings.tracing_implementation = OpenTelemetrySpan

from opentelemetry import trace
from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.sdk.trace.export import BatchSpanProcessor

I was trying to apply opentelemetry to monitor a Azure Function App. And I found there are two ways to configure export: AzureMonitorTraceExporter and AzureMonitorSpanExporter. What is the difference between them?

from  azure.monitor.opentelemetry.exporter  import  AzureMonitorTraceExporter
app_insights_key = os.getenv('APPINSIGHTS_INSTRUMENTATIONKEY_String')
exporter = AzureMonitorTraceExporter.from_connection_string(app_insights_key)

and

from azure_monitor import AzureMonitorSpanExporter
app_insights_key = os.getenv('APPINSIGHTS_INSTRUMENTATIONKEY')
exporter = AzureMonitorSpanExporter(instrumentation_key=app_insights_key)

And which way is better for a Azure Function App? Thanks.



Solution 1:[1]

AzureMonitorSpanExporter is old one and not supported/developed now. It is moved from https://github.com/microsoft/opentelemetry-azure-monitor-python to https://github.com/Azure/azure-sdk-for-python. You should be using AzureMonitorTraceExporter.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Srikanth Chekuri