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-1341730:Emit spans for UDxF registrations #1648

Merged
merged 26 commits into from
Jun 20, 2024
Merged

Conversation

sfc-gh-yuwang
Copy link
Collaborator

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

    Fixes SNOW-1341730

  2. Fill out the following pre-review checklist:

    • I am adding a new automated test(s) to verify correctness of my new code
      • If this test skips Local Testing mode, I'm requesting review from @snowflakedb/local-testing
    • I am adding new logging messages
    • I am adding a new telemetry message
    • I am adding new credentials
    • I am adding a new dependency
    • If this is a new feature/behavior, I'm adding the Local Testing parity changes.
  3. Please describe how your code solves the related issue.

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

Copy link

github-actions bot commented Jun 6, 2024

Seems like your changes contain some Local Testing changes, please request review from @snowflakedb/local-testing

1 similar comment
Copy link

github-actions bot commented Jun 6, 2024

Seems like your changes contain some Local Testing changes, please request review from @snowflakedb/local-testing

Copy link

github-actions bot commented Jun 6, 2024

Seems like your changes contain some Local Testing changes, please request review from @snowflakedb/local-testing

Copy link

github-actions bot commented Jun 7, 2024

Seems like your changes contain some Local Testing changes, please request review from @snowflakedb/local-testing

Copy link

github-actions bot commented Jun 7, 2024

Seems like your changes contain some Local Testing changes, please request review from @snowflakedb/local-testing

Copy link

Seems like your changes contain some Local Testing changes, please request review from @snowflakedb/local-testing

Copy link

Seems like your changes contain some Local Testing changes, please request review from @snowflakedb/local-testing

Copy link
Contributor

@sfc-gh-jrose sfc-gh-jrose left a comment

Choose a reason for hiding this comment

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

This change looks good to me wrt local testing. This telemetry looks like something we should disable when running in local testing mode. Is that currently the case?

src/snowflake/snowpark/_internal/open_telemetry.py Outdated Show resolved Hide resolved
tests/integ/test_open_telemetry.py Outdated Show resolved Hide resolved
Copy link

Seems like your changes contain some Local Testing changes, please request review from @snowflakedb/local-testing

1 similar comment
Copy link

Seems like your changes contain some Local Testing changes, please request review from @snowflakedb/local-testing

Copy link

Seems like your changes contain some Local Testing changes, please request review from @snowflakedb/local-testing

Copy link

Seems like your changes contain some Local Testing changes, please request review from @snowflakedb/local-testing

Copy link

Seems like your changes contain some Local Testing changes, please request review from @snowflakedb/local-testing

Copy link

Seems like your changes contain some Local Testing changes, please request review from @snowflakedb/local-testing

Copy link

Seems like your changes contain some Local Testing changes, please request review from @snowflakedb/local-testing

Copy link

Seems like your changes contain some Local Testing changes, please request review from @snowflakedb/local-testing

src/snowflake/snowpark/_internal/open_telemetry.py Outdated Show resolved Hide resolved
src/snowflake/snowpark/_internal/open_telemetry.py Outdated Show resolved Hide resolved
tracer = (
trace.get_tracer(f"snow.snowpark.{class_name.split('.')[0].lower()}")
tracer = trace.get_tracer(
f"snow.snowpark.{class_name.split('.')[0].lower()}"
Copy link
Collaborator

Choose a reason for hiding this comment

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

snow or snowflake?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

it is snow, this is a naming tradition from telemetry team and they want to keep it the same

src/snowflake/snowpark/_internal/open_telemetry.py Outdated Show resolved Hide resolved
src/snowflake/snowpark/udaf.py Outdated Show resolved Hide resolved
Copy link

Seems like your changes contain some Local Testing changes, please request review from @snowflakedb/local-testing

@sfc-gh-yuwang sfc-gh-yuwang merged commit c91cca8 into main Jun 20, 2024
36 checks passed
@sfc-gh-yuwang sfc-gh-yuwang deleted the SNOW-1341730 branch June 20, 2024 16:50
@github-actions github-actions bot locked and limited conversation to collaborators Jun 20, 2024
try:
yield
except Exception as e:
cur_span.set_status(Status(StatusCode.ERROR, str(e)))

Choose a reason for hiding this comment

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

I think you can use trace.Status instead and avoid import as well. It is clearer which status you are referring to.

@@ -56,6 +61,59 @@ def open_telemetry_context_manager(func, dataframe):
yield


@contextmanager
def open_telemetry_udf_context_manager(func, parameters):

Choose a reason for hiding this comment

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

Why using parameters pattern rather than passing the individual parameters?

stage_location,
parallel,
)
parameters = {"handler": handler, "name": name}

Choose a reason for hiding this comment

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

Can use named arguments, I think it is better than creating a new dict and search in it.

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.

5 participants