Help Docs

Custom Instrumentation via .NET agent API

Site24x7's .NET agent API allows you to track application methods in your .NET application. You can monitor the performance of your application methods or a block of code by including the agent API inside the methods or classes that need to be monitored.


This will be supported from the agent version 5.6.0

Follow the below-given instructions to instrument.

Installation Instructions:

  1. Install APM Insight .NET agent or APM Insight .NET Core agent based on your application environment.
  2. Download or reference the package Site24x7.Agent.Api from the NuGet package manager to your application project.
    Note: The API has a class named Site24x7.Agent.Api  to track the performance of the application code. 
  3. You can use the using block to create an instance of the class Site24x7.Agent.Api  like Site24x7.Agent.Api(object thisObject, string methodName, string componentName).

Parameter Name



The this object  that is used to get the name of the current object type.


The name  of the method that is displayed in trace details.


The name  of the component that determines the action or service.


The following method illustrates how to add a snippet:

public int YourMethod(string param1, string param2, bool param3)
          using (var api = new Site24x7.Agent.Api(this, "YourMethodName", "YourComponentName"))
                    //Your application code goes here..


public int ConvertToRupee(string param1, string param2, bool param3)
         using (var api = new Site24x7.Agent.Api(this, "ConvertToRupee", "CONVERTER"))
                   // Your application code goes here

The execution time of the code inside the using block will be calculated and displayed under the method name ConvertToRupee.

Before instrumentation:

After instrumentation:

Was this document helpful?

Would you like to help us improve our documents? Tell us what you think we could do better.

We're sorry to hear that you're not satisfied with the document. We'd love to learn what we could do to improve the experience.

Thanks for taking the time to share your feedback. We'll use your feedback to improve our online help resources.

Shortlink has been copied!