AzureMonitorTraceExporter 和 AzureMonitorSpanExporter 有什么区别?

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

我正在尝试应用 opentelemetry 来监视 Azure Function App。我发现有两种配置导出的方法:AzureMonitorTraceExporter 和 AzureMonitorSpanExporter。 它们有什么区别?

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

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

哪种方式更适合 Azure Function App?谢谢

AzureMonitorSpanExporter 是旧的,而不是现在的 supported/developed。它是从 https://github.com/microsoft/opentelemetry-azure-monitor-python to https://github.com/Azure/azure-sdk-for-python 移来的。你应该使用 AzureMonitorTraceExporter.