telemetry

package
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 14, 2026 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CaptureException

func CaptureException(typ, value string, extra map[string]interface{})

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 Enabled

func Enabled() bool

Enabled reports whether telemetry is active.

func GetOrCreateDeviceID

func GetOrCreateDeviceID() (string, error)

GetOrCreateDeviceID loads the device ID from the system keychain, or generates and stores a new one if none exists.

func HashWorkflowName

func HashWorkflowName(name string) string

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 Shutdown

func Shutdown()

Shutdown flushes pending events and closes the client.

func Track

func Track(event string, properties map[string]interface{})

Track sends an event to PostHog with common properties merged in.

func TrackDaemonStarted

func TrackDaemonStarted(startupDurationMs int64)

TrackDaemonStarted records daemon startup duration.

func TrackPanic

func TrackPanic(where string, r interface{}, stack []byte)

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.

func Version

func Version() string

Version returns the build version string set via Init (or "dev" if unset).

Types

type Config

type Config struct {
	Version string // build version
	Mode    string // "tui", "headless", "daemon"
	Enabled bool   // false disables all telemetry (from settings.json feature flag)
}

Config controls telemetry initialization.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL