Code filtering

You can use the code filtering feature of APM to control which methods appear in your traces.

This feature is useful because it helps to filter out unwanted data from captured traces, e.g. short running but frequently called helper functions which are already performant, but clog up captured trace data due to being regularly called.

Exclude items


Each exclusion is applied using a starts with match and should not include any wildcard characters.

For example, given a method in .NET code with a signature of Raygun.Utilities.Foo(), the following rules will match:

  • Raygun.
  • Raygun.Utilities
  • Raygun.Utilities::Foo

Given the method Raygun.Utilities.Bar() and the same rules from above, only the first two rules would match as the method signature starts with a matching value.

Rules are case-sensitive, so Raygun.Utilities::foo will not exclude the method Foo().

note: Once you've excluded an item, it can take up to 10 minutes to be updated on your servers and will only take effect when the application being profiled is next restarted.


Including is useful if you want to prevent methods from being excluded.

For example, it might be convenient to exclude the whole Foo namespace, but you're interested in one of the methods from that namespace. In that case, just switch to the "Include" tab of code filtering, and add the method you want to see.

Include items using the same syntax used to exclude items.


.NET methods can be filtered using the pattern Namespace.Class::MethodName

Examples:

  • Foo. matches all methods from the Foo namespace.
  • Foo.Bar:: matches all methods from the Bar class.
  • Foo.Bar::Baz matches the Baz method.

Ruby methods can be filtered using the pattern Namespace::Class#MethodName

Examples:

  • Foo matches anything that starts with Foo such as Foo::Bar#baz and Foo#baz
  • Foo:: matches anything from the namespace Foo such as Foo::Bar#baz, but not Foo#baz
  • Foo::Bar# matches anything that starts with Foo::Bar AND is a method.

Node functions can be filtered using the pattern path:functionName. The path can either be absolute, or relative to the root of your application.

Examples:

  • node_modules matches the entire node_modules directory.
  • app/bar.js matches all functions from the bar.js file.
  • app/bar.js:foo matches the foo function.

You can filter Node internals by prefixing the path with an exclamation mark, for example: !events.js


Real time insignificant code filtering is a feature that was introduced in version 1.0.1087 and is enabled by default.

This feature analyzes traces from your application for frequently called insignificant methods and adds them to a live exclusion list stored on the server. Items added to this list are applied immediately and don't require the application to be restarted.

To view the list of automatically excluded methods, in Windows, open the file %ProgramData%\Raygun\\AgentSettings\agent-configuration.json.

This file contains a section for each enabled application and within each application section is an array called LiveBlacklists. If you want a specific method to be exempt from exclusion then locate the entry in this list and change the "Enabled" value to false. Save the file when done and restart the relevant application. We don't recommend you remove items from this list as they may be automatically added back in by the agent process.

"LiveBlacklists":
[
  {
    "ClassMethodName": "Raygun.Common.Base36::Encode",
    "Enabled": true
  }
]

Automatic filtering can be disabled completely or adjusted using configuration settings in the Agent configuration file located at %ProgramFiles(x86)%\Raygun\RaygunAgent\RaygunAgent.exe.config.

Add a new element to the <appSettings> section like <add key="" value=""/>. The following configuration keys can be added to control the live filtering feature.

  • LiveBlacklistingEnabled - Set to false to disable the feature (Defaults to true).
  • QuickMethodDurationMicroseconds - A value in microseconds to consider as an insignificant method eligible for live filtering. (Defaults to 100)
  • QuickMethodCounter - The minimum number of times a method must be called in a single trace to be considered for live filtering. (Defaults to 10)

By default, the feature is enabled and a method must be called at least 10 times where each call is less than 100 microseconds in duration.