Stackify is now BMC. Read theBlog

Announcing: Retrace for Azure Functions preview

By: Alexandra
  |  July 11, 2017

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.

Installation

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:

Function App Settings

Stackify.ApiKey=[your key]

COR_ENABLE_PROFILING=1

COR_PROFILER={de70e25c-02b5-4556-a837-8aa6fe502668}

And one of the following, depending on if you are running the app in 32 or 64 bit mode:

 

COR_PROFILER_PATH=D:\home\Stackify\Profiler\v4.0.6.2\x86\StackifyProfiler_x86.dll

Or

COR_PROFILER_PATH=D:\home\Stackify\Profiler\v4.0.6.2\x64\StackifyProfiler_x64.dll

 

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.

 

  1. Add nuget package:

    Install-Package StackifyLib -Version 2.0.0-beta2 -Pre

 

  1. Add the following as the first line of code in the Function:

    StackifyLib.Utils.AsyncTracer.EnsureAsyncTracer();

     

     

  2. 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.

Retrace Dashboard
Retrace Dashboard

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.

Retrace Azure Functions
Retrace Azure Functions

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.

Improve Your Code with Retrace APM

Stackify's APM tools are used by thousands of .NET, Java, PHP, Node.js, Python, & Ruby developers all over the world.
Explore Retrace's product features to learn more.

Learn More

Want to contribute to the Stackify blog?

If you would like to be a guest contributor to the Stackify blog please reach out to [email protected]