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. |
|
Base class for telemetry spans that defines the common interface and shared functionality. |
|
A telemetry span that assumes a top-level transaction is already in place |
|
A top-level telemetry transaction span. |
|
A telemetry span for long-running operations that you do not want to wait to finish before getting any telemetry. Sends an instantaneous transaction at start and stop and at a regular heartbeat interval. |
|
Data¶
Data |
Description |
---|---|
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¶
- tlc.core.utils.telemetry.TELEMETRY_SPAN_OP_DEFAULT = 3lc.telemetry¶
- class tlc.core.utils.telemetry.Telemetry¶
Telemetry class for 3LC.
This class is responsible for initializing the telemetry system for 3LC.
- telemetry_instance: tlc.core.utils.telemetry.Telemetry | None = None¶
- static instance() tlc.core.utils.telemetry.Telemetry ¶
Get the telemetry instance.
- 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”, unless the user is an internal 3LC user, in which case it will be set to “development”.
If neither of those conditions is met (i.e. TLC_SENTRY_ENVIRONMENT is not set and we are running from source), the environment will be set to “local”.
- static get_sentry_config() tlcsaas.sentry_config.SentryConfiguration ¶
- LogLevelStr = None¶
- capture_message(message_text: str, message_tags: dict[str, Any] | None = None, message_extras: dict[str, Any] | None = None, level: LogLevelStr = 'info', include_stack_trace: bool = False) None ¶
- capture_instantaneous_span(*, span_name: str, span_op: str = TELEMETRY_SPAN_OP_DEFAULT, span_tags: dict[str, Any] | None = None, span_data: dict[str, Any] | None = None, is_create_transaction_if_none: bool = False) str ¶
- class tlc.core.utils.telemetry.BaseTelemetrySpan(span_name: str, *, is_include_exit_on_error: bool = False, is_include_object_service: bool = False, get_enter_tags: Callable[[], dict[str, Any]] | None = None, get_enter_data: Callable[[], dict[str, Any]] | None = None, get_exit_tags: Callable[[], dict[str, Any]] | None = None, get_exit_data: Callable[[], dict[str, Any]] | None = None)¶
Bases:
abc.ABC
Base class for telemetry spans that defines the common interface and shared functionality.
- class tlc.core.utils.telemetry.TelemetrySpan(span_name: str, *, span_op: str = TELEMETRY_SPAN_OP_DEFAULT, is_include_exit_on_error: bool = False, is_include_object_service: bool = False, get_enter_tags: Callable[[], dict[str, Any]] | None = None, get_enter_data: Callable[[], dict[str, Any]] | None = None, get_exit_tags: Callable[[], dict[str, Any]] | None = None, get_exit_data: Callable[[], dict[str, Any]] | None = None)¶
Bases:
tlc.core.utils.telemetry.BaseTelemetrySpan
A telemetry span that assumes a top-level transaction is already in place
- create_span() sentry_sdk.tracing.Span ¶
- class tlc.core.utils.telemetry.TelemetryTransaction(transaction_name: str, *, transaction_op: str = TELEMETRY_SPAN_OP_DEFAULT, is_include_exit_on_error: bool = False, is_include_object_service: bool = False, get_enter_tags: Callable[[], dict[str, Any]] | None = None, get_enter_data: Callable[[], dict[str, Any]] | None = None, get_exit_tags: Callable[[], dict[str, Any]] | None = None, get_exit_data: Callable[[], dict[str, Any]] | None = None)¶
Bases:
tlc.core.utils.telemetry.TelemetrySpan
A top-level telemetry transaction span.
- create_span() sentry_sdk.tracing.Span ¶
- class tlc.core.utils.telemetry.MultiTransactionTelemetrySpan(span_name: str, *, span_op: str = TELEMETRY_SPAN_OP_DEFAULT, is_include_exit_on_error: bool = False, is_include_object_service: bool = False, get_enter_tags: Callable[[], dict[str, Any]] | None = None, get_enter_data: Callable[[], dict[str, Any]] | None = None, get_exit_tags: Callable[[], dict[str, Any]] | None = None, get_exit_data: Callable[[], dict[str, Any]] | None = None, get_heartbeat_tags: Callable[[], dict[str, Any]] | None = None, get_heartbeat_data: Callable[[], dict[str, Any]] | None = None, heartbeat_interval: datetime.timedelta | None = None, start_message: str | None = None, stop_message: str | None = None, heartbeat_message: str | None = None)¶
Bases:
tlc.core.utils.telemetry.BaseTelemetrySpan
A telemetry span for long-running operations that you do not want to wait to finish before getting any telemetry. Sends an instantaneous transaction at start and stop and at a regular heartbeat interval.
- class tlc.core.utils.telemetry.ObjectServiceTelemetrySpan(*, tui: bool, with_public_examples: bool, ngrok: bool)¶
Bases:
tlc.core.utils.telemetry.MultiTransactionTelemetrySpan