Documentation
¶
Overview ¶
Package telemetry provides opt-out anonymous usage telemetry for unum.
Telemetry is sent via OpenTelemetry (OTLP HTTP) and is disabled when:
- OTEL_EXPORTER_OTLP_ENDPOINT is empty (dev builds)
- DO_NOT_TRACK=1 or UNUM_NO_TELEMETRY=1 is set
- "telemetry": false in config.json
- --no-telemetry CLI flag is used
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Metrics ¶ added in v1.4.0
type Metrics struct {
// Invocations counts tool executions. Attributes: tool, mode, os, arch, version.
Invocations ometric.Int64Counter
// InputBytes records input file sizes in bytes. Attributes: tool.
InputBytes ometric.Int64Histogram
// Duration records processing time in seconds. Attributes: tool, mode.
Duration ometric.Float64Histogram
// Errors counts failed executions. Attributes: tool, error_type.
Errors ometric.Int64Counter
// JSONNodes records JSON node count per parse.
JSONNodes ometric.Int64Histogram
// DiffChanges counts added/removed/modified lines. Attributes: kind.
DiffChanges ometric.Int64Counter
// WebUploads counts file uploads to the hosted web UI. Attributes: tool.
WebUploads ometric.Int64Counter
}
Metrics holds pre-created OTel instruments for recording usage data. All instruments are initialised from a real or noop meter — never nil.
type Telemetry ¶
type Telemetry struct {
Umami *UmamiClient
M Metrics
// contains filtered or unexported fields
}
Telemetry is the unified facade for all telemetry systems. All methods are safe to call on a nil or disabled instance.
func Init ¶
Init creates a Telemetry instance. If telemetry is disabled (config, env, or missing endpoint), returns a fully functional but no-op instance.
func (*Telemetry) Close ¶
Close flushes pending telemetry data. Should be called before process exit.
func (*Telemetry) Disable ¶
func (t *Telemetry) Disable()
Disable switches telemetry to no-op mode. Called when --no-telemetry is set.
type UmamiClient ¶
type UmamiClient struct {
// contains filtered or unexported fields
}
UmamiClient sends page-level analytics events to a self-hosted Umami instance. Used only in web mode — CLI and TUI telemetry goes through OTel.
func NewUmami ¶
func NewUmami(endpoint, websiteID, hostname string) *UmamiClient
NewUmami creates a client. If endpoint or websiteID is empty, the client is disabled (all methods are no-ops).