tlc.core.utils.telemetry
#
Module Contents#
Classes#
Class |
Description |
---|---|
Hook into Jupyter’s excepthook to capture unhandled exceptions so that they get reported to Sentry. |
|
Telemetry class for 3LC. |
|
API#
- class tlc.core.utils.telemetry.JupyterExcepthookIntegration#
Bases:
sentry_sdk.integrations.Integration
Hook into Jupyter’s excepthook to capture unhandled exceptions so that they get reported to Sentry.
- identifier = jupyter_excepthook#
- class tlc.core.utils.telemetry.Telemetry#
Telemetry class for 3LC.
This class is responsible for initializing the telemetry system for 3LC.
Initialize the telemetry system.
- telemetry_instance: tlc.core.utils.telemetry.Telemetry | None = None#
- static instance() tlc.core.utils.telemetry.Telemetry #
Get the telemetry instance.
- static before_send_transaction(event: dict | None, hint: dict) dict | None #
Remove sensitive information from the URL.
- static before_send(event: dict[str, Any], hint: dict[str, Any]) dict[str, Any] | None #
Filter out exceptions that should not be sent to Sentry.
These are:
HTTPExceptions as these are handled errors in Starlite.
Exceptions that do not include tlc in the stacktrace. E.g. if the users has imported tlc in a notebook and triggers unrelated errors.
Some critical log messages we know happen during testing.
- static get_sentry_environment() str #
Get the Sentry environment.
This method uses various heuristics to determine the environment in which the code is running.
If the TLC_SENTRY_ENVIRONMENT environment variable is set, it will take precedence over the other logic.
If the tlc module is installed from a wheel, the environment will be set to “production”.
If neither of these are set, we will assume that we are running from a development environment.
- Returns:
The Sentry environment. By convention this will be one of “production”, “testing”, “staging”, or “development”.
- class tlc.core.utils.telemetry.RunningMessage(start_time: datetime.datetime)#