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.
AzureMonitorSpanExporter
is old one and not supported/developed now. It is moved fromhttps://github.com/microsoft/opentelemetry-azure-monitor-python to https://github.com/Azure/azure-sdk-for-python . You should be using AzureMonitorTraceExporter
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.