Monitoring Azure Functions with Azure Monitor Application Insights
Azure Functions offers built-in integration with Azure Application Insights to monitor functions. For languages other than .NET and .NETCore additional language-specific workers/extensions are needed to get the full benefits of distributed tracing.
Application Insights collects log, performance, and error data, and automatically detects performance anomalies. Application Insights includes powerful analytics tools to help you diagnose issues and to understand how your functions are used. When you have the visibility into your application data, you can continuously improve performance and usability. You can even use Application Insights during local function app project development.
The required Application Insights instrumentation is built into Azure Functions. The only thing you need is a valid instrumentation key to connect your function app to an Application Insights resource. The instrumentation key should be added to your application settings when your function app resource is created in Azure. If your function app doesn't already have this key, you can set it manually. For more information read more about monitoring Azure Functions.
For a complete list of supported auto-instrumentation scenarios, see Supported environments, languages, and resource providers.
On March 31, 2025, support for instrumentation key ingestion will end. Instrumentation key ingestion will continue to work, but we'll no longer provide updates or support for the feature. Transition to connection strings to take advantage of new capabilities.
Distributed tracing for Java applications (public preview)
This feature is currently in public preview for Java Azure Functions both Windows and Linux
If your applications are written in Java you can view richer data from your functions applications, including requests, dependencies, logs, and metrics. The additional data also lets you see and diagnose end-to-end transactions and see the application map, which aggregates many transactions to show a topological view of how the systems interact, and what the average performance and error rates are.
The end-to-end diagnostics and the application map provide visibility into one single transaction/request. Together these two features are helpful for finding the root cause of reliability issues and performance bottlenecks on a per request basis.
How to enable distributed tracing for Java Function apps
Navigate to the functions app Overview pane and go to configurations. Under Application Settings, click "+ New application setting".
Add the following application settings with below values, then click Save on the upper left. DONE!
XDT_MicrosoftApplicationInsights_Java -> 1 ApplicationInsightsAgent_EXTENSION_VERSION -> ~2
This feature will have a cold start implication of 8-9 seconds in the Windows Consumption plan.
ApplicationInsightsAgent_EXTENSION_VERSION -> ~3
Sometimes the latest version of the Application Insights Java agent is not available in Azure Function - it takes a few months for the latest versions to roll out to all regions. In case you need the latest version of Java agent to monitor your app in Azure Function to use a specific version of Application Insights Java Auto-instrumentation Agent, you can upload the agent manually:
Please follow this instruction.
Test connectivity between your application host and the ingestion service
Application Insights SDKs and agents send telemetry to get ingested as REST calls to our ingestion endpoints. You can test connectivity from your web server or application host machine to the ingestion service endpoints by using raw REST clients from PowerShell or curl commands. See Troubleshoot missing application telemetry in Azure Monitor Application Insights.
Distributed tracing for Python Function apps
To collect custom telemetry from services such as Redis, Memcached, MongoDB, and more, you can use the OpenCensus Python Extension and log your telemetry. You can find the list of supported services here.