Documentation
¶
Overview ¶
Package telemetry is Flow-I's opt-in usage reporting.
It is off unless the user sets the telemetry setting to minimal or full, and nothing leaves the machine unless telemetry_endpoint is also set. What may be reported is fixed by Catalogue: every event and every value is listed there, either as a closed set of words or as a bucket, so a URL, a body, a name, an id or a path cannot be sent by mistake — Record and Payload.Validate refuse anything the catalogue does not name. There is no install id; payloads carry the day, not the time.
`flowi telemetry show` and the GUI dialog print exactly what Sample and Payload would send, and docs/reference/telemetry.md is generated from Catalogue.
Index ¶
Constants ¶
const ( EventAppStarted = "app_started" EventCommandRun = "command_run" EventRunFinished = "run_finished" )
Event names.
Variables ¶
var ErrNoEndpoint = errors.New("telemetry: no endpoint configured")
ErrNoEndpoint is returned when no telemetry_endpoint is configured: a build or installation without an endpoint sends nothing.
var ErrNotInCatalogue = errors.New("telemetry: not in the catalogue")
ErrNotInCatalogue is returned for an event, field or value the catalogue does not name.
Functions ¶
func CommandNames ¶
func CommandNames() []string
CommandNames is the closed set of command names a command_run event may carry. The CLI maps any other command to "other".
func Explanation ¶
func Explanation() string
Explanation is the plain-language statement shown wherever the user chooses a level.
Types ¶
type Client ¶
type Client struct {
App string `json:"app"` // cli | gui
Version string `json:"version"`
OS string `json:"os"`
Arch string `json:"arch"`
}
Client describes the running program.
type Collector ¶
type Collector struct {
// contains filtered or unexported fields
}
Collector gathers the events of one program run. It is safe for concurrent use. With LevelOff it keeps nothing.
func NewCollector ¶
NewCollector returns a collector for level; client is made safe first.
func (*Collector) Lower ¶
Lower reduces the level, dropping events the new level does not allow. It never raises it: turning telemetry down while the program runs must stop what was collected under the higher level from being sent.
func (*Collector) Observe ¶
Observe reports finished runs from the engine's events. It matches engine.Deps.Observe; it keeps only counts, never the events themselves.
func (*Collector) Payload ¶
Payload returns what would be sent. ok is false when nothing should be sent: telemetry is off, or there is nothing to report.
type EventSpec ¶
type EventSpec struct {
Name string
Doc string
Level Level // the lowest level that reports it
Fields []FieldSpec
}
EventSpec is one reportable event.
type Level ¶
type Level int
Level is how much the user allows to be reported.
Levels, in increasing order of what is reported.
func ParseLevel ¶
ParseLevel reads the telemetry setting; anything unknown is off.
type Payload ¶
type Payload struct {
Schema int `json:"schema"`
Date string `json:"date"` // YYYY-MM-DD, UTC; no time of day
Level string `json:"level"`
Client Client `json:"client"`
Events []Event `json:"events"`
}
Payload is everything one report contains.