Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddFlags ¶
func AddFlags(a *kingpin.Application, cfg *ProbeConfig)
func BasicHealthCheck ¶
func BasicHealthCheck(w http.ResponseWriter, r *http.Request)
Types ¶
type ClusterNodeInfo ¶
type NodeInfoCache ¶
type NodeInfoCache struct {
// contains filtered or unexported fields
}
NodeInfoCache holds the node metadata (pod name, physical node fqdn) discovered for one cluster, keyed by the address the database client reports for a node.
It is shared between the discovery loop, which replaces its content at every refresh, and the running checks, which read it concurrently (namespace fanout). A check endpoint keeps a pointer to this cache rather than a snapshot map: the scheduler only restarts a worker when the endpoint hash changes, so an endpoint outlives many discovery refreshes. Without this indirection a pod that comes back with a new IP would never be resolved again and its metrics would stay labelled "unknown".
func NewNodeInfoCache ¶
func NewNodeInfoCache() *NodeInfoCache
func (*NodeInfoCache) Get ¶
func (c *NodeInfoCache) Get(address string) (*ClusterNodeInfo, bool)
Get returns the node info known for an address, if any. The returned value must be treated as read-only: it is shared by every reader until the next Replace. A nil cache resolves nothing, so an endpoint built without discovery data (tests) stays usable.
func (*NodeInfoCache) Len ¶
func (c *NodeInfoCache) Len() int
Len returns the number of known nodes. Mostly useful for tests and logging.
func (*NodeInfoCache) Replace ¶
func (c *NodeInfoCache) Replace(byAddress map[string]*ClusterNodeInfo)
Replace swaps the whole content of the cache for a freshly discovered one. Entries are replaced rather than merged so nodes that disappeared stop being resolved.
type ProbeConfig ¶
type ProbeConfig struct {
LogConfig promlog.Config `yaml:"log,omitempty"`
HttpListenAddr string `yaml:"http_listen_addr,omitempty"`
ConfigPath string `yaml:"config_path,omitempty"`
}
func (*ProbeConfig) GetLogger ¶
func (cfg *ProbeConfig) GetLogger() log.Logger
func (*ProbeConfig) ParseConfigFile ¶
func (cfg *ProbeConfig) ParseConfigFile(config interface{}) error
func (*ProbeConfig) StartHttpServer ¶
func (cfg *ProbeConfig) StartHttpServer()