Skip to content

Commit

Permalink
Update automatic creation of incoming request in Azure functions conf…
Browse files Browse the repository at this point in the history
…ig (microsoft#1059)

* Update automatic creation of incoming request in Azure functions config

* typo
  • Loading branch information
hectorhdzg authored Jan 11, 2023
1 parent c59867a commit 2617f05
Show file tree
Hide file tree
Showing 9 changed files with 100 additions and 100 deletions.
4 changes: 2 additions & 2 deletions Bootstrap/Default.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ export function setupAndStart(aadTokenCredential?: azureCoreAuth.TokenCredential
_appInsights.setup().setSendLiveMetrics(false)
.setAutoCollectPerformance(false)
.setAutoCollectPreAggregatedMetrics(false)
.setAutoCollectAzureFunctions(true)
.setAutoCollectIncomingRequestAzureFunctions(false)
.setAutoCollectRequests(true)
.setAutoCollectDependencies(true)
.setAutoCollectExceptions(true)
Expand All @@ -132,7 +132,7 @@ export function setupAndStart(aadTokenCredential?: azureCoreAuth.TokenCredential
_appInsights.setup().setSendLiveMetrics(true)
.setAutoCollectPerformance(true)
.setAutoCollectPreAggregatedMetrics(true)
.setAutoCollectAzureFunctions(false)
.setAutoCollectIncomingRequestAzureFunctions(false)
.setAutoCollectRequests(true)
.setAutoCollectDependencies(true)
.setAutoCollectExceptions(true)
Expand Down
2 changes: 1 addition & 1 deletion Declarations/Interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ export interface IBaseConfig {
/**
* Enable automatic incoming request tracking when running in Azure Functions
*/
enableAutoCollectAzureFunctions: boolean;
enableAutoCollectIncomingRequestAzureFunctions: boolean;
/**
* Application Insights resource connection string for web instrumentation and automatic monitoring
* Note: if no VALID connection string is provided here, web instrumentation will use the connection string during initializing Nodejs SDK
Expand Down
4 changes: 2 additions & 2 deletions Library/Config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class Config implements IConfig {
public enableAutoCollectRequests: boolean;
public enableAutoCollectDependencies: boolean;
public enableAutoDependencyCorrelation: boolean;
public enableAutoCollectAzureFunctions: boolean;
public enableAutoCollectIncomingRequestAzureFunctions: boolean;
public enableSendLiveMetrics: boolean;
public enableUseDiskRetryCaching: boolean;
public enableUseAsyncHooks: boolean;
Expand Down Expand Up @@ -170,7 +170,7 @@ class Config implements IConfig {
this.distributedTracingMode = jsonConfig.distributedTracingMode;
this.enableAutoCollectConsole = jsonConfig.enableAutoCollectConsole;
this.enableAutoCollectDependencies = jsonConfig.enableAutoCollectDependencies;
this.enableAutoCollectAzureFunctions = jsonConfig.enableAutoCollectAzureFunctions;
this.enableAutoCollectIncomingRequestAzureFunctions = jsonConfig.enableAutoCollectIncomingRequestAzureFunctions;
this.enableAutoCollectExceptions = jsonConfig.enableAutoCollectExceptions;
this.enableAutoCollectExtendedMetrics = jsonConfig.enableAutoCollectExtendedMetrics;
this.enableAutoCollectExternalLoggers = jsonConfig.enableAutoCollectExternalLoggers;
Expand Down
4 changes: 2 additions & 2 deletions Library/JsonConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export class JsonConfig implements IJsonConfig {
public enableAutoCollectRequests: boolean;
public enableAutoCollectDependencies: boolean;
public enableAutoDependencyCorrelation: boolean;
public enableAutoCollectAzureFunctions: boolean;
public enableAutoCollectIncomingRequestAzureFunctions: boolean;
public enableUseAsyncHooks: boolean;
public enableUseDiskRetryCaching: boolean;
public enableResendInterval: number;
Expand Down Expand Up @@ -206,7 +206,7 @@ export class JsonConfig implements IJsonConfig {
this.enableAutoCollectRequests = jsonConfig.enableAutoCollectRequests;
this.enableAutoCollectDependencies = jsonConfig.enableAutoCollectDependencies;
this.enableAutoDependencyCorrelation = jsonConfig.enableAutoDependencyCorrelation;
this.enableAutoCollectAzureFunctions = jsonConfig.enableAutoCollectAzureFunctions;
this.enableAutoCollectIncomingRequestAzureFunctions = jsonConfig.enableAutoCollectIncomingRequestAzureFunctions;
this.enableUseAsyncHooks = jsonConfig.enableUseAsyncHooks;
this.enableUseDiskRetryCaching = jsonConfig.enableUseDiskRetryCaching;
this.enableResendInterval = jsonConfig.enableResendInterval;
Expand Down
2 changes: 1 addition & 1 deletion Tests/Library/Config.tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ describe("Library/Config", () => {
assert.equal(config.enableAutoCollectRequests, false);
assert.equal(config.enableAutoCollectDependencies, false);
assert.equal(config.enableAutoDependencyCorrelation, false);
assert.equal(config.enableAutoCollectAzureFunctions, false);
assert.equal(config.enableAutoCollectIncomingRequestAzureFunctions, false);
assert.equal(config.enableUseAsyncHooks, false);
assert.equal(config.disableStatsbeat, false);
assert.equal(config.enableAutoCollectExtendedMetrics, false);
Expand Down
2 changes: 1 addition & 1 deletion Tests/Library/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"enableAutoCollectRequests": false,
"enableAutoCollectDependencies": false,
"enableAutoDependencyCorrelation": false,
"enableAutoCollectAzureFunctions": false,
"enableAutoCollectIncomingRequestAzureFunctions": false,
"enableUseAsyncHooks": false,
"disableStatsbeat": false,
"noHttpAgentKeepAlive": false,
Expand Down
2 changes: 1 addition & 1 deletion Tests/Library/jsonConfig.tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ describe("Json Config", () => {
assert.equal(config.enableAutoCollectRequests, false);
assert.equal(config.enableAutoCollectDependencies, false);
assert.equal(config.enableAutoDependencyCorrelation, false);
assert.equal(config.enableAutoCollectAzureFunctions, false);
assert.equal(config.enableAutoCollectIncomingRequestAzureFunctions, false);
assert.equal(config.enableUseAsyncHooks, false);
assert.equal(config.disableStatsbeat, false);
assert.equal(config.enableAutoCollectExtendedMetrics, false);
Expand Down
8 changes: 4 additions & 4 deletions applicationinsights.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ function _initializeConfig() {
_forceClsHooked = defaultClient.config.enableUseAsyncHooks !== undefined ? defaultClient.config.enableUseAsyncHooks : _forceClsHooked;
_isSnippetInjection = defaultClient.config.enableWebInstrumentation !== undefined ? defaultClient.config.enableWebInstrumentation : _isSnippetInjection;
_isSnippetInjection = defaultClient.config.enableAutoWebSnippetInjection === true ? true : _isSnippetInjection;
_isAzureFunctions = defaultClient.config.enableAutoCollectAzureFunctions !== undefined ? defaultClient.config.enableAutoCollectAzureFunctions : _isAzureFunctions;
_isAzureFunctions = defaultClient.config.enableAutoCollectIncomingRequestAzureFunctions !== undefined ? defaultClient.config.enableAutoCollectIncomingRequestAzureFunctions : _isAzureFunctions;
const extendedMetricsConfig = AutoCollectNativePerformance.parseEnabled(defaultClient.config.enableAutoCollectExtendedMetrics, defaultClient.config);
_isNativePerformance = extendedMetricsConfig.isEnabled;
_disabledExtendedMetrics = extendedMetricsConfig.disabledMetrics;
Expand Down Expand Up @@ -432,11 +432,11 @@ export class Configuration {
}

/**
* Enable automatic incoming request tracking and correct correlation when using Azure Functions
* @param value if true auto collection will be enabled
* Enable automatic incoming request tracking when using Azure Functions
* @param value if true auto collection of incoming requests will be enabled
* @returns {Configuration} this class
*/
public static setAutoCollectAzureFunctions(value: boolean) {
public static setAutoCollectIncomingRequestAzureFunctions(value: boolean) {
_isAzureFunctions = value;
if (_isStarted) {
_azureFunctions.enable(value);
Expand Down
Loading

0 comments on commit 2617f05

Please sign in to comment.