URL による XHR コールのフィルタリング
モニターする必要がないページから(XMLHttpRequest または Fetch API を使用した)多数の XHR コールがある場合は、エージェントが指定されたコールの正規表現リストのみをモニターするように、XHR フィルタを使用できます。
XHR コールがモニターされると、XHR コールの絶対パスが JavaScript エージェントに提供されます。コントローラ UI では、これらのモニター対象の XHR コールは、命名規則によって構成されたとおりに表示されます。命名規則がない場合は、XHR コールの絶対パスが表示されます。
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 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 only use the urls array, the matched URLs will be either included or excluded for all HTTP methods. If you only 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:
{
urls:
[
{
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.
<head>
<script type='text/javascript' charset='UTF-8'>
(function(config){
(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>
<script src='//cdn.appdynamics.com/adrum/adrum-latest.js' type='text/javascript' charset='UTF-8'></script>
...
</head>