pykoi.telemetry package#

Submodules#

pykoi.telemetry.events module#

This module contains telemetry events for PyKoi.

class pykoi.telemetry.events.AppStartEvent(start_time: float, date_time: str, gpu: bool = False, cloud_provider: str = 'Unknown', system: str = 'Darwin', release: str = '22.4.0')[source]#

Bases: TelemetryEvent

A telemetry event that is triggered when the application starts.

name#

The name of the event.

Type:

str

start_time#

The time when the application started.

Type:

float

date_time#

The date and time when the application started.

Type:

str

gpu#

Whether or not a GPU is available.

Type:

bool

cloud_provider#

The name of the cloud provider, if running on a cloud platform.

Type:

str

system#

The name of the operating system.

Type:

str

release#

The release version of the operating system.

Type:

str

cloud_provider: str = 'Unknown'#
date_time: str#
gpu: bool = False#
name: ClassVar[str] = 'app_start'#
release: str = '22.4.0'#
start_time: float#
system: str = 'Darwin'#
class pykoi.telemetry.events.AppStopEvent(end_time: float, date_time: str, duration: str)[source]#

Bases: TelemetryEvent

A telemetry event that is triggered when the application stops.

name#

The name of the event.

Type:

str

end_time#

The time when the application stopped.

Type:

float

date_time#

The date and time when the application stopped.

Type:

str

duration#

The duration of the application.

Type:

str

date_time: str#
duration: str#
end_time: float#
name: ClassVar[str] = 'app_end'#
class pykoi.telemetry.events.TelemetryEvent[source]#

Bases: object

Represents a telemetry event.

name#

The name of the telemetry event.

Type:

ClassVar[str]

name: ClassVar[str]#
property properties: Dict[str, Any]#

Returns the properties of the telemetry event.

Returns:

The properties of the telemetry event.

Return type:

Dict[str, Any]

pykoi.telemetry.events.identify_cloud_provider()[source]#

Identify the cloud provider that the code is running on.

pykoi.telemetry.telemetry module#

This module contains telemetry for PyKoi.

class pykoi.telemetry.telemetry.Telemetry(enable_telemetry: bool = True)[source]#

Bases: object

A class for capturing telemetry events and sending them to Posthog.

_user_id_path#

The path to the file containing the user ID.

Type:

str

_user_id#

The user ID.

Type:

str

_unknown#

The default value for the user ID if it cannot be determined.

Type:

str

capture(event: TelemetryEvent) None[source]#

Captures a telemetry event and sends it to Posthog.

Parameters:

event (TelemetryEvent) – The telemetry event to capture.

property context: Dict[str, Any]#

Gets the context for the telemetry events.

Returns:

A dictionary containing the context for the telemetry events.

property user_id: str#

Gets the user ID for the telemetry events.

Returns:

The user ID for the telemetry events.

Module contents#