telemetry.errors

telemetry.errors

Telemetry utilities for exception and traceback information.

Functions

Name Description
sanitize_stack_trace Remove personal information from stack trace messages while keeping Python package codepaths.
send_errors Decorator to send exception info in a function. If an exception is raised, we send

sanitize_stack_trace

telemetry.errors.sanitize_stack_trace(stack_trace)

Remove personal information from stack trace messages while keeping Python package codepaths.

This function identifies Python packages by looking for common patterns in virtual environment and site-packages directories, preserving the package path while removing user-specific paths.

Parameters

Name Type Description Default
stack_trace str The original stack trace string. required

Returns

Name Type Description
str A sanitized version of the stack trace with Python package paths preserved.

send_errors

telemetry.errors.send_errors(func)

Decorator to send exception info in a function. If an exception is raised, we send telemetry containing the stack trace and error message.

If an error occurs in a decorated function that is called by another decorated function, we’ll only send telemetry corresponding to the lower-level function.

Parameters

Name Type Description Default
func Callable Function to decorate. required

Returns

Name Type Description
Callable Decorated function.