Documentation
¶
Overview ¶
Package telemetry provides telemetry functionality for the ToolHive operator.
Index ¶
Constants ¶
This section is empty.
Variables ¶
ErrInstanceIDUnavailable is returned by EnsureInstanceID when the ID could not be read or stored because of errors that may be transient (the API server is unreachable, overloaded or timing out). The caller should exit and let the pod restart rather than run without the ID: workload pod templates carry it, so a replica running without it would roll every workload when it becomes the leader, and roll them back when leadership moves again.
var InstanceIDBackoff = wait.Backoff{Steps: 5, Duration: time.Second, Factor: 2, Jitter: 0.1}
InstanceIDBackoff is how EnsureInstanceID retries at operator startup: five attempts over about 15 seconds.
Functions ¶
This section is empty.
Types ¶
type LeaderTelemetryRunnable ¶
type LeaderTelemetryRunnable struct {
TelemetryService *Service
}
LeaderTelemetryRunnable runs telemetry checks only when this instance is the leader
func (*LeaderTelemetryRunnable) NeedsLeaderElection ¶
func (*LeaderTelemetryRunnable) NeedsLeaderElection() bool
NeedsLeaderElection indicates whether this runnable needs leader election
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service handles telemetry operations for the operator
func NewService ¶
NewService creates a new Service instance
func (*Service) CheckForUpdates ¶
CheckForUpdates checks for updates and sends telemetry data
func (*Service) EnsureInstanceID ¶ added in v0.66.0
func (s *Service) EnsureInstanceID(ctx context.Context, reader client.Reader, backoff wait.Backoff) (string, error)
EnsureInstanceID returns this operator installation's instance ID, creating and storing it in the telemetry ConfigMap if it does not exist yet, or if the ConfigMap holds no usable ID. It is meant to run once at startup, before the manager's cache starts, so it reads through the given uncached reader.
Errors that may be transient are retried with the given backoff, within an overall deadline; if they persist, the error wraps ErrInstanceIDUnavailable. Errors that a retry cannot fix (forbidden, unauthorized, invalid) are returned at once: every replica gets the same error, so they all run without the ID and agree. Concurrent replicas may race to write the ID; the loser reads the winner's ID. Returns an empty ID when update checks are disabled, without touching the ConfigMap.
func (*Service) StartTelemetryWorker ¶
StartTelemetryWorker starts a background worker that periodically checks for updates This should only be called by the leader