Skip to content

Potential fix: mock OOB telemetry service is always disabled - #4294

Draft
sfc-gh-fpawlowski wants to merge 1 commit into
NO-SNOW-decouple-mock-oob-telemetryfrom
NO-SNOW-fix-mock-oob-telemetry-enabled-flag
Draft

Potential fix: mock OOB telemetry service is always disabled#4294
sfc-gh-fpawlowski wants to merge 1 commit into
NO-SNOW-decouple-mock-oob-telemetryfrom
NO-SNOW-fix-mock-oob-telemetry-enabled-flag

Conversation

@sfc-gh-fpawlowski

Copy link
Copy Markdown

Stacked on #4293

This PR is stacked on #4293 (decoupling LocalTestOOBTelemetryService from the connector's telemetry_oob.TelemetryService). Only the last commit here is new; please review #4293 first.

Summary

LocalTestOOBTelemetryService.__init__ sets self._enable = True (no trailing d), but the enabled property, and every consumer of it (add, flush, close), read self._enabled. That attribute is never set to True anywhere else in the codebase (mock/_connection.py only 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's local_testing_telemetry_setup fixture explicitly calls .enable() before every OOB telemetry test.

Proposed fix

Change self._enable = True to self._enabled = True, matching the apparent original intent: mock/_connection.py explicitly 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.
  • Verified manually that LocalTestOOBTelemetryService.get_instance().enabled is True immediately after construction (previously False).

Made with Cursor

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

Copy link
Copy Markdown

Codecov Report

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

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.
📢 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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants