telemetry

package
v0.8.2 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: Apache-2.0, BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Overview

Package telemetry manages the telemetry mode file.

Index

Constants

View Source
const DisabledOnPlatform = false ||

	runtime.GOOS == "openbsd" ||
	runtime.GOOS == "solaris" ||
	runtime.GOOS == "android" ||

	runtime.GOOS == "js" ||
	runtime.GOOS == "wasip1" ||
	runtime.GOOS == "plan9" ||


	runtime.GOARCH == "386" // #60615 #60692 #60965 #60967

DisabledOnPlatform indicates whether telemetry is disabled due to bugs in the current platform.

Variables

View Source
var (
	// Default directory containing count files and local reports (not yet uploaded)
	LocalDir string
	// Default directory containing uploaded reports.
	UploadDir string
	// Default file path that holds the telemetry mode info.
	ModeFile ModeFilePath
)

The followings are the process' default Settings. The values are subdirectories and a file under os.UserConfigDir()/go/telemetry. For convenience, each field is made to global and they are not supposed to be changed.

Functions

func Mode

func Mode() (string, time.Time)

Mode returns the current telemetry mode, as well as the time that the mode was effective.

If there is no effective time, the second result is the zero time.

func SetMode

func SetMode(mode string) error

SetMode updates the telemetry mode with the given mode. Acceptable values for mode are "on", "off", or "local".

SetMode always writes the mode file, and explicitly records the date at which the modefile was updated. This means that calling SetMode with "on" effectively resets the timeout before the next telemetry report is uploaded.

Types

type ModeFilePath

type ModeFilePath string

ModeFilePath is the telemetry mode file path with methods to manipulate the file contents.

func (ModeFilePath) Mode

func (m ModeFilePath) Mode() (string, time.Time)

func (ModeFilePath) SetMode

func (m ModeFilePath) SetMode(mode string) error

func (ModeFilePath) SetModeAsOf

func (m ModeFilePath) SetModeAsOf(mode string, asofTime time.Time) error

SetModeAsOf is like SetMode, but accepts an explicit time to use to back-date the mode state. This exists only for testing purposes.

Jump to

Keyboard shortcuts

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