package telemetry

import "cuelang.org/go/internal/golangorgx/telemetry"

Index

Functions

func Mode

func Mode() string

Mode returns the current telemetry mode.

The telemetry mode is a global value that controls both the local collection and uploading of telemetry data. Possible mode values are:

When mode is "on", or "local", telemetry data is written to the local file system and may be inspected with the gotelemetry command.

If an error occurs while reading the telemetry mode from the file system, Mode returns the default value "local".

func SetMode

func SetMode(mode string) error

SetMode sets the global telemetry mode to the given value.

See the documentation of Mode for a description of the supported mode values.

An error is returned if the provided mode value is invalid, or if an error occurs while persisting the mode value to the file system.

Types

type CounterConfig

type CounterConfig struct {
	Name  string
	Rate  float64 // If X <= Rate, report this counter
	Depth int     `json:",omitempty"` // for stack counters
}

type ProgramConfig

type ProgramConfig struct {
	// the counter names may have to be
	// repeated for each program. (e.g., if the counters are in a package
	// that is used in more than one program.)
	Name     string
	Versions []string        // versions present in a counterconfig
	Counters []CounterConfig `json:",omitempty"`
	Stacks   []CounterConfig `json:",omitempty"`
}

type ProgramReport

type ProgramReport struct {
	Program   string
	Version   string
	GoVersion string
	GOOS      string
	GOARCH    string
	Counters  map[string]int64
	Stacks    map[string]int64
}

type Report

type Report struct {
	Week     string  // first day this report covers (YYYY-MM-DD)
	LastWeek string  // Week field from latest previous report uploaded
	X        float64 // A random probability used to determine which counters are uploaded
	Programs []*ProgramReport
	Config   string // version of UploadConfig used
}

A Report is what's uploaded (or saved locally)

type UploadConfig

type UploadConfig struct {
	GOOS       []string
	GOARCH     []string
	GoVersion  []string
	SampleRate float64
	Programs   []*ProgramConfig
}

An UploadConfig controls what data is uploaded.

Source Files

doc.go mode.go types.go

Directories

PathSynopsis
internal/golangorgx/telemetry/counterPackage counter implements a simple counter system for collecting totally public telemetry data.
internal/golangorgx/telemetry/crashmonitor
internal/golangorgx/telemetry/internal
internal/golangorgx/telemetry/internal/configpackage config provides methods for loading and querying a telemetry upload config file.
internal/golangorgx/telemetry/internal/configstorePackage configstore abstracts interaction with the telemetry config server.
internal/golangorgx/telemetry/internal/counterPackage internal/counter implements the internals of the public counter package.
internal/golangorgx/telemetry/internal/mmapThe mmap package provides an abstraction for memory mapping files on different platforms.
internal/golangorgx/telemetry/internal/telemetryPackage telemetry manages the telemetry mode file.
internal/golangorgx/telemetry/internal/upload
internal/golangorgx/telemetry/upload
Version
v0.12.0 (latest)
Published
Jan 30, 2025
Platform
linux/amd64
Imports
1 packages
Last checked
8 hours ago

Tools for package owners.