telemetry

package
v1.108.6 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const FlushTimeout = 2 * time.Second

FlushTimeout bounds how long the CLI spends delivering a telemetry event. The PostHog client takes it as the deadline for flushing its batch on close, and the command hook takes it as the deadline after which it stops waiting on the delivery goroutine. Both read it from here so the two deadlines cannot drift apart.

View Source
const UnrecognisedUserID = "unrecognised"

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	TrackEvent(ctx context.Context, eventName string, id string, tags Tags) error
}

Client defines the interface for tracking events.

type CommandTracker

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

CommandTracker is an implementation in charge of tracking Commands events sent from the CLI.

func NewCommandTracker

func NewCommandTracker(client Client) *CommandTracker

NewCommandTracker creates a new CommandTracker instance.

func (*CommandTracker) Track

func (t *CommandTracker) Track(ctx context.Context, cmd string, tags Tags) error

Track sends a command event to the telemetry.Client.

type Tags

type Tags map[string]string

Tags represents a collection of event tags.

func (Tags) IsInteractiveUserSession added in v1.108.6

func (tg Tags) IsInteractiveUserSession() bool

IsInteractiveUserSession reports whether the command was run by a logged-in human outside of CI. API and federated tokens are shared identities: an API token belongs to an organization rather than a person, and a federated token resolves to the issuer URL, which is the same value for every Chainloop installation using that provider. Anything derived from the machine the command ran on is only meaningful for the interactive case.

func (Tags) WithEnvironmentInfo

func (tg Tags) WithEnvironmentInfo() Tags

WithEnvironmentInfo adds environment information to the Tags.

func (Tags) WithRuntimeInfo

func (tg Tags) WithRuntimeInfo() Tags

WithRuntimeInfo adds runtime information to the Tags.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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