Documentation
¶
Overview ¶
Package telemetry sends one minimal, anonymous event per startup and per day so the project can count installations. It is fire-and-forget: a failure is logged at debug and never affects the platform.
Index ¶
Constants ¶
const ( EventStartup = "startup" EventDaily = "daily" )
Events a payload can carry.
const ( PlatformStandalone = "standalone" PlatformSwarm = "swarm" )
Platforms the control plane reports.
const Endpoint = "https://miabi.io/api/v1/telemetry/installations"
const SchemaVersion = 1
SchemaVersion is the payload format the receiver validates against.
Variables ¶
This section is empty.
Functions ¶
func InstallationID ¶
InstallationID derives the anonymous id sent for an Install ID.
Types ¶
type Options ¶
type Options struct {
URL string
Version string
InstallID string
Enabled bool
Edition func() string
Platform func() string
Redis redis.Cmdable
}
Options wires the service to the platform. The funcs are read at send time so a licence install or a swarm change is reflected without a restart.
type Payload ¶
type Payload struct {
Schema int `json:"schema"`
InstallationID string `json:"installation_id"`
Event string `json:"event"`
Version string `json:"version"`
Edition string `json:"edition"`
Platform string `json:"platform"`
OS string `json:"os"`
Arch string `json:"arch"`
}
Payload is everything a telemetry event contains.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service builds and sends telemetry events.
func (*Service) Enabled ¶
Enabled reports whether events are sent at all. Non-release builds never send so development and CI don't count as installations.
func (*Service) Send ¶
Send posts one event when enabled. The response is never interpreted beyond its status.
func (*Service) SendStartup ¶
SendStartup sends the startup event after a random 1–5 minute delay, at most once per version per hour across every control plane sharing Redis. Run it in a goroutine; it returns when ctx is done or the send finished.