telemetry

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package telemetry provides opt-in anonymized telemetry for the goflux library. Users must explicitly call Enable() to activate reporting. No data is sent without explicit user consent.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Disable

func Disable()

Disable stops telemetry reporting and flushes pending events.

func Enable

func Enable(endpoint, token string)

Enable activates telemetry reporting to the given endpoint. The endpoint should be a URL like "https://goflux-telemetry.your-account.workers.dev/v1/telemetry". An optional bearer token can be provided for basic authentication.

func Enabled

func Enabled() bool

Enabled reports whether telemetry is currently active.

func ReportError

func ReportError(err error, context map[string]string)

ReportError reports an error occurrence. The actual error message is hashed to protect user privacy. Only the error type and a deterministic hash are sent.

func ReportUsage

func ReportUsage(feature string, context map[string]string)

ReportUsage reports that a feature was used. This is useful for understanding which indicators, strategies, or utilities are most commonly used.

Types

type Payload

type Payload struct {
	V          int               `json:"v"`
	Ts         int64             `json:"ts"`
	LibVersion string            `json:"lib_version"`
	GoVersion  string            `json:"go_version"`
	OS         string            `json:"os"`
	Arch       string            `json:"arch"`
	Type       string            `json:"type"`
	Feature    string            `json:"feature,omitempty"`
	ErrorType  string            `json:"error_type,omitempty"`
	ErrorHash  string            `json:"error_hash,omitempty"`
	Context    map[string]string `json:"context,omitempty"`
}

Payload represents a single telemetry event.

type Reporter

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

Reporter handles telemetry reporting. A nil Reporter is safe to use and silently discards all reports.

func (*Reporter) Close

func (r *Reporter) Close()

Close shuts down the reporter, flushing pending events.

Jump to

Keyboard shortcuts

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