Documentation
¶
Index ¶
Constants ¶
const FlushTimeout = 2 * time.Second
FlushTimeout bounds how long the detached `chainloop telemetry flush` process spends delivering an event before giving up. The PostHog client takes it as the deadline for flushing its batch on close, and the flush command takes it as the deadline on the context it tracks with. Both read it from here so the two cannot drift apart. It does not bound anything the user waits for: the command that produced the event has already returned by the time the flush process runs.
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.
type Tags ¶
Tags represents a collection of event properties. Values are typed rather than stringified so numbers and booleans reach the analytics backend as numbers and booleans: a duration stored as "1234" cannot be averaged or bucketed into percentiles in an insight. Use String to read a value back as a string.
Note that "ci" stays a string ("true"/"false") on purpose. It reads like a boolean that was missed, but it has been a string in every event the CLI has ever sent, and changing its type now would split the existing dashboards across two property types.
func (Tags) IsInteractiveUserSession ¶ added in v1.108.6
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) String ¶ added in v1.115.0
String returns the value of key when it is a string, and "" when the key is absent or holds another type. Callers that compare a tag against a known string value go through it so a mistyped value reads as absent instead of panicking.
func (Tags) WithEnvironmentInfo ¶
WithEnvironmentInfo adds environment information to the Tags.
func (Tags) WithRuntimeInfo ¶
WithRuntimeInfo adds runtime information to the Tags.