telemetry

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2026 License: Apache-2.0 Imports: 15 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 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 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.

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