Skip to end of metadata
Go to start of metadata

On this page:

Related pages:

Your Rating:
1 Star2 Star3 Star4 Star5 Star
17 rates

If you have many XHR calls (using XMLHttpRequest or the Fetch API) from your page that you do not need to monitor, you can use XHR filters to limit the agent, so that it monitors only a regex-defined list of specified calls. 

When XHR calls are monitored, the absolute path of the XHR calls is provided to the JavaScript Agent. In the Controller UI, those monitored XHR calls will be displayed as configured by naming rules. If there are no naming rules, however, the absolute path of the XHR call will be displayed.

XHR Filters 

You can use the XHR filters below to include or exclude XHR calls. The filters can be in the form of an XHR filter object or an array of XHR filter objects.

  • xhr.include

  • xhr.exclude 

Filter Object Structure

The XHR filter object has the two properties urls and method. The urls property is an array of objects containing a pattern property that specifies a regular expression for matching URLs. The method property is a string that specifies an HTTP method. You can use one or both of the properties. If you just use the urls array, the matched URLs will be either included or excluded for all HTTP methods. If you just specify method, all calls using the specified HTTP method will be either included or excluded.

The following is the general structure for the filter object:

          pattern: ".*foo.*"
          pattern: ".*bar.*"
    method: 'GET'

XHR Filter Example

To use XHR filters, you must assign XHR filters to xhr.include and xhr.exclude before you inject the adrum.js script. It's important to note that the exclude patterns override the include patterns, so those URLs that are matched by both the include and exclude patterns will ultimately be excluded.

For example, in the code snippet below, the include pattern would match all HTTP requests to http://somedomain/app_status/user-profile.jsp, but the exclude pattern would exclude POST calls to that URL.

    <script type='text/javascript' charset='UTF-8'>
            (function(xhr) {
                xhr.include = {
                    urls: [
                            pattern: ".*ajax_info.txt"
                            pattern: ".*app_status.*"
                xhr.exclude = {
                    urls = [
                            pattern: ".*user-profile.*"
                   method: "POST"
            })(config.xhr || (config.xhr = {}));
        })(window["adrum-config"] || (window["adrum-config"] = {}));
    <script src='//' type='text/javascript' charset='UTF-8'></script>