Documentation
¶
Index ¶
- Constants
- func BuildCommandProperties(cmd *cobra.Command, args []string, duration time.Duration, execErr error) map[string]any
- func CategorizeError(err error) string
- func DetectShell() string
- func Drain(timeout time.Duration)
- func ExtractCommandPath(cmd *cobra.Command) (string, string, string)
- func ExtractSanitizedFlags(cmd *cobra.Command) []string
- func FormatEndpoint(baseURL string) string
- func Identify(properties map[string]any)
- func Init(cfg config.TelemetryConfig, verbose bool)
- func IsCI() bool
- func IsInteractive() bool
- func SetClient(c *Client)
- func TestConnection(cfg config.TelemetryConfig) (int, error)
- func Track(name string, properties map[string]any)
- func TrackCommand(cmd *cobra.Command, args []string, duration time.Duration, execErr error)
- type Client
- type EventData
- type Payload
Constants ¶
const ( EventCommandExecuted = "cli_command_executed" EventDoctorRun = "doctor_diagnostics_run" EventTestConnection = "telemetry_connection_tested" )
Event names
Variables ¶
This section is empty.
Functions ¶
func BuildCommandProperties ¶
func BuildCommandProperties(cmd *cobra.Command, args []string, duration time.Duration, execErr error) map[string]any
BuildCommandProperties constructs a standardized, sanitized properties map for command execution.
func CategorizeError ¶
CategorizeError categorizes an error without revealing private paths, tokens, or messages.
func DetectShell ¶
func DetectShell() string
DetectShell attempts to identify the current shell from the environment.
func ExtractCommandPath ¶
ExtractCommandPath returns the sanitized command path (e.g. "git sync").
func ExtractSanitizedFlags ¶
ExtractSanitizedFlags extracts ONLY the names of flags that were explicitly changed/passed, deliberately omitting flag values to prevent accidental leakage of sensitive tokens or paths.
func FormatEndpoint ¶
FormatEndpoint constructs the full URL for the OpenPanel track endpoint.
func Init ¶
func Init(cfg config.TelemetryConfig, verbose bool)
Init initializes the global telemetry client.
func IsCI ¶
func IsCI() bool
IsCI returns true if the current environment is detected as a Continuous Integration runner.
func IsInteractive ¶
func IsInteractive() bool
IsInteractive checks if standard output is connected to an interactive terminal TTY.
func SetClient ¶
func SetClient(c *Client)
SetClient replaces the global telemetry client (primarily used in tests).
func TestConnection ¶
func TestConnection(cfg config.TelemetryConfig) (int, error)
TestConnection sends a synchronous test event to verify endpoint and credentials.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a client for sending events to an OpenPanel instance.
func NewClient ¶
func NewClient(cfg config.TelemetryConfig, verbose bool) *Client
NewClient initializes a new OpenPanel telemetry client.
func (*Client) Drain ¶
Drain flushes pending events and waits for the worker to finish up to the given timeout.