Define Filters for Method Recording

## Define Filters for Method Recording |

| On this tab of the filter settings, you define filter rules for packages and classes that will be applied to method call recording.

| There are two types of filter rules: Included packages or classes are profiled and will be shown in the call tree. If the first filter is inclusive, no classes are profiled by default. Excluded packages or classes are not profiled and will not be shown in the call tree. If the first filter is exclusive, all other classes are profiled by default. All calls from profiled classes are shown in the call tree regardless of whether the called class is profiled or not. For example, if you only have one inclusive filter for the `com.mycorp.` packages, and if your class `com.mycorp.MyClass` calls a method in java core classes, all those calls will be measured, but their internal call structure will not be resolved. In the call tree view, such method calls are opaque and will be labeled with a red corner. Package filters include all sub-packages. For example, if you have one inclusive filter with the name `com.mycorp.`, it includes all classes directly in the `com.mycorp.` package as well as the `com.mycorp.test` and the `com.mycorp.test.detail` packages. Filter rules are evaluated from top to bottom, the last matching rule is applied. For example, if you add an exclusive filter for the `com.mycorp.` packages, but further down add an inclusive filter for the `com.mycorp.test` package, the `com.mycorp.test` package is profiled while other classes in the `com.mycorp.` packages are not.

| When clicking on the [Add] button, you also get the option to select filters in a package browser. The package browser shows packages for Classes from the configured class path if the application is not running yet. Since the class path may not be configured for some session types, the package tree may be empty. Loaded classes that can be instrumented if the application is already running. This includes attach sessions where the profiling agent is not waiting for a connection on startup. Next to each package node, the cumulated number of contained classes is displayed. The total number of classes that will be included or excluded through your selection is indicated at the bottom of the dialog.

| Adjacent filter rules of the same type can be grouped together. Just select all filters that you wish to group and select the appropriate action from the context menu. You are then prompted to name the group. The name of a filter group is only informational. The context menu also offers an action to ungroup selected groups. Filter rules in filter groups are sorted alphabetically, have a gray background and cannot be moved. However,they can be deleted from the filter group. To add a new filter rule to an existing filter group, you first have to ungroup the group and group it again.

| By default, the filter rules are configured to exclude a list of common framework classes. All other classes are included. Whenever you find that the default list is not suitable, or if you would like to profile classes that are in that list, you should delete the entire exclude group and add your own inclusive filters. Alternatively, you can delete parts of the default exclude group. If, at any later point, you wish to restore these default exludes, you can use the reset filters to default button on the right side. All current filter settings will be lost in that case.

| To analyze the overall filter configuration, you can click on [Show filter tree] and bring up a dialog that shows you all filter rules in a read-only package hierarchy.

| Filter configurations can be saved to filter templates with the save button, the open button lets you replace the current filter configuration with a filter template. On the session defaults tab of the general settings dialog you can change the default filter template used for new sessions.

| You can quickly bring up this tab by clicking on the [Global filters] button that is shown in the bottom right corner of views that show call trees or time measurements of method calls.