telemetry

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PrintNotice

func PrintNotice()

PrintNotice prints the first-run telemetry notice to stderr.

Types

type Properties

type Properties struct {
	Version   string   `json:"version"`
	GoVersion string   `json:"go_version"`
	OS        string   `json:"os"`
	Arch      string   `json:"arch"`
	DBTypes   []string `json:"db_types"`
	Services  int      `json:"service_count"`
	Tables    int      `json:"table_count"`
	Admins    int      `json:"admin_count"`
	APIKeys   int      `json:"api_key_count"`
	Roles     int      `json:"role_count"`
	Features  []string `json:"features"`
	UptimeHrs float64  `json:"uptime_hours"`
}

Properties holds the telemetry payload sent to PostHog.

type PropertiesFunc

type PropertiesFunc func() Properties

PropertiesFunc is called each flush to gather current state.

type SettingsStore

type SettingsStore interface {
	GetSetting(ctx context.Context, key string) (string, error)
	SetSetting(ctx context.Context, key, value string) error
}

SettingsStore is the interface the telemetry package needs from the config store.

type Tracker

type Tracker struct {
	// contains filtered or unexported fields
}

Tracker manages anonymous telemetry reporting to PostHog.

func New

func New(ctx context.Context, store SettingsStore, propsFn PropertiesFunc) *Tracker

New creates a Tracker. It resolves (or generates) the instance ID from the settings store. Returns nil if telemetry is disabled via env var, settings, or if no API key was injected at build time (e.g. dev builds from source).

func (*Tracker) Shutdown

func (t *Tracker) Shutdown()

Shutdown stops the background loop and sends a final event.

func (*Tracker) Start

func (t *Tracker) Start()

Start begins the background telemetry loop. It sends an initial event immediately and then repeats every hour. Non-blocking.

Jump to

Keyboard shortcuts

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