Potential fix: mock OOB telemetry service is always disabled - #4294
Draft
sfc-gh-fpawlowski wants to merge 1 commit into
Draft
Potential fix: mock OOB telemetry service is always disabled#4294sfc-gh-fpawlowski wants to merge 1 commit into
sfc-gh-fpawlowski wants to merge 1 commit into
Conversation
LocalTestOOBTelemetryService.__init__ set self._enable (no trailing d), but the enabled property, and every consumer of it (add, flush, close), read self._enabled. Because that attribute was never set to True anywhere else in the codebase, the OOB telemetry service for local testing is effectively always disabled outside of Snowpark's own test suite, which explicitly calls .enable() via the local_testing_telemetry_setup fixture in tests/conftest.py. This fixes the typo so the service is enabled by default, matching the apparent original intent (mock/_connection.py explicitly calls .disable() when telemetry should be turned off, implying it expected to start enabled). Filing this as a separate, stacked PR since fixing this changes observable behavior (OOB telemetry events, e.g. session-creation and not-supported-feature events, will now actually be sent for local testing sessions where they previously silently no-op'd) and may warrant its own discussion before merging.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## NO-SNOW-decouple-mock-oob-telemetry #4294 +/- ##
====================================================================
Coverage 95.46% 95.46%
====================================================================
Files 171 171
Lines 44720 44720
Branches 7676 7676
====================================================================
Hits 42694 42694
Misses 1253 1253
Partials 773 773 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Stacked on #4293
This PR is stacked on #4293 (decoupling
LocalTestOOBTelemetryServicefrom the connector'stelemetry_oob.TelemetryService). Only the last commit here is new; please review #4293 first.Summary
LocalTestOOBTelemetryService.__init__setsself._enable = True(no trailingd), but theenabledproperty, and every consumer of it (add,flush,close), readself._enabled. That attribute is never set toTrueanywhere else in the codebase (mock/_connection.pyonly ever calls.disable(), never.enable(), outside of Snowpark's own test suite).As a result, the OOB telemetry service for local testing is effectively always disabled in real usage. This is masked in CI because
tests/conftest.py'slocal_testing_telemetry_setupfixture explicitly calls.enable()before every OOB telemetry test.Proposed fix
Change
self._enable = Truetoself._enabled = True, matching the apparent original intent:mock/_connection.pyexplicitly calls.disable()when telemetry should be turned off, implying the service was expected to start enabled by default.Why this is a separate, stacked PR
Fixing this changes observable behavior: OOB telemetry events (session-creation and not-supported-feature events for local testing) will now actually be sent where they previously silently no-op'd. Flagging as "potential fix" since this may warrant its own discussion (e.g. whether local testing telemetry should default to on) before merging, independent of the pure refactor in #4293.
Testing
tests/mock/test_oob_telemetry.py(5 tests) pass.LocalTestOOBTelemetryService.get_instance().enabledisTrueimmediately after construction (previouslyFalse).Made with Cursor