telemetry

package
v1.20.0 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2026 License: MIT Imports: 7 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

func (t *Telemetry) SetBool(name string, v bool)

SetBool records a boolean attribute. A later call with the same name replaces the earlier value.

func (*Telemetry) SetEnum

func (t *Telemetry) SetEnum(name, v string, allowed ...string)

SetEnum records v under name when v is one of allowed. Any other v, or an empty allowed list, is ignored. A later call with the same name replaces the earlier value.

func (*Telemetry) SetInt

func (t *Telemetry) SetInt(name string, v int)

SetInt records an integer attribute. A later call with the same name replaces the earlier value.

Jump to

Keyboard shortcuts

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