telemetry

package
v0.6.7 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package telemetry provides fire-and-forget error reporting for the CLI. It routes events to two sinks: Sentry (crash grouping) and the Studio beacon (org-aware error history). Neither sink blocks the caller.

Index

Constants

View Source
const SentryDSN = "https://fbd21a6ec48a39098e00fdeebf08a57e@o4511035617116160.ingest.de.sentry.io/4511473423941712"

SentryDSN for the CLI error-tracking project. The DSN is intentionally public — it is safe to embed in client binaries. See: https://docs.sentry.io/concepts/key-terms/dsn-explainer/#dsn-is-open

Variables

View Source
var ErrNotConfigured = errors.New("telemetry not configured (TelemetryKey not set — official builds only)")

ErrNotConfigured is returned by ReportSync when telemetry is not enabled.

View Source
var StudioURL = "https://studio.taufinity.io"

StudioURL is the base URL for the Studio beacon endpoint.

View Source
var TelemetryKey = ""

TelemetryKey is the shared secret for X-Telemetry-Key on the Studio beacon. Write-only endpoint + rate limiting makes this acceptable for a public binary. Set via -X github.com/taufinity/cli/internal/telemetry.TelemetryKey=... in CI builds. When empty (go install by users without ldflags), the beacon is silently skipped.

Functions

func Enabled added in v0.6.0

func Enabled() bool

Enabled reports whether telemetry is active (TelemetryKey set + device ID loaded).

func Flush

func Flush()

Flush waits for pending Sentry events to drain (call deferred from main).

func Init

func Init(version, commit string)

Init loads/creates the device ID and initialises the Sentry sink. version and commit are the ldflag-injected build vars from commands.Version / commands.GitCommit. Safe to call multiple times (idempotent after first call).

func Report

func Report(e Event)

Report sends a telemetry event to both sinks. Safe to call from any goroutine; the beacon is fire-and-forget (goroutine). No-op if Init() was not called or failed.

func ReportSync added in v0.6.0

func ReportSync(e Event, timeout time.Duration) error

ReportSync sends a telemetry event to the Studio beacon synchronously and returns an error if the beacon call failed. Use for diagnostic commands where the caller needs confirmation. The Sentry sink is still fire-and-forget. Returns ErrNotConfigured if telemetry is not enabled.

Types

type Event

type Event struct {
	// EventType is the dotted event name: "auth.failure", "update.failure", etc.
	EventType string
	// ErrorCode is a machine-readable short code: "device_code_expired".
	ErrorCode string
	// ErrorMessage is the human-readable error string. Scrubbed before sending.
	ErrorMessage string
	// Email is set when the CLI is authenticated; empty otherwise.
	Email string
}

Event is a single telemetry event.

Jump to

Keyboard shortcuts

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