Help us shape the future of Go! Take the 2026 Go Developer Survey

telemetry

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// PostHogAPIKey is set at build time for production
	PostHogAPIKey = "phc_development_key"
	// PostHogEndpoint is set at build time for production
	PostHogEndpoint = "https://eu.i.posthog.com"
)

Functions

func SendEvent

func SendEvent(payloadJSON string)

SendEvent processes an event payload in the detached subprocess. This is called by the hidden __send_analytics command.

func TrackCommandDetached

func TrackCommandDetached(cmd *cobra.Command, agent string, isTraceEnabled bool, version string)

TrackCommandDetached tracks a command execution by spawning a detached subprocess. This returns immediately without blocking the CLI.

Telemetry can be disabled by setting the TRACE_TELEMETRY_OPTOUT environment variable to any non-empty value (e.g., TRACE_TELEMETRY_OPTOUT=1).

func TrackPluginDetached

func TrackPluginDetached(pluginName string, isTraceEnabled bool, version string)

TrackPluginDetached tracks a plugin invocation by spawning a detached subprocess. This returns immediately without blocking the CLI.

Types

type EventPayload

type EventPayload struct {
	Event      string         `json:"event"`
	DistinctID string         `json:"distinct_id"`
	Properties map[string]any `json:"properties"`
	Timestamp  time.Time      `json:"timestamp"`
}

EventPayload represents the data passed to the detached subprocess. Note: APIKey and Endpoint are intentionally excluded to avoid exposing them in process listings (ps/top). SendEvent reads them from package-level vars.

func BuildEventPayload

func BuildEventPayload(cmd *cobra.Command, agent string, isTraceEnabled bool, version string) *EventPayload

BuildEventPayload constructs the event payload for tracking. Exported for testing. Returns nil if the payload cannot be built.

func BuildPluginEventPayload

func BuildPluginEventPayload(pluginName string, isTraceEnabled bool, version string) *EventPayload

BuildPluginEventPayload creates a telemetry payload for a plugin invocation.

Jump to

Keyboard shortcuts

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