Have you had a chance yet to play with Azure Functions? Here at Stackify, we’re pretty excited about this capability on Azure and the promise that it holds for building rapidly scale-able event-based processing with little to no management overhead! We’ve also heard from a lot of you asking when Retrace would be able to support this new serverless architecture. After all, if it’s running mission-critical code, you want to be able to instrument it and keep an eye on it’s performance!
Today, we are excited to announce our support of Azure Functions in preview for Retrace. See below to get started.
Retrace for Azure Functions
Retrace is currently open for preview with Azure Functions in App Service Plan mode only. Retrace does not work in “Consumption Plan” mode currently. We are partnering with Microsoft on how to work with it in the future, and will provide updates to this documentation when more information becomes available.
You can learn more about the Consumption and App Service plans here
How it Works
Retrace works essentially the same for Azure Functions as it does for Azure App Services. The Retrace .NET Profiler is enabled for your application to do lightweight profiling. We also run a Retrace agent as a Web Job to collect the data.
Step 1: Install the Site Extension
This is done just like it is for normal App Services with Retrace. For Function Apps, select your app and then go to Platform Features -> Extensions -> Add -> Select the Stackify APM or Retrace extension.
Step 2: Set your API Key & Profiling Variables
Within your Function App, go to Platform Features -> Application Settings
Under “App settings” add these 4 settings:
And one of the following, depending on if you are running the app in 32 or 64 bit mode:
Note: For normal App Services, we don’t require setting the 3 “COR_” settings. We are working with the Microsoft team currently to see if we can simplify this.
Step 3: Optionally Enable Async support
If your code is using async/await then you will also need to add a nuget package and one line of code to your function to enable our async tracking. We are working to simplify this for future releases, check this document periodically for updates.
- Add nuget package:
Install-Package StackifyLib -Version 2.0.0-beta2 -Pre
- Add the following as the first line of code in the Function:
- Deploy your Function
Using Retrace for Azure Functions
During this preview period, your Azure Functions will appear on the Retrace Dashboard as a “Web App” and has all of the same features as Azure App Services.
As we near production-ready release, a new Application Type will be added to the dashboard to group Azure Functions distinctly from Web Apps.
Code Level Tracing
One of the best features of Retrace is the amazing code level view it provides. Retrace is the only solution available that provides this for Azure Functions!
With Retrace you can see the SQL queries, external HTTP calls and much, much more.
Tips and Recommendations
Retrace will treat Azure Functions as a transaction, similar to a web application or a Retrace Tracked Function. It supports all of the same dependencies and will provide all of the same great insights to application performance as it does for web applications and windows service.