This post is part of the Zero To Hero series for #ServerlessSeptember, a month-long initiative to learn, use, and celebrate, all things Serverless On Azure. Check out the main site at https://aka.ms/serverless-september to read other posts, participate in a Cloud Skills Challenge, explore a Serverless Hack and participate in live Q&A with product teams on #AskTheExpert
When you’re running a function app, you want to be prepared for any issues that may arise, from 4xx errors to trigger failures. Azure Functions offers built-in integration with Azure Application Insights to monitor function executions. You can also leverage intelligent and interactive diagnostics in Azure Functions to identify and troubleshoot issues without extra configuration.
Monitoring your Azure Functions:
Azure Functions uses Application Insights to collect and analyze log data from individual function executions in your function app.
Application Insights collects log, performance, and error data. By automatically detecting performance anomalies and featuring powerful analytics tools, you can more easily diagnose issues and better understand how your functions are used. These tools are designed to help you continuously improve performance and usability of your functions. You can even use Application Insights during local function app project development.
Typically, you create an Application Insights instance when you create your function app. In this case, the instrumentation key required for the integration is already set as an application setting named APPINSIGHTS_INSTRUMENTATIONKEY. With Application Insights integration enabled, telemetry data is sent to your connected Application Insights instance. This data includes logs generated by the Functions host, traces written from your functions code, and performance data. In addition to data from your functions and the Functions host, you can also collect data from the Functions scale controller.
By default, the data collected from your function app is stored in Application Insights. In the Azure portal, Application Insights provides an extensive set of visualizations of your telemetry data. You can drill into error logs and query events and metrics. To learn more, including basic examples of how to view and query your collected data, see Analyze Azure Functions telemetry in Application Insights.
In addition to this, you can have a smoother debugging experience through log streaming. There are two ways to view a stream of log files being generated by your function executions.
Log streams can be viewed both in the portal and in most local development environments.
Learn how to configure monitoring for your Azure Functions. See Monitoring Azure Functions data reference for detailed information on the metrics and logs metrics created by Azure Functions.
In addition to this, Azure Functions uses Azure Monitor to monitor the health of your function apps. Azure Functions collects the same kinds of monitoring data as other Azure resources that are described in Azure Monitor data collection. See Monitoring Azure Functions data reference for detailed information on the metrics and logs metrics created by Azure Functions.
Troubleshooting your Azure Functions:
When you do run into issues with your function app, Azure Functions diagnostics points out what’s wrong. It guides you to the right information to troubleshoot and resolve the issue more easily and quickly.
Let’s explore how to use Azure Functions diagnostics to diagnose and solve common function app issues.
Bonus tip: Here are some general troubleshooting tips that you can follow if you find your Function App throwing Azure Functions Runtime unreachable error. Also be sure to check out the recommended best practices to ensure your Azure Functions are highly reliable. This article details some best practices for designing and deploying efficient function apps that remain healthy and perform well in a cloud-based environment.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.