65.9K
CodeProject is changing. Read more.
Home

Add tags to Azure functions - Application Insights

starIconstarIconstarIconstarIconstarIcon

5.00/5 (1 vote)

Feb 7, 2021

CPOL
viewsIcon

5680

Adding diagnostic tags to your functions for debugging

Adding the Tag in Your Function

To add the tag in your Azure function, you need to add a reference to System.Diagnostics and then call Activity.Current.AddTag to add your tag in the application insights log.

For example, a function that has a property "Account Number" could add this to the log thus:

#region Tracing telemetry
   Activity.Current.AddTag("Account Number", accountnumber);
#endregion

Querying the Tag

In your application insights query, you can use the customDimension function to access your custom tag.

History

  • 7th February, 2021: First version