Documentation
¶
Overview ¶
Package telemetry sends an extension's typed telemetry attributes to the CircleCI CLI that started it.
The extension calls FromEnv once, early in main. It then calls the Set* methods as it learns things, and calls Telemetry.Send once at its top-level return, before os.Exit. Telemetry is best effort: nothing in this package returns an error, and it never changes the extension's exit code.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Telemetry ¶
type Telemetry struct {
// contains filtered or unexported fields
}
Telemetry collects an extension's typed attributes and sends them to the CLI. A nil *Telemetry, or one made while the variable was unset, does nothing.
func FromEnv ¶
func FromEnv() *Telemetry
FromEnv reads CIRCLE_TELEMETRY_SOCKET and removes it from the process environment, so child processes the extension starts do not inherit it. Every call returns the same *Telemetry; call it once, early in main.
func (*Telemetry) Send ¶
func (t *Telemetry) Send()
Send writes the collected attributes to the CLI in one JSON object. A second call, and any Set call after the first, does nothing. Send does not block Set calls from other goroutines while it writes to the socket, and it returns without waiting when nobody listens.
func (*Telemetry) SetBool ¶
SetBool records a boolean attribute. A later call with the same name replaces the earlier value.