From 34336cf1b6d789b2f25e9d6cd9d6b6c782d72e99 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 2 Jul 2025 20:45:52 +0000 Subject: [PATCH 1/3] Initial plan From 34e1d71ed7f01a73d066ffe3c0c8e3bcd4eed0a6 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 2 Jul 2025 20:57:03 +0000 Subject: [PATCH 2/3] Fix ITelemetryPlugin interface: make setNextPlugin optional and add deprecation warnings Co-authored-by: MSNev <54870357+MSNev@users.noreply.github.com> --- .../Unit/src/ApplicationInsightsCore.Tests.ts | 15 ++++++++++----- .../Tests/Unit/src/Dynamic.Tests.ts | 3 ++- .../AppInsightsCore/Tests/Unit/src/TestPlugins.ts | 3 ++- .../JavaScriptSDK.Interfaces/ITelemetryPlugin.ts | 3 ++- .../src/JavaScriptSDK/BaseTelemetryPlugin.ts | 3 ++- 5 files changed, 18 insertions(+), 9 deletions(-) diff --git a/shared/AppInsightsCore/Tests/Unit/src/ApplicationInsightsCore.Tests.ts b/shared/AppInsightsCore/Tests/Unit/src/ApplicationInsightsCore.Tests.ts index 08c30044b..c843d46ce 100644 --- a/shared/AppInsightsCore/Tests/Unit/src/ApplicationInsightsCore.Tests.ts +++ b/shared/AppInsightsCore/Tests/Unit/src/ApplicationInsightsCore.Tests.ts @@ -1928,7 +1928,8 @@ class TestSamplingPlugin implements ITelemetryPlugin { public processTelemetry: (env: ITelemetryItem) => void; public initialize: (config: IConfiguration) => void; public identifier: string = "AzureSamplingPlugin"; - public setNextPlugin: (next: ITelemetryPlugin) => void; + /** @deprecated - Use processNext() function of the passed IProcessTelemetryContext instead */ + public setNextPlugin?: (next: ITelemetryPlugin) => void; public priority: number = 5; public version = "1.0.31-Beta"; public nexttPlugin: ITelemetryPlugin; @@ -2013,7 +2014,8 @@ class ChannelPlugin implements IChannelControls { this.isUnloadInvoked = true; } - setNextPlugin(next: ITelemetryPlugin) { + /** @deprecated - Use processNext() function of the passed IProcessTelemetryContext instead */ + setNextPlugin?(next: ITelemetryPlugin) { this._nextPlugin = next; } @@ -2052,7 +2054,8 @@ class TrackPlugin implements IPlugin { } - public setNextPlugin(next: ITelemetryPlugin) { + /** @deprecated - Use processNext() function of the passed IProcessTelemetryContext instead */ + public setNextPlugin?(next: ITelemetryPlugin) { this._nextPlugin = next; } @@ -2106,7 +2109,8 @@ class TestOfflineChannelPlugin implements IChannelControls { this.isUnloadInvoked = true; } - setNextPlugin(next: ITelemetryPlugin) { + /** @deprecated - Use processNext() function of the passed IProcessTelemetryContext instead */ + setNextPlugin?(next: ITelemetryPlugin) { this._nextPlugin = next; } @@ -2176,7 +2180,8 @@ class TestChannelPlugin implements IChannelControls { this.isUnloadInvoked = true; } - setNextPlugin(next: ITelemetryPlugin) { + /** @deprecated - Use processNext() function of the passed IProcessTelemetryContext instead */ + setNextPlugin?(next: ITelemetryPlugin) { this._nextPlugin = next; } diff --git a/shared/AppInsightsCore/Tests/Unit/src/Dynamic.Tests.ts b/shared/AppInsightsCore/Tests/Unit/src/Dynamic.Tests.ts index 319e96486..fe5c0ff06 100644 --- a/shared/AppInsightsCore/Tests/Unit/src/Dynamic.Tests.ts +++ b/shared/AppInsightsCore/Tests/Unit/src/Dynamic.Tests.ts @@ -1145,7 +1145,8 @@ class TestSamplingPlugin implements ITelemetryPlugin { public processTelemetry: (env: ITelemetryItem) => void; public initialize: (config: IConfiguration) => void; public identifier: string = "AzureSamplingPlugin"; - public setNextPlugin: (next: ITelemetryPlugin) => void; + /** @deprecated - Use processNext() function of the passed IProcessTelemetryContext instead */ + public setNextPlugin?: (next: ITelemetryPlugin) => void; public priority: number = 5; public version = "1.0.31-Beta"; public nextPlugin: ITelemetryPlugin; diff --git a/shared/AppInsightsCore/Tests/Unit/src/TestPlugins.ts b/shared/AppInsightsCore/Tests/Unit/src/TestPlugins.ts index 087699833..78b07c556 100644 --- a/shared/AppInsightsCore/Tests/Unit/src/TestPlugins.ts +++ b/shared/AppInsightsCore/Tests/Unit/src/TestPlugins.ts @@ -78,7 +78,8 @@ export class TestSamplingPlugin implements ITelemetryPlugin { public processTelemetry: (env: ITelemetryItem) => void; public initialize: (config: IConfiguration) => void; public identifier: string = "AzureSamplingPlugin"; - public setNextPlugin: (next: ITelemetryPlugin) => void; + /** @deprecated - Use processNext() function of the passed IProcessTelemetryContext instead */ + public setNextPlugin?: (next: ITelemetryPlugin) => void; public priority: number = 5; public version = "1.0.31-Beta"; public nextPlugin: ITelemetryPlugin; diff --git a/shared/AppInsightsCore/src/JavaScriptSDK.Interfaces/ITelemetryPlugin.ts b/shared/AppInsightsCore/src/JavaScriptSDK.Interfaces/ITelemetryPlugin.ts index 9af8f1179..4ab5a04ad 100644 --- a/shared/AppInsightsCore/src/JavaScriptSDK.Interfaces/ITelemetryPlugin.ts +++ b/shared/AppInsightsCore/src/JavaScriptSDK.Interfaces/ITelemetryPlugin.ts @@ -36,9 +36,10 @@ export interface ITelemetryProcessor { */ export interface ITelemetryPlugin extends ITelemetryProcessor, IPlugin { /** - * Set next extension for telemetry processing, this is not optional as plugins should use the + * Set next extension for telemetry processing, this is now optional as plugins should use the * processNext() function of the passed IProcessTelemetryContext instead. It is being kept for * now for backward compatibility only. + * @deprecated - Use processNext() function of the passed IProcessTelemetryContext instead */ setNextPlugin?: (next: ITelemetryPlugin | ITelemetryPluginChain) => void; diff --git a/shared/AppInsightsCore/src/JavaScriptSDK/BaseTelemetryPlugin.ts b/shared/AppInsightsCore/src/JavaScriptSDK/BaseTelemetryPlugin.ts index 605d099c2..28f05692a 100644 --- a/shared/AppInsightsCore/src/JavaScriptSDK/BaseTelemetryPlugin.ts +++ b/shared/AppInsightsCore/src/JavaScriptSDK/BaseTelemetryPlugin.ts @@ -64,8 +64,9 @@ export abstract class BaseTelemetryPlugin implements ITelemetryPlugin { /** * Set next extension for telemetry processing + * @deprecated - Use processNext() function of the passed IProcessTelemetryContext instead */ - public setNextPlugin: (next: ITelemetryPlugin | ITelemetryPluginChain) => void; + public setNextPlugin?: (next: ITelemetryPlugin | ITelemetryPluginChain) => void; /** * Returns the current diagnostic logger that can be used to log issues, if no logger is currently From 41b95757220dd0226de52955c811eb968a48ff42 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 2 Jul 2025 21:10:31 +0000 Subject: [PATCH 3/3] Add full comment from interface to BaseTelemetryPlugin setNextPlugin method Co-authored-by: MSNev <54870357+MSNev@users.noreply.github.com> --- .../AppInsightsCore/src/JavaScriptSDK/BaseTelemetryPlugin.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/shared/AppInsightsCore/src/JavaScriptSDK/BaseTelemetryPlugin.ts b/shared/AppInsightsCore/src/JavaScriptSDK/BaseTelemetryPlugin.ts index 28f05692a..f13197054 100644 --- a/shared/AppInsightsCore/src/JavaScriptSDK/BaseTelemetryPlugin.ts +++ b/shared/AppInsightsCore/src/JavaScriptSDK/BaseTelemetryPlugin.ts @@ -63,7 +63,9 @@ export abstract class BaseTelemetryPlugin implements ITelemetryPlugin { public processNext: (env: ITelemetryItem, itemCtx: IProcessTelemetryContext) => void; /** - * Set next extension for telemetry processing + * Set next extension for telemetry processing, this is now optional as plugins should use the + * processNext() function of the passed IProcessTelemetryContext instead. It is being kept for + * now for backward compatibility only. * @deprecated - Use processNext() function of the passed IProcessTelemetryContext instead */ public setNextPlugin?: (next: ITelemetryPlugin | ITelemetryPluginChain) => void;