Documentation ¶
Index ¶
- Constants
- Variables
- func InitMetrics(client *client.Client, scanner *scanner.Scanner, kube *kuber.Kube, ...) error
- func ParseResponse(allowedMetrics map[string]struct{}, resp *http.Response, ...) error
- func ReadPrometheusMetrics(allowedMetrics map[string]struct{}, resp *http.Response, bind BindFunc) (result map[string]*MetricFamily, err error)
- type BindFunc
- type CAdvisor
- type CAdvisorMetrics
- type Entities
- type Kubelet
- type KubeletClient
- type KubeletSummary
- type KubeletSummaryContainer
- type KubeletValue
- type MetricFamily
- type MetricValue
- type Metrics
- type MetricsBatch
- type MetricsSourcedeprecated
- type NodePathGetter
- type Prometheus
- type RawMetric
- type RawMetrics
- type Source
- type Stats
- type TagsValue
Constants ¶
View Source
const ( // TypeCluster cluster TypeCluster = "cluster" // TypeNode node TypeNode = "node" // TypePod pod TypePod = "pod" // TypePodContainer container in a pod TypePodContainer = "pod_container" // TypeSysContainer system container TypeSysContainer = "sys_container" )
View Source
const ( NodesCountName = "stats_nodes_count" NodesCountHelp = "Current count of nodes." InstanceGroupsName = "stats_nodes_instance_groups" InstanceGroupsHelp = "Current count of nodes in an instance group." InstanceGroupTag = "instance_group" NodeCapacityCpuName = "kube_node_status_capacity_cpu_cores" NodeCapacityCpuHelp = "The total CPU resources of the node." NodeCapacityMemoryName = "kube_node_status_capacity_memory_bytes" NodeCapacityMemoryHelp = "The total memory resources of the node." NodeCapacityPodsName = "kube_node_status_capacity_pods" NodeCapacityPodsHelp = "The total pod resources of the node." NodeAllocatableCpuName = "kube_node_status_allocatable_cpu_cores" NodeAllocatableCpuHelp = "The CPU resources of a node that are available for scheduling." NodeAllocatableMemoryName = "kube_node_status_allocatable_memory_bytes" NodeAllocatableMemoryHelp = "The memory resources of a node that are available for scheduling." NodeAllocatablePodsName = "kube_node_status_allocatable_pods" NodeAllocatablePodsHelp = "The pod resources of a node that are available for scheduling." ContainerRequestsCpuName = "stats_container_resource_requests_cpu_cores" ContainerRequestsCpuHelp = "The number of requested cpu cores by a magalix container." ContainerLimitsCpuName = "stats_container_resource_limits_cpu_cores" ContainerLimitsCpuHelp = "The limit on cpu cores to be used by a magalix container." ContainerRequestsMemoryName = "stats_container_resource_requests_memory_bytes" ContainerRequestsMemoryHelp = "The number of requested memory bytes by a magalix container." ContainerLimitsMemoryName = "stats_container_resource_limits_memory_bytes" ContainerLimitsMemoryHelp = "The limit on memory to be used by a magalix container in bytes." NodeTag = "nodename" NamespaceTag = "namespace" PodTag = "pod_name" ContainerTag = "container_name" )
Variables ¶
View Source
var (
TypeGAUGE = io_prometheus_client.MetricType_GAUGE.String()
)
Functions ¶
func InitMetrics ¶
func InitMetrics( client *client.Client, scanner *scanner.Scanner, kube *kuber.Kube, optInAnalysisData bool, args map[string]interface{}, ) error
InitMetrics init metrics source
func ParseResponse ¶
func ParseResponse( allowedMetrics map[string]struct{}, resp *http.Response, ch chan<- *dto.MetricFamily, ) error
ParseResponse consumes an http.Response and pushes it to the MetricFamily channel iff it is in allowedMetrics. It returns when all MetricFamilies are parsed and put on the channel.
func ReadPrometheusMetrics ¶
Types ¶
type CAdvisor ¶
type CAdvisor struct { *log.Logger // contains filtered or unexported fields }
func NewCAdvisor ¶
func (*CAdvisor) GetMetrics ¶
func (cAdvisor *CAdvisor) GetMetrics(tickTime time.Time) ( chan *MetricsBatch, error, )
type CAdvisorMetrics ¶
CAdvisorMetrics a struct to hold cadvisor metrics
type Entities ¶
type Entities struct { Node *uuid.UUID Application *uuid.UUID Service *uuid.UUID Container *uuid.UUID }
type Kubelet ¶
type Kubelet struct { *log.Logger // contains filtered or unexported fields }
Kubelet kubelet client
func NewKubelet ¶
func NewKubelet( kubeletClient *KubeletClient, log *log.Logger, resolution time.Duration, timeouts kubeletTimeouts, optInAnalysisData bool, ) (*Kubelet, error)
NewKubelet returns new kubelet
type KubeletClient ¶
type KubeletClient struct { *log.Logger // contains filtered or unexported fields }
func NewKubeletClient ¶
type KubeletSummary ¶
type KubeletSummary struct { Node struct { CPU struct { Time time.Time UsageCoreNanoSeconds int64 } Memory struct { Time time.Time RSSBytes int64 } FS struct { Time time.Time UsedBytes int64 CapacityBytes int64 } Network struct { Time time.Time RxBytes int64 RxErrors int64 TxBytes int64 TxErrors int64 } } Pods []struct { PodRef struct { Name string Namespace string } Containers []KubeletSummaryContainer Network struct { Time time.Time RxBytes int64 RxErrors int64 TxBytes int64 TxErrors int64 } } }
KubeletSummary a struct to hold kubelet summary
type KubeletSummaryContainer ¶
type KubeletValue ¶
KubeletValue timestamp value struct
type MetricFamily ¶
type MetricFamily struct { Name string Help string Type string Tags []string Values []*MetricValue }
type Metrics ¶
type Metrics struct { Name string Type string Node uuid.UUID Application uuid.UUID Service uuid.UUID Container uuid.UUID Timestamp time.Time Value int64 PodName string AdditionalTags map[string]interface{} }
Metrics metrics struct
type MetricsBatch ¶
type MetricsBatch struct { Timestamp time.Time Metrics map[string]*MetricFamily }
type MetricsSource
deprecated
type MetricsSource interface {
GetMetrics(scanner *scanner.Scanner, tickTime time.Time) ([]*Metrics, map[string]interface{}, error)
}
Deprecated: MetricsSource interface is deprecated and will be removed in future releases. Consider using Source interface instead. MetricsSource interface for metrics source
type Prometheus ¶
type Prometheus struct {
// contains filtered or unexported fields
}
type Source ¶
type Source interface {
GetMetrics(time time.Time) (chan *MetricsBatch, error)
}
Source interface is to be implemented by metrics sources
type Stats ¶
type Stats struct { *log.Logger // contains filtered or unexported fields }
func (*Stats) GetMetrics ¶
func (stats *Stats) GetMetrics(tickTime time.Time) ( chan *MetricsBatch, error, )
Click to show internal directories.
Click to hide internal directories.