Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SNOW-1041753: oob telemetry for snowpark python local testing #1265

Merged
merged 19 commits into from
Mar 13, 2024

Conversation

sfc-gh-aling
Copy link
Contributor

@sfc-gh-aling sfc-gh-aling commented Feb 22, 2024

Please answer these questions before submitting your pull requests. Thanks!

This PR implement a OOB Telemetry client for Snowpark Python Local Testing only which overrides the OOBTelemetry in the snowflake-connector-python, it implements the following features:

  • log not supported feature
  • log mock connection creation

please be aware that this PR only focuses telemetry for local testing, it doesn't take other oob telemetry into consideration or any refactor work.

one improvement identified is to consolidate the existing oob telemetry in snowflake, but because this is a new telemetry endpoint, we need to test the existing oob logic with the new end point, this is beyond our current goal and requires extra amount of work.

  1. What GitHub issue is this PR addressing? Make sure that there is an accompanying issue to your PR.

    Fixes #NNNN

  2. Fill out the following pre-review checklist:

    • I am adding a new automated test(s) to verify correctness of my new code
    • I am adding new logging messages
    • I am adding a new telemetry message
    • I am adding new credentials
    • I am adding a new dependency
  3. Please describe how your code solves the related issue.

    Please write a short description of how your code change solves the related issue.

@sfc-gh-aling sfc-gh-aling changed the title SNOW-1041753: oob telemetry for snowpark python SNOW-1041753: oob telemetry for snowpark python local testing Feb 27, 2024
@sfc-gh-aling sfc-gh-aling marked this pull request as ready for review February 27, 2024 23:57
@sfc-gh-aling sfc-gh-aling requested a review from a team as a code owner February 27, 2024 23:57
@sfc-gh-aling sfc-gh-aling force-pushed the SNOW-1041753-feature-oob-telemetry-code-change branch from 13a67ad to c6f52e3 Compare February 28, 2024 00:06
src/snowflake/snowpark/mock/_connection.py Outdated Show resolved Hide resolved


class LocalTestOOBTelemetryService(TelemetryService):
PROD = "https://client-telemetry.c1.us-west-2.aws.app.snowflake.com/enqueue"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the client have to auth to access this endpoint?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no, this endpoint is publicly available.
this is out-of-band service so anyone can access this endpoint, but the telemetry data has to comply with the format otherwise the service will ignore the request

logger.debug("Telemetry request success=%s", success)

def add(self, event) -> None:
"""Adds a telemetry event to the queue. If the event is urgent, upload all telemetry events right away."""
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see anything that would do an immediate upload.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry about the comment being confusing -- I copied it from the connector telemetry code.
I removed the comment.

I don't think the concept "urgent" is applicable to local test, doing batch sending should be enough for local testing telemetry events. in the connector, urgent is for ocsp validation error.

src/snowflake/snowpark/mock/_telemetry.py Outdated Show resolved Hide resolved
@sfc-gh-aling sfc-gh-aling force-pushed the SNOW-1041753-feature-oob-telemetry-code-change branch from c6f52e3 to 6366cb7 Compare March 5, 2024 22:24
@@ -229,6 +236,47 @@ def __init__(self, options: Optional[Dict[str, Any]] = None) -> None:
self._active_schema = self._options.get(
"schema", snowflake.snowpark.mock._constants.CURRENT_SCHEMA
)
self._connection_uuid = str(uuid.uuid4())
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shall we create a TODO for to use the .snowsql approach so we can track telemetry per installation instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, the JIRA is created here: https://snowflakecomputing.atlassian.net/browse/SNOW-1179161 and tracked in post GA epic

CHANGELOG.md Outdated Show resolved Hide resolved
@sfc-gh-aling sfc-gh-aling merged commit 420a422 into main Mar 13, 2024
60 of 61 checks passed
@sfc-gh-aling sfc-gh-aling deleted the SNOW-1041753-feature-oob-telemetry-code-change branch March 13, 2024 16:21
@github-actions github-actions bot locked and limited conversation to collaborators Mar 13, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants