Querying Python Transactions and Spans as dependencies in Azure Application Insights with OpenCensus
Azure Application Insights is my go-to Observability platform when I want it to "just work". Application Insights can be a collection point for custom and third-party library Python Tracing and Transaction data. You can easily send Python Open Census span data from anywhere in the world into Azure Application Insights. You see your program transaction details from any browser that can reach the Azure console.
OpenCensus spans are captured in Application Insights as dependencies. The OpenCensus Azure Exporter supports nested spans letting you capture and measure nested operations. Every captured span is stored as a row in the Application Insights dependencies table.The chart to the right was created from this sample code that has one main span and 4 nested sub-spans
From FreemanSoft SpeedTest project https://github.com/freemansoft/speedtest-app-insightsExecution pre-requisites
- You have an Azure login
- You have created an Azure Application Insights Application key https://docs.microsoft.com/en-us/azure/azure-monitor/app/create-new-resource
- You have pushed data to Application Insights. I used https://github.com/freemansoft/speedtest-app-insights , a project that generates metrics, dependencies, and traces
Video Walkthrough
Everything ends up in App Insights Logs.
- AppInsights --> Monitoring/Logs
- Close the popover wizard if it appears
- Enter 'dependencies' in the search term
- Select the time frame
- Run the Query
Nested Trace Details
There are a couple things that link the trace details together.
- All the items in a nested span share the same operationa_id. That same id is also the operation ParentId for the topmost span. Highlighted in purple.
- This particular trace has one parent span with 4 sub spans and no further nesting. The parentId field for each of the subs-pans has the same id as the outermost span. Highlighted in red
Finding transactions
The App Insights Transaction Search pane lets you locate Dependency events. These are the records from the dependencies table we queried above. It actually shows a couple record types but we want Dependency.
This view shows us we have data and when but doesn't show us any correlated information. This trace just picks up everything in the last 6 hours
Viewing as Nested Transactions
A nested set of operations is captured as linked dependency events as described above. We can drill into any span/event and visualize it and its nested or parent operations.
Here we see the overall timing for our speed check and the contribution to that time from each of the internal operations that were captured in their own spans.Additional Filtering by span/dependency
Additional Integrations
Related
- https://joe.blog.freemansoft.com/2022/11/querying-python-transactions-and-spans.html
- https://joe.blog.freemansoft.com/2021/03/querying-python-logs-azure-application.html
- https://joe.blog.freemansoft.com/2021/03/querying-python-metrics-custom-tags-as.html
- https://joe.blog.freemansoft.com/2021/03/displaying-python-metrics-in-azure.html
- https://joe.blog.freemansoft.com/2021/03/monitor-internet-broadband-service-with.html
Comments
Post a Comment