Skip to content

Decouple mock OOB telemetry from connector's telemetry_oob - #4293

Draft
sfc-gh-fpawlowski wants to merge 1 commit into
mainfrom
NO-SNOW-decouple-mock-oob-telemetry
Draft

Decouple mock OOB telemetry from connector's telemetry_oob#4293
sfc-gh-fpawlowski wants to merge 1 commit into
mainfrom
NO-SNOW-decouple-mock-oob-telemetry

Conversation

@sfc-gh-fpawlowski

@sfc-gh-fpawlowski sfc-gh-fpawlowski commented Jul 27, 2026

Copy link
Copy Markdown

Summary

LocalTestOOBTelemetryService (used by Snowpark's local testing framework to emit out-of-band telemetry) previously inherited from snowflake.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:

  • the thread-safe singleton pattern (get_instance())
  • the event queue and batch_size
  • close() (which just calls flush() then disable())

This PR re-implements that small surface directly in mock/_telemetry.py so this module no longer imports snowflake.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: the enabled property reads self._enabled, which is never set to True by 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.
  • Ran the broader tests/mock/ suite locally; no new failures introduced (pre-existing failures in this environment are due to missing numpy/pandas, unrelated to this change).

Made with Cursor

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-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.46%. Comparing base (a85d5e8) to head (79ed7ff).

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

local testing Local Testing issues/PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants