Родитель
99760cf557
Коммит
416e338549
24
README.md
24
README.md
|
@ -376,7 +376,6 @@ Most configuration fields are named such that they can be defaulted to falsey. A
|
|||
| enableAutoRouteTracking | boolean | false | Automatically track route changes in Single Page Applications (SPA). If true, each route change will send a new Pageview to Application Insights. Hash route changes changes (`example.com/foo#bar`) are also recorded as new page views.
|
||||
| enableRequestHeaderTracking | boolean | false | If true, AJAX & Fetch request headers is tracked, default is false. If ignoreHeaders is not configured, Authorization and X-API-Key headers are not logged.
|
||||
| enableResponseHeaderTracking | boolean | false | If true, AJAX & Fetch request's response headers is tracked, default is false. If ignoreHeaders is not configured, WWW-Authenticate header is not logged.
|
||||
| ignoreHeaders | string[] | ["Authorization", "X-API-Key", "WWW-Authenticate"] | AJAX & Fetch request and response headers to be ignored in log data. To override or discard the default, add an array with all headers to be excluded or an empty array to the configuration.
|
||||
| enableAjaxErrorStatusText | boolean | false | Default false. If true, include response error data text | boolean in dependency event on failed AJAX requests.
|
||||
| enableAjaxPerfTracking | boolean | false | Default false. Flag to enable looking up and including additional browser window.performance timings in the reported ajax (XHR and fetch) reported metrics.
|
||||
| maxAjaxPerfLookupAttempts | numeric | 3 | Defaults to 3. The maximum number of times to look for the window.performance timings (if available), this is required as not all browsers populate the window.performance before reporting the end of the XHR request and for fetch requests this is added after its complete.
|
||||
|
@ -398,6 +397,29 @@ Most configuration fields are named such that they can be defaulted to falsey. A
|
|||
| throttleMgrCfg <br/><sub>since 3.0.3</sub> | `{[key: number]: IThrottleMgrConfig}` | undefined | [Optional] Set throttle mgr configuration by key. |
|
||||
| retryCodes | number[] | undefined | Identifies the status codes that will cause event batches to be resent, when `null` or `undefined` the SDK will use it's defaults `[401, 408, 429, 500, 502, 503, 504]`. `403` was removed in version 3.1.1. |
|
||||
|
||||
### ExtensionConfig
|
||||
|
||||
`extensionConfig` should be initialized under the specific extension rather than being defined in the root configuration. This allows for more granular configuration tailored to each extension's needs.
|
||||
|
||||
For instance, to configure the dependencies plugin, you would initialize it as follows:
|
||||
|
||||
```js
|
||||
const appInsights = new ApplicationInsights({
|
||||
config: {
|
||||
connectionString: 'InstrumentationKey=YOUR_INSTRUMENTATION_KEY_GOES_HERE',
|
||||
extensionConfig: {
|
||||
[DependenciesPlugin.identifier]: {
|
||||
ignoreHeaders: []
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
| Name | Type | Default | Extenstion | Description |
|
||||
|------|------|---------|---------|-------------|
|
||||
| ignoreHeaders | string[] | ["Authorization", "X-API-Key", "WWW-Authenticate"] | DependenciesPlugin | AJAX & Fetch request and response headers to be ignored in log data. To override or discard the default, add an array with all headers to be excluded or an empty array to the configuration. Need to be defined in depenedency plugin extension config, see more [here](./extensions/applicationinsights-dependencies-js/README.md)
|
||||
|
||||
### ICookieMgrConfig
|
||||
|
||||
Cookie Configuration for instance based cookie management added in version 2.6.0.
|
||||
|
|
|
@ -20,6 +20,34 @@ npm run build --silent
|
|||
npm run test
|
||||
```
|
||||
|
||||
## Basic Usage
|
||||
|
||||
### NPM Setup (ignore if using Snippet Setup)
|
||||
|
||||
```js
|
||||
import { ApplicationInsights } from '@microsoft/applicationinsights-web';
|
||||
import { AjaxPlugin } from '@microsoft/applicationinsights-dependencies-js';
|
||||
|
||||
const dependencyPlugin = new AjaxPlugin();
|
||||
const appInsights = new ApplicationInsights({
|
||||
config: {
|
||||
connectionString: 'InstrumentationKey=YOUR_INSTRUMENTATION_KEY_GOES_HERE',
|
||||
extensions: [dependencyPlugin],
|
||||
extensionConfig: {
|
||||
[dependencyPlugin.identifier]: {
|
||||
ignoreHeaders:[
|
||||
"Authorization",
|
||||
"X-API-Key",
|
||||
"WWW-Authenticate"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
appInsights.loadAppInsights();
|
||||
appInsights.trackPageView(); // Manually call trackPageView to establish the current user/session/pageview
|
||||
```
|
||||
|
||||
## Contributing
|
||||
|
||||
This project welcomes contributions and suggestions. Most contributions require you to
|
||||
|
|
|
@ -44,7 +44,36 @@ export interface ICorrelationConfig {
|
|||
correlationHeaderDomains?: string[];
|
||||
|
||||
/**
|
||||
* Response and request headers to be excluded from ajax tracking data.
|
||||
* [Optional] Response and request headers to be excluded from AJAX & Fetch tracking data.
|
||||
* To override or discard the default, add an array with all headers to be excluded or
|
||||
* an empty array to the configuration.
|
||||
*
|
||||
* For example: `["Authorization", "X-API-Key", "WWW-Authenticate"]`
|
||||
*
|
||||
* @example
|
||||
* ```js
|
||||
* import { ApplicationInsights } from '@microsoft/applicationinsights-web';
|
||||
* import { AjaxPlugin } from '@microsoft/applicationinsights-dependencies-js';
|
||||
*
|
||||
* const dependencyPlugin = new AjaxPlugin();
|
||||
* const appInsights = new ApplicationInsights({
|
||||
* config: {
|
||||
* connectionString: 'InstrumentationKey=YOUR_INSTRUMENTATION_KEY_GOES_HERE',
|
||||
* extensions: [dependencyPlugin],
|
||||
* extensionConfig: {
|
||||
* [dependencyPlugin.identifier]: {
|
||||
* ignoreHeaders: [
|
||||
* "Authorization",
|
||||
* "X-API-Key",
|
||||
* "WWW-Authenticate"
|
||||
* ]
|
||||
* }
|
||||
* }
|
||||
* }
|
||||
* });
|
||||
* appInsights.loadAppInsights();
|
||||
* appInsights.trackPageView(); // Manually call trackPageView to establish the current user/session/pageview
|
||||
* ```
|
||||
*/
|
||||
ignoreHeaders?: string[];
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче