Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
Karlie-777 committed Feb 12, 2025
1 parent b615004 commit 84ccb68
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { AppInsightsCore, FeatureOptInMode, IAppInsightsCore, IPlugin, ITelemetr
import { IConfiguration } from "@microsoft/applicationinsights-core-js";
import { CfgSyncPlugin } from "../../../../applicationinsights-cfgsync-js/src/applicationinsights-cfgsync-js";
import { ICfgSyncConfig, ICfgSyncMode, NonOverrideCfg } from "../../../src/Interfaces/ICfgSyncConfig";
import { IConfig } from "@microsoft/applicationinsights-common";
import { DisabledPropertyName, IConfig } from "@microsoft/applicationinsights-common";
import { createSyncPromise } from "@nevware21/ts-async";


Expand Down Expand Up @@ -74,7 +74,7 @@ export class CfgSyncPluginTests extends AITestClass {
scheduleFetchTimeout: 1800000,
nonOverrideConfigs: defaultNonOverrideCfg,
blkCdnCfg: udfVal,
enableIntEndpointsTracking: false
enableAjax: false
};
this.core.config.extensionConfig = this.core.config.extensionConfig || {};
let actualDefaults = this.core.config.extensionConfig[this.identifier];
Expand Down
12 changes: 6 additions & 6 deletions extensions/applicationinsights-cfgsync-js/src/CfgSyncPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const _defaultConfig: IConfigDefaults<ICfgSyncConfig> = objDeepFreeze({
onCfgChangeReceive: udfVal,
scheduleFetchTimeout: FETCH_TIMEOUT,
nonOverrideConfigs: defaultNonOverrideCfg,
enableIntEndpointsTracking: false
enableAjax: false
});

export class CfgSyncPlugin extends BaseTelemetryPlugin implements ICfgSyncPlugin {
Expand Down Expand Up @@ -62,7 +62,7 @@ export class CfgSyncPlugin extends BaseTelemetryPlugin implements ICfgSyncPlugin
let _overrideFetchFn: SendGetFunction;
let _overrideSyncFn: (config?:IConfiguration & IConfig, customDetails?: any) => boolean;
let _paused = false;
let _enableIntTracking: boolean;
let _enableAjax: boolean;

dynamicProto(CfgSyncPlugin, this, (_self, _base) => {

Expand Down Expand Up @@ -123,7 +123,7 @@ export class CfgSyncPlugin extends BaseTelemetryPlugin implements ICfgSyncPlugin
_fetchTimeout = null;
_retryCnt = null;
_blkCdnCfg = null;
_enableIntTracking = false;
_enableAjax = false;
_overrideFetchFn = null;
_overrideSyncFn = null;
_onCfgChangeReceive = null;
Expand All @@ -138,7 +138,7 @@ export class CfgSyncPlugin extends BaseTelemetryPlugin implements ICfgSyncPlugin
_extensionConfig = ctx.getExtCfg(identifier, _defaultConfig);
let preBlkCdn = _blkCdnCfg;
_blkCdnCfg = !!_extensionConfig.blkCdnCfg;
_enableIntTracking = !!_extensionConfig.enableIntEndpointsTracking;
_enableAjax = !!_extensionConfig.enableAjax;
// avoid initial call
if (!isNullOrUndefined(preBlkCdn) && preBlkCdn !== _blkCdnCfg) {
if (!_blkCdnCfg && _cfgUrl) {
Expand Down Expand Up @@ -269,7 +269,7 @@ export class CfgSyncPlugin extends BaseTelemetryPlugin implements ICfgSyncPlugin
const init: RequestInit = {
method: STR_GET_METHOD
};
if (!_enableIntTracking) {
if (!_enableAjax) {
init[DisabledPropertyName] = true;
}

Expand Down Expand Up @@ -299,7 +299,7 @@ export class CfgSyncPlugin extends BaseTelemetryPlugin implements ICfgSyncPlugin
function _xhrSender(url: string, oncomplete: OnCompleteCallback, isAutoSync?: boolean) {
try {
let xhr = new XMLHttpRequest();
if (!_enableIntTracking) {
if (!_enableAjax) {
xhr[DisabledPropertyName] = true;
}
xhr.open(STR_GET_METHOD, url);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,12 @@ export interface ICfgSyncConfig {
scheduleFetchTimeout?: number;

/**
* [Optional] Flag to indicate whether the internal endpoints will be taged as "DisabledPropertyName" to the xhr/fetch requests
* An internal flag to determine if sending requests with the internal endpoints as dependency requests.
* @internal
* @default false
* @since 3.3.6
*/
enableIntEndpointsTracking?: boolean;
enableAjax?: boolean;
}

export const enum ICfgSyncMode {
Expand Down

0 comments on commit 84ccb68

Please sign in to comment.