Documentation
¶
Index ¶
- func CaptureException(typ, value string, extra map[string]interface{})
- func Enabled() bool
- func GetOrCreateDeviceID() (string, error)
- func HashWorkflowName(name string) string
- func Init(cfg Config)
- func Shutdown()
- func Track(event string, properties map[string]interface{})
- func TrackDaemonStarted(startupDurationMs int64)
- func TrackPanic(where string, r interface{}, stack []byte)
- func TrackTUIEnded()
- func TrackTUIStarted(appMode, appVersion string)
- func TrackTurn(model string)
- func Version() string
- type Config
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CaptureException ¶
CaptureException reports an error or panic to PostHog error tracking. typ is the title shown in the UI (e.g. "panic"); value is the description. extra carries additional context properties (e.g. the raw goroutine stack) that surface in the exception's Properties tab. Safe to call when telemetry is disabled (no-op).
We build the $exception event by hand via posthog.Capture rather than posthog.NewDefaultException: the SDK's Exception type exposes no arbitrary properties map, so common/extra context could not otherwise reach the Properties tab. PostHog's error tracking ingests any event named "$exception" that carries an "$exception_list" property, so this is equivalent to what Exception.APIfy() emits, plus our extra properties.
func GetOrCreateDeviceID ¶
GetOrCreateDeviceID loads the device ID from the system keychain, or generates and stores a new one if none exists.
func HashWorkflowName ¶
HashWorkflowName returns a truncated SHA256 hex digest of the workflow name.
func Init ¶
func Init(cfg Config)
Init initializes the telemetry client. Safe to call multiple times; only the first call takes effect.
func TrackDaemonStarted ¶
func TrackDaemonStarted(startupDurationMs int64)
TrackDaemonStarted records daemon startup duration.
func TrackPanic ¶
TrackPanic reports a recovered panic as a PostHog exception, including the recovered value and the goroutine stack. where identifies the recover site (e.g. "vix.main", "session.Run"). The raw goroutine stack is attached as the go_stack property (authoritative trace) alongside the structured frames.
func TrackTUIEnded ¶ added in v0.4.3
func TrackTUIEnded()
TrackTUIEnded records that the client is shutting down, with the duration of the current session. Idempotent (endOnce): the client fires it from a defer that may also run while a panic unwinds, but it should be emitted at most once.
func TrackTUIStarted ¶
func TrackTUIStarted(appMode, appVersion string)
TrackTUIStarted records that the TUI or headless client launched.
func TrackTurn ¶ added in v0.4.3
func TrackTurn(model string)
TrackTurn records a genuine user turn (a prompt or workflow submission), tagged with the model handling it. It gives PostHog an activity signal between tui_started and tui_ended, and keeps the session ID from rotating mid-use. The model is fixed for the duration of a turn, so capturing it here records which model was used for that turn.