telemetry

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PingIntervalSecs = 23 * 3600 // 23 hours between pings
)

Configuration

Variables

View Source
var (
	TelemetryURL   string
	TelemetryToken string
)

TelemetryURL and Token can be set at build time via ldflags.

Functions

func Init added in v1.2.0

func Init(stats StatsProvider)

Init initializes the global telemetry client.

func IsEnabled added in v0.28.0

func IsEnabled() bool

IsEnabled returns whether telemetry is configured.

func IsOptedOut added in v1.2.0

func IsOptedOut() bool

IsOptedOut checks if telemetry is explicitly disabled.

func MaybePing added in v1.2.0

func MaybePing()

MaybePing sends a telemetry ping using the global client.

Types

type Client added in v1.2.0

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

Client handles telemetry ping operations.

func NewClient added in v1.2.0

func NewClient(stats StatsProvider) *Client

NewClient creates a new telemetry client.

func (*Client) MaybePing added in v1.2.0

func (c *Client) MaybePing()

MaybePing sends a telemetry ping if enabled and not already sent today. This is fire-and-forget: errors are silently ignored.

type StatsProvider added in v1.2.0

type StatsProvider interface {
	CountCommandsSince(since time.Time) (int64, error)
	TopCommands(limit int) ([]string, error)
	OverallSavingsPct() (float64, error)
	TokensSaved24h() (int64, error)
	TokensSavedTotal() (int64, error)
}

StatsProvider defines the interface for getting tracking stats.

Jump to

Keyboard shortcuts

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