Decouple mock OOB telemetry from connector's telemetry_oob - #4293
Draft
sfc-gh-fpawlowski wants to merge 1 commit into
Draft
Decouple mock OOB telemetry from connector's telemetry_oob#4293sfc-gh-fpawlowski wants to merge 1 commit into
sfc-gh-fpawlowski wants to merge 1 commit into
Conversation
LocalTestOOBTelemetryService previously inherited from snowflake.connector.telemetry_oob.TelemetryService, but overrode nearly every method it inherited (__init__, add, flush, enabled, enable, disable, export_queue_to_string, _upload_payload). The only pieces actually relied upon were the thread-safe singleton pattern (get_instance), the event queue, batch_size, and close(). This reimplements that small surface directly in Snowpark so the mock module no longer needs to import snowflake.connector.telemetry_oob, making it easier to decouple Snowpark from internal connector modules going forward. This change is intended to be behavior-preserving 1:1: the existing _enable (vs _enabled) attribute naming from the original class is kept as-is, including its effect on the enabled default. See follow-up PR for a proposed fix to that behavior. Co-authored-by: Cursor <cursoragent@cursor.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4293 +/- ##
=======================================
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.
Summary
LocalTestOOBTelemetryService(used by Snowpark's local testing framework to emit out-of-band telemetry) previously inherited fromsnowflake.connector.telemetry_oob.TelemetryService. In practice, nearly every method inherited from that connector class was already being overridden here (__init__,add,flush,enabled,enable,disable,export_queue_to_string,_upload_payload). The only pieces actually relied upon were:get_instance())batch_sizeclose()(which just callsflush()thendisable())This PR re-implements that small surface directly in
mock/_telemetry.pyso this module no longer importssnowflake.connector.telemetry_oob, making it easier for Snowpark to stop depending on internal/undocumented connector modules.Behavior
This PR is intended to be behavior-preserving, 1:1 with the current code. In particular, the existing
self._enable = True(note: not_enabled) is kept as-is, along with its side effect: theenabledproperty readsself._enabled, which is never set toTrueby this constructor, so the service defaults to disabled exactly as it does today.Stacked on top: #4294 proposes fixing that discrepancy, filed separately since it changes observable behavior and may warrant its own review/discussion.
Testing
tests/mock/test_oob_telemetry.py(5 tests) pass unchanged.tests/mock/suite locally; no new failures introduced (pre-existing failures in this environment are due to missingnumpy/pandas, unrelated to this change).Made with Cursor