types

package
v0.0.0-...-a5a9a89 Latest Latest
Warning

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

Go to latest
Published: May 20, 2026 License: Apache-2.0 Imports: 1 Imported by: 4

Documentation

Overview

Package types implements the types used by the Cluster checks dispatching functionality.

Index

Constants

View Source
const (
	// ExtraHeartbeatLastChangeValue is used to instruct the Cluster Agent that we're still alive
	// despite that the polling loop on CLC side is delayed.
	ExtraHeartbeatLastChangeValue int64 = -1
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CLCRunnerStats

type CLCRunnerStats struct {
	AverageExecutionTime int    `json:"AverageExecutionTime"`
	MetricSamples        int    `json:"MetricSamples"`
	HistogramBuckets     int    `json:"HistogramBuckets"`
	Events               int    `json:"Events"`
	ServiceChecks        int    `json:"ServiceChecks"`
	IsClusterCheck       bool   `json:"IsClusterCheck"`
	LastExecFailed       bool   `json:"LastExecFailed"`
	LastError            string `json:"LastError"`
	TotalRuns            uint64 `json:"TotalRuns"`
	TotalErrors          uint64 `json:"TotalErrors"`
	TotalMetricSamples   uint64 `json:"TotalMetricSamples"`
	TotalEvents          uint64 `json:"TotalEvents"`
	TotalServiceChecks   uint64 `json:"TotalServiceChecks"`
	LastSuccessDate      int64  `json:"LastSuccessDate"`
	LastExecutionDate    int64  `json:"LastExecutionDate"`
}

CLCRunnerStats is used to unmarshall the stats of each CLC Runner

type CLCRunnersStats

type CLCRunnersStats map[string]CLCRunnerStats

CLCRunnersStats is used to unmarshall the CLC Runners stats payload

type ConfigResponse

type ConfigResponse struct {
	LastChange int64                `json:"last_change"`
	Configs    []integration.Config `json:"configs"`
}

ConfigResponse holds the DCA response for a config query

type ConfigWithInstanceIDs

type ConfigWithInstanceIDs struct {
	InstanceIDs []string           `json:"instance_ids"`
	Config      integration.Config `json:"config"`
}

ConfigWithInstanceIDs pairs a config with its precomputed instance IDs. Instance IDs are computed from unscrubbed configs at dispatch time so they match the runner's check IDs regardless of config scrubbing.

type IsolateResponse

type IsolateResponse struct {
	CheckID    string `json:"check_id"`
	CheckNode  string `json:"check_node"`
	IsIsolated bool   `json:"is_isolated"`
	Reason     string `json:"reason"`
}

IsolateResponse holds the DCA response for an isolate request

type LeaderIPCallback

type LeaderIPCallback func() (string, error)

LeaderIPCallback describes the leader-election method we need and allows to inject a custom one for tests

type NodeStatus

type NodeStatus struct {
	LastChange int64    `json:"last_change"`
	NodeType   NodeType `json:"node_type,omitempty"`
}

NodeStatus holds the status report from the node-agent

type NodeType

type NodeType uint8

NodeType represents the type of node reporting status to the cluster agent. It is used to distinguish between CLC runners, node agents, and unknown types.

const (
	// NodeTypeCLCRunner represents a cluster check runner.
	NodeTypeCLCRunner NodeType = 1
	// NodeTypeNodeAgent represents a node agent.
	NodeTypeNodeAgent NodeType = 2
)

type RebalanceResponse added in v0.9.0

type RebalanceResponse struct {
	CheckID     string `json:"check_id"`
	CheckWeight int    `json:"check_weight"`

	SourceNodeName string `json:"source_node_name"`
	SourceDiff     int    `json:"source_diff"`

	DestNodeName string `json:"dest_node_name"`
	DestDiff     int    `json:"dest_diff"`
}

RebalanceResponse holds the DCA response for a rebalancing request

type StateNodeResponse

type StateNodeResponse struct {
	Name    string                  `json:"name"`
	Configs []ConfigWithInstanceIDs `json:"configs"`
	Stats   CLCRunnersStats         `json:"stats,omitempty"`
}

StateNodeResponse is a chunk of StateResponse

type StateResponse

type StateResponse struct {
	NotRunning string               `json:"not_running"` // Reason why not running, empty if leading
	Warmup     bool                 `json:"warmup"`
	Nodes      []StateNodeResponse  `json:"nodes"`
	Dangling   []integration.Config `json:"dangling"`
}

StateResponse holds the DCA response for a dispatching state query

type Stats

type Stats struct {
	// Following
	Follower bool
	LeaderIP string

	// Leading
	Leader            bool
	Active            bool
	NodeCount         int
	ActiveConfigs     int
	DanglingConfigs   int
	UnscheduledChecks int
	TotalConfigs      int
	CheckNames        map[string]struct{}
}

Stats holds statistics for the agent status command

type StatusResponse

type StatusResponse struct {
	IsUpToDate bool `json:"isuptodate"`
}

StatusResponse holds the DCA response for a status report

type WorkerInfo

type WorkerInfo struct {
	Utilization float64 `json:"Utilization"`
}

WorkerInfo is used to unmarshal the utilization of each worker

type Workers

type Workers struct {
	Count     int                   `json:"Count"`
	Instances map[string]WorkerInfo `json:"Instances"`
}

Workers is used to unmarshal the workers info of each CLC Runner

Jump to

Keyboard shortcuts

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