Performance: Tracked Functions

Tracked Functions essentially allow you to track a sub-transaction or block of code within a larger transaction. For example, they can be implemented for tracking various Elasticsearch queries to uniquely identify them.

First you will need to add the StackifyLib dependency to your app:

PM> Install-Package StackifyLib

Once you have the StackifyLib installed you need to modify your code like shown:

var tracer = StackifyLib.ProfileTracer.CreateAsTrackedFunction("Name of Tracked Function"); 
tracer.Exec(() => 
    { 
        //Code to be tracked 
    });

Tracked functions will then show in Retrace in the App Dashboard under Performance(APM+) tab > Tracked Functions tab.

Once you see your Tracked Function in Retrace you can click into it and set this function as a Key Transaction which will allow you to create App monitors around it’s performance.

To learn more on when to implement Tracked Functions in your code, check out our blog post “How to Use Retrace Tracked Functions to Monitor Your Code” by our CEO & Founder, Matt Watson!