Add functionality for TelemetryClient to not use global providers#1482
Merged
hectorhdzg merged 5 commits intomicrosoft:mainfrom Dec 12, 2025
Merged
Conversation
rads-1996
reviewed
Dec 10, 2025
| export function setup(setupString?: string) { | ||
| if (!defaultClient) { | ||
| defaultClient = new TelemetryClient(setupString); | ||
| defaultClient = new TelemetryClient(setupString, { useGlobalProviders: true }); |
Member
There was a problem hiding this comment.
I am a bit confused here, I though the title meant not to use the global providers for telemetry client, but here we are setting it to True.
Member
Author
There was a problem hiding this comment.
This is the only scenario where we want to enable it, the default client when the SDK is initialized using
let appInsights = require("applicationinsights");
appInsights.setup("<YOUR_CONNECTION_STRING>").start();
| // Create attribute processors with context tags and common properties | ||
| this._attributeSpanProcessor = new AttributeSpanProcessor({ ...this.context.tags, ...this.commonProperties }); | ||
| this._attributeLogProcessor = new AttributeLogProcessor({ ...this.context.tags, ...this.commonProperties }); | ||
| this._options.spanProcessors = [...(this._options.spanProcessors || []), this._attributeSpanProcessor]; |
Contributor
There was a problem hiding this comment.
Nice addition, thanks for noticing this omission!
rads-1996
approved these changes
Dec 11, 2025
JacksonWeber
approved these changes
Dec 11, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1476