fix: telemetry appinsights connection string provider#1423
Merged
cotovanu-cristian merged 2 commits intomainfrom Mar 6, 2026
Merged
fix: telemetry appinsights connection string provider#1423cotovanu-cristian merged 2 commits intomainfrom
cotovanu-cristian merged 2 commits intomainfrom
Conversation
…ient The AppInsightsEventClient singleton initializes once and locks to whatever connection string is available at that moment. In the CLI server, module-level code triggers initialization before any job sets TELEMETRY_CONNECTION_STRING, causing custom events to route to the baked-in fallback App Insights instead of the job-specific instance. Add set_connection_string_provider() so callers can override the fallback-based resolution, and reset() so long-lived processes can re-initialize the client between job executions. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ts client Tests cover: - Provider overrides default _get_connection_string fallback - Provider returning None results in no client - Provider bypasses baked-in _CONNECTION_STRING constant - reset() clears initialized flag and client - reset() flushes before clearing - reset() allows reinitialization with new connection string - Public API functions set_event_connection_string_provider and reset_event_client Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
91fb5c5 to
533b99f
Compare
gcuip
approved these changes
Mar 6, 2026
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.
Summary
Context
In the CLI server, _AppInsightsEventClient._initialize() is a one-shot singleton. If it runs before TELEMETRY_CONNECTION_STRING is set in the environment, it locks permanently to the baked-in fallback App Insights key. This PR
provides the primitives needed to control when and how the connection string is resolved.