Support & Documentation
Follow

Configuring Custom Profiling for .NET

By default, the Stackify .NET APM+ Profiler only instruments key, pre-defined events in the IIS pipeline and page lifecycle. One of the key benefits of the profiler, however, is that you may instrument how long any .NET method takes to execute and include that output in the call stack.

In deciding what to profile, keep in mind the overhead that could be incurred. For example, if you choose to use a wildcard configuration as described below, all .NET properties that have Get and Set accessors (which includes dynamic properties) will be profiled via these accessors, and can be quite “chatty.”

Advanced Custom Configuration

Note: This section describes how to customize the Stackify .NET Profiler to add instrumentation. Any changes made to the configuration file must be formatted properly at the risk of causing instability. 

To add custom configuration:

  • Create a configuration file named ProfileClientConfig.txt per the format described below.
  • Save to your installation folder ([Install Drive]:\Program Files (x86)\Stackify\ProfileClientConfig.txt).

In the ProfileClientConfig.txt configuration file you created, you will need to create a JSON format document that allows you to specify methods you wish to profile. The document follows this format:

[{
	"Class": "MyNamespace.MyClass",
	"Method": "MyMethod"
},
{
	"Class": "MyNamespace.MyClass2",
	"Method": "MyMethod"
}
]

A wildcard of “*” may be used for both Class and Method properties. It is not recommended to use the wildcard character for a namespace, as that will key the profiler to instrument every single .NET method call. Please note that every tracked method adds overhead to your application and will slow it down slightly. Adding a few methods picked up per web request is no big deal, however, a wildcard for something like System.Data.* is a bad idea and could crash your application.

Valid options are:

[{
	"Class": "MyNamespace.MyClass",
	"Method": "*"
},
{
	"Class": "MyNamespace.*",
	"Method": "*"
}
]

Please ensure to follow proper JSON document formatting. Incorrect formatting will prevent the profiler from starting. Once the ProfileClientConfig.txt file is created, be sure to save the file and recycle the IIS application pool for your app.

A Couple of Notes

  • In some cases the encoding format needs to be changed to ANSI instead of .txt:
Open the file in notepad --> save as --> choose ANSI as the encoding
  • The process is the same for APM+ for Azure App Services, just be sure to include the ProfileClientConfig.txt file in the \bin folder when you deploy your app.
  • The process for APM+ for Azure WebJobs is to include the ProfileClientConfig.txt file in the same folder as the .exe that is being profiled.
For continuous web jobs:

D:\home\site\wwwroot\app_data\jobs\continuous\[MyWebJob]\ProfileClientConfig.txt

For triggered web jobs:
D:\home\site\wwwroot\app_data\jobs\triggered\[MyWebJob]\ProfileClientConfig.txt

Was this article helpful?
1 out of 1 found this helpful
Have more questions? Submit a request

Comments

Powered by Zendesk