SNOW-2364943: support export external telemetry to event table#3813
Conversation
sfc-gh-vguttha
left a comment
There was a problem hiding this comment.
Pls address the doc comments. Rest LGTM. Thanks for doing this.
| return self._sp_profiler | ||
|
|
||
| @property | ||
| def client_telemetry(self) -> ExternalTelemetry: |
There was a problem hiding this comment.
should we rename to EventTableTelemetry to make it consistent?
| # test with mock exporter and authentication | ||
| with ( | ||
| patch( | ||
| "snowflake.snowpark._internal.external_telemetry.create_attestation", |
There was a problem hiding this comment.
The patch path in the test doesn't match the actual module path. It should be snowflake.snowpark._internal.event_table_telemetry.create_attestation to match the import at line 10 of the event_table_telemetry.py file. This mismatch would cause the test to fail since the mock won't intercept the actual function call.
| "snowflake.snowpark._internal.external_telemetry.create_attestation", | |
| "snowflake.snowpark._internal.event_table_telemetry.create_attestation", |
Spotted by Graphite Agent
Is this helpful? React 👍 or 👎 to let us know.
| ext.enable_event_table_telemetry_collection("snowflake.telemetry.events", logging.INFO, True) | ||
| tracer = trace.get_tracer("my_tracer") | ||
| with tracer.start_as_current_span("code_store") as span: | ||
| span.set_attribute("code.lineno", "21") |
There was a problem hiding this comment.
| span.set_attribute("code.lineno", "21") | |
| span.set_attribute("code.lineno", "21") |
| logging.info("Trace being sent to event table") | ||
| ext.disable_event_table_telemetry_collection() | ||
| logging.info("out of scope log") # this log is not sent to event table | ||
| ext.enable_event_table_telemetry_collection("db.sc.external_et", logging.DEBUG, True) |
There was a problem hiding this comment.
| ext.enable_event_table_telemetry_collection("db.sc.external_et", logging.DEBUG, True) | |
| ext.enable_event_table_telemetry_collection("snowflake.telemetry.events", logging.DEBUG, True) |
| logging.info("Trace being sent to event table") | ||
| ext.disable_event_table_telemetry_collection() | ||
| logging.info("out of scope log") # this log is not sent to event table | ||
| ext.enable_event_table_telemetry_collection("db.sc.external_et", logging.DEBUG, True) |
There was a problem hiding this comment.
| ext.enable_event_table_telemetry_collection("db.sc.external_et", logging.DEBUG, True) | |
| ext.enable_event_table_telemetry_collection("snowflake.telemetry.events", logging.DEBUG, True) |
Which Jira issue is this PR addressing? Make sure that there is an accompanying issue to your PR.
Fixes SNOW-2364943
Fill out the following pre-review checklist:
Please describe how your code solves the related issue.
This PR aim to add feature of sending external telemetry information(trace/log) to an event table with open telemetry library.
Here is the design doc of this feature:https://docs.google.com/document/d/1xUbIz5F-Bq3k5dt19SJN5dIy4QnvbQJ-Prq7pscEyAM/edit?usp=sharing