Skip to content

Commit

Permalink
Enable fetch automatic dependency tracking by default
Browse files Browse the repository at this point in the history
  • Loading branch information
hectorhdzg authored and MSNev committed Apr 13, 2022
1 parent 9d4cd19 commit 20043ec
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 24 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ Most configuration fields are named such that they can be defaulted to falsey. A
| samplingPercentage | numeric | 100 | Percentage of events that will be sent. Default is 100, meaning all events are sent. Set this if you wish to preserve your datacap for large-scale applications. |
| autoTrackPageVisitTime | boolean | false | If true, on a pageview, the _previous_ instrumented page's view time is tracked and sent as telemetry and a new timer is started for the current pageview. It is sent as a custom metric named `PageVisitTime` in `milliseconds` and is calculated via the Date [now()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/now) function (if available) and falls back to (new Date()).[getTime()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/getTime) if now() is unavailable (IE8 or less). Default is false. |
| disableAjaxTracking | boolean | false | If true, Ajax calls are not autocollected. Default is false. |
| disableFetchTracking | boolean | true | If true, Fetch requests are not autocollected. Default is true |
| disableFetchTracking | boolean | false | If true, Fetch requests are not autocollected. Default is false (Since v2.8.0, previously false) |
| excludeRequestFromAutoTrackingPatterns | string[] \| RegExp[] | undefined | Provide a way to exclude specific route from automatic tracking for XMLHttpRequest or Fetch request. If defined, for an ajax / fetch request that the request url matches with the regex patterns, auto tracking is turned off. Default is undefined. |
| addRequestContext | (requestContext: IRequestionContext) => {[key: string]: any} | undefined | Provide a way to enrich dependencies logs with context at the beginning of api call. Default is undefined. You will need to check if `xhr` exists if you configure `xhr` related conetext. You will need to check if `fetch request` and `fetch response` exist if you configure `fetch` related context. Otherwise you may not get the data you need. |
| overridePageViewDuration | boolean | false | If true, default behavior of trackPageView is changed to record end of page view duration interval when trackPageView is called. If false and no custom duration is provided to trackPageView, the page view performance is calculated using the navigation timing API. Default is false. |
Expand Down
19 changes: 0 additions & 19 deletions common/config/rush/npm-shrinkwrap.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions extensions/applicationinsights-dependencies-js/src/ajax.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ export class AjaxMonitor extends BaseTelemetryPlugin implements IDependenciesPlu
const config: ICorrelationConfig = {
maxAjaxCallsPerView: 500,
disableAjaxTracking: false,
disableFetchTracking: true,
disableFetchTracking: false,
excludeRequestFromAutoTrackingPatterns: undefined,
disableCorrelationHeaders: false,
distributedTracingMode: eDistributedTracingModes.AI_AND_W3C,
Expand Down Expand Up @@ -365,7 +365,7 @@ export class AjaxMonitor extends BaseTelemetryPlugin implements IDependenciesPlu
_enableResponseHeaderTracking = false;
_disabledUrls = {};
_disableAjaxTracking = false;
_disableFetchTracking = true;
_disableFetchTracking = false;

_excludeRequestFromAutoTrackingPatterns = null
_addRequestContext = null;
Expand Down
2 changes: 1 addition & 1 deletion shared/AppInsightsCommon/src/Interfaces/IConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export interface IConfig {
disableAjaxTracking?: boolean;

/**
* If true, Fetch requests are not autocollected. Default is true.
* If true, Fetch requests are not autocollected. Default is false (Since 2.8.0, previously true).
* @defaultValue true
*/
disableFetchTracking?: boolean;
Expand Down
1 change: 0 additions & 1 deletion shared/AppInsightsCore/src/applicationinsights-core-js.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ export { ICookieMgr, ICookieMgrConfig } from "./JavaScriptSDK.Interfaces/ICookie
export {
createCookieMgr, safeGetCookieMgr, uaDisallowsSameSiteNone, areCookiesSupported
} from "./JavaScriptSDK/CookieMgr";
export { strIKey, strExtensionConfig } from "./JavaScriptSDK/Constants";
export { IDbgExtension } from "./JavaScriptSDK.Interfaces/IDbgExtension";
export { getDebugListener, getDebugExt } from "./JavaScriptSDK/DbgExtensionUtils"
export { TelemetryInitializerFunction, ITelemetryInitializerHandler, ITelemetryInitializerContainer } from "./JavaScriptSDK.Interfaces/ITelemetryInitializers";
Expand Down

0 comments on commit 20043ec

Please sign in to comment.