common

package
v0.0.0-...-75c40e6 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

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 ClusterNodeInfo struct {
	NodeName string // node name as returned by database
	NodeIP   string // node ip
	PodName  string // name of the pod running this Aerospike node
	NodeFqdn string // fqdn of the physical node running the pod
}

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()

Jump to

Keyboard shortcuts

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