-
Notifications
You must be signed in to change notification settings - Fork 144
Add functionality for TelemetryClient to not use global providers #1482
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add functionality for TelemetryClient to not use global providers #1482
Conversation
| export function setup(setupString?: string) { | ||
| if (!defaultClient) { | ||
| defaultClient = new TelemetryClient(setupString); | ||
| defaultClient = new TelemetryClient(setupString, { useGlobalProviders: true }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice addition, thanks for noticing this omission!
JacksonWeber
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Fixes #1476