Skip to content

fix: telemetry appinsights connection string provider#1423

Merged
cotovanu-cristian merged 2 commits intomainfrom
fix/telemetry-appinsights-connection-string-provider
Mar 6, 2026
Merged

fix: telemetry appinsights connection string provider#1423
cotovanu-cristian merged 2 commits intomainfrom
fix/telemetry-appinsights-connection-string-provider

Conversation

@cotovanu-cristian
Copy link
Collaborator

@cotovanu-cristian cotovanu-cristian commented Mar 6, 2026

Summary

  • Add set_event_connection_string_provider() to let callers override how the AppInsights connection string is resolved, bypassing the baked-in _CONNECTION_STRING fallback
  • Add reset_event_client() to flush and reset the singleton so long-lived processes (CLI server) can re-initialize between job executions
  • Add 8 unit tests covering provider override, fallback bypass, reset lifecycle, and public API

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.

…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>
@github-actions github-actions bot added test:uipath-langchain Triggers tests in the uipath-langchain-python repository test:uipath-llamaindex Triggers tests in the uipath-llamaindex-python repository labels Mar 6, 2026
@cotovanu-cristian cotovanu-cristian marked this pull request as ready for review March 6, 2026 21:48
…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>
@cotovanu-cristian cotovanu-cristian force-pushed the fix/telemetry-appinsights-connection-string-provider branch from 91fb5c5 to 533b99f Compare March 6, 2026 21:49
@cotovanu-cristian cotovanu-cristian enabled auto-merge (squash) March 6, 2026 21:50
@cotovanu-cristian cotovanu-cristian merged commit d545336 into main Mar 6, 2026
122 checks passed
@cotovanu-cristian cotovanu-cristian deleted the fix/telemetry-appinsights-connection-string-provider branch March 6, 2026 22:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test:uipath-langchain Triggers tests in the uipath-langchain-python repository test:uipath-llamaindex Triggers tests in the uipath-llamaindex-python repository

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants