Reputation: 9454
I'm quite new to Azure and OTEL, and currently exploring the options of integrating Open Telemetry with Application Insights in Azure.
I was able to push traces using the AzureMonitorTraceExporter
and I did see them appearing under the Performances
in App Insights.
But I'm struggling to send OTEL metrics to Insights. For example, I need to calculate how long did a function took to complete execution, how much memory did it take etc and send those metrics to Application Insights. After sending them to App Insights, from which table can I query those?
I tried searching for this online, but couldn't find any. Any help could be appreciated.
Upvotes: 0
Views: 876
Reputation: 11393
I need to calculate how long did a function took to complete execution, how much memory did it take
I have used pip install azure-monitor-opentelemetry
and configure_azure_monitor
started working for me, before it didn't worked.
By using AzureMonitorTraceExporter
, you can send logs but duration is not calculated, only the logs are exported to traces .
For those details you can create Dependency Logs using configure_azure_monitor
as below and followed Microsoft_Document:
from azure.monitor.opentelemetry import configure_azure_monitor
from opentelemetry import trace
configure_azure_monitor(connection_string="InstrumentationKey=b641cafc-00;IngestionEndpoint=https://eastus-8.in.applicationinsights.azure.com/;LiveEndpoint=https://eastus.livediagnostics.monitor.azure.com/;ApplicationId=2e73")
ri_tr = trace.get_tracer(__name__)
with ri_tr.start_as_current_span("Rithwik Bojja") as rith:
rith.set_attribute("Id", "007")
rith.set_attribute("Test ", "testing")
print("Hello Rithwik, Dependency Logged")
Output:
Here you can duration and all:
Upvotes: 0