Documentation ¶
Index ¶
- Constants
- func MapToClusterInfo(info map[string]string) (*clusters.ClusterInfo, error)
- func NewClusterMap(client prometheus.Client, cip clusters.ClusterInfoProvider, ...) clusters.ClusterMap
- func SplitNameID(nameID string) (id string, name string)
- type PrometheusClusterMap
- func (pcm *PrometheusClusterMap) AsMap() map[string]*clusters.ClusterInfo
- func (pcm *PrometheusClusterMap) GetClusterIDs() []string
- func (pcm *PrometheusClusterMap) InfoFor(clusterID string) *clusters.ClusterInfo
- func (pcm *PrometheusClusterMap) NameFor(clusterID string) string
- func (pcm *PrometheusClusterMap) NameIDFor(clusterID string) string
- func (pcm *PrometheusClusterMap) StopRefresh()
Constants ¶
Variables ¶
This section is empty.
Functions ¶
func MapToClusterInfo ¶ added in v1.100.0
func MapToClusterInfo(info map[string]string) (*clusters.ClusterInfo, error)
MapToClusterInfo returns a ClusterInfo using parsed data from a string map. If parsing the map fails for id and/or name, an error is returned.
func NewClusterMap ¶
func NewClusterMap(client prometheus.Client, cip clusters.ClusterInfoProvider, refresh time.Duration) clusters.ClusterMap
NewClusterMap creates a new ClusterMap implementation using a prometheus or thanos client
func SplitNameID ¶ added in v1.100.0
SplitNameID is a helper method that removes the common split format and returns
Types ¶
type PrometheusClusterMap ¶
type PrometheusClusterMap struct {
// contains filtered or unexported fields
}
ClusterMap keeps records of all known cost-model clusters.
func (*PrometheusClusterMap) AsMap ¶
func (pcm *PrometheusClusterMap) AsMap() map[string]*clusters.ClusterInfo
AsMap returns the cluster map as a standard go map
func (*PrometheusClusterMap) GetClusterIDs ¶
func (pcm *PrometheusClusterMap) GetClusterIDs() []string
GetClusterIDs returns a slice containing all of the cluster identifiers.
func (*PrometheusClusterMap) InfoFor ¶
func (pcm *PrometheusClusterMap) InfoFor(clusterID string) *clusters.ClusterInfo
InfoFor returns the ClusterInfo entry for the provided clusterID or nil if it doesn't exist
func (*PrometheusClusterMap) NameFor ¶
func (pcm *PrometheusClusterMap) NameFor(clusterID string) string
NameFor returns the name of the cluster provided the clusterID.
func (*PrometheusClusterMap) NameIDFor ¶
func (pcm *PrometheusClusterMap) NameIDFor(clusterID string) string
NameIDFor returns an identifier in the format "<clusterName>/<clusterID>" if the cluster has an assigned name. Otherwise, just the clusterID is returned.
func (*PrometheusClusterMap) StopRefresh ¶
func (pcm *PrometheusClusterMap) StopRefresh()
StopRefresh stops the automatic internal map refresh