in Library/JsonConfig.ts [85:164]
private _loadJsonFile() {
let configFileName = "applicationinsights.json";
let rootPath = path.join(__dirname, "../../"); // Root of applicationinsights folder (__dirname = ../out/Library)
let tempDir = path.join(rootPath, configFileName); // default
let configFile = process.env[ENV_CONFIGURATION_FILE];
if (configFile) {
if (path.isAbsolute(configFile)) {
tempDir = configFile;
}
else {
tempDir = path.join(rootPath, configFile);// Relative path to applicationinsights folder
}
}
try {
const jsonConfig: IJsonConfig = JSON.parse(fs.readFileSync(tempDir, "utf8"));
if (jsonConfig.disableStatsbeat != undefined) {
this.disableStatsbeat = jsonConfig.disableStatsbeat;
}
if (jsonConfig.disableAllExtendedMetrics != undefined) {
this.disableAllExtendedMetrics = jsonConfig.disableStatsbeat;
}
if (jsonConfig.noDiagnosticChannel != undefined) {
this.noDiagnosticChannel = jsonConfig.noDiagnosticChannel;
}
if (jsonConfig.noHttpAgentKeepAlive != undefined) {
this.noHttpAgentKeepAlive = jsonConfig.noHttpAgentKeepAlive;
}
if (jsonConfig.connectionString != undefined) {
this.connectionString = jsonConfig.connectionString;
}
if (jsonConfig.extendedMetricDisablers != undefined) {
this.extendedMetricDisablers = jsonConfig.extendedMetricDisablers;
}
if (jsonConfig.noDiagnosticChannel != undefined) {
this.noDiagnosticChannel = jsonConfig.noDiagnosticChannel;
}
if (jsonConfig.proxyHttpUrl != undefined) {
this.proxyHttpUrl = jsonConfig.proxyHttpUrl;
}
if (jsonConfig.proxyHttpsUrl != undefined) {
this.proxyHttpsUrl = jsonConfig.proxyHttpsUrl;
}
if (jsonConfig.proxyHttpsUrl != undefined) {
this.proxyHttpsUrl = jsonConfig.proxyHttpsUrl;
}
if (jsonConfig.noPatchModules != undefined) {
this.noPatchModules = jsonConfig.noPatchModules;
}
this.endpointUrl = jsonConfig.endpointUrl;
this.maxBatchSize = jsonConfig.maxBatchSize;
this.maxBatchIntervalMs = jsonConfig.maxBatchIntervalMs;
this.disableAppInsights = jsonConfig.disableAppInsights;
this.samplingPercentage = jsonConfig.samplingPercentage;
this.correlationIdRetryIntervalMs = jsonConfig.correlationIdRetryIntervalMs;
this.correlationHeaderExcludedDomains = jsonConfig.correlationHeaderExcludedDomains;
this.ignoreLegacyHeaders = jsonConfig.ignoreLegacyHeaders;
this.distributedTracingMode = jsonConfig.distributedTracingMode;
this.enableAutoCollectExternalLoggers = jsonConfig.enableAutoCollectExternalLoggers;
this.enableAutoCollectConsole = jsonConfig.enableAutoCollectConsole;
this.enableAutoCollectExceptions = jsonConfig.enableAutoCollectExceptions;
this.enableAutoCollectPerformance = jsonConfig.enableAutoCollectPerformance;
this.enableAutoCollectExtendedMetrics = jsonConfig.enableAutoCollectExtendedMetrics;
this.enableAutoCollectPreAggregatedMetrics = jsonConfig.enableAutoCollectPreAggregatedMetrics;
this.enableAutoCollectHeartbeat = jsonConfig.enableAutoCollectHeartbeat;
this.enableAutoCollectRequests = jsonConfig.enableAutoCollectRequests;
this.enableAutoCollectDependencies = jsonConfig.enableAutoCollectDependencies;
this.enableAutoDependencyCorrelation = jsonConfig.enableAutoDependencyCorrelation;
this.enableUseAsyncHooks = jsonConfig.enableUseAsyncHooks;
this.enableUseDiskRetryCaching = jsonConfig.enableUseDiskRetryCaching;
this.enableResendInterval = jsonConfig.enableResendInterval;
this.enableMaxBytesOnDisk = jsonConfig.enableMaxBytesOnDisk;
this.enableInternalDebugLogging = jsonConfig.enableInternalDebugLogging;
this.enableInternalWarningLogging = jsonConfig.enableInternalWarningLogging;
this.enableSendLiveMetrics = jsonConfig.enableSendLiveMetrics;
this.quickPulseHost = jsonConfig.quickPulseHost;
}
catch (err) {
Logging.info("Missing or invalid JSON config file: ", err);
}
}