Documentation ¶
Index ¶
- Constants
- func AddUint64RawMetric(r definition.RawMetrics, name string, valuePtr *uint64)
- func CadvisorFetchFunc(c client.HTTPClient, queries []prometheus.Query) data.FetchFunc
- func FromRawEntityIDGroupEntityIDGenerator(key string) definition.EntityIDGeneratorFunc
- func FromRawGroupsEntityIDGenerator(key string) definition.EntityIDGeneratorFunc
- func FromRawGroupsEntityTypeGenerator(groupLabel string, rawEntityID string, groups definition.RawGroups, ...) (string, error)
- func FromRawWithFallbackToDefaultInterface(metricKey string) definition.FetchFunc
- func GetMetricsData(c client.HTTPClient) (v1.Summary, error)
- func GroupStatsSummary(statsSummary v1.Summary) (definition.RawGroups, []error)
- func OneAttributePerAllocatable(rawResources definition.FetchedValue) (definition.FetchedValue, error)
- func OneAttributePerCapacity(rawResources definition.FetchedValue) (definition.FetchedValue, error)
- func OneMetricPerLabel(rawLabels definition.FetchedValue) (definition.FetchedValue, error)
- type PodsFetcher
Constants ¶
const ( // KubeletCAdvisorMetricsPath is the path where kubelet serves information about cadvisor. KubeletCAdvisorMetricsPath = "/metrics/cadvisor" // StandaloneCAdvisorMetricsPath is the path where standalone cadvisor serves information. StandaloneCAdvisorMetricsPath = "/metrics" )
const KubeletPodsPath = "/pods"
KubeletPodsPath is the path where kubelet serves information about pods.
const StatsSummaryPath = "/stats/summary"
StatsSummaryPath is the path where kubelet serves a summary with several information.
Variables ¶
This section is empty.
Functions ¶
func AddUint64RawMetric ¶
func AddUint64RawMetric(r definition.RawMetrics, name string, valuePtr *uint64)
AddUint64RawMetric adds a new metric to a RawMetrics if it exists
func CadvisorFetchFunc ¶
func CadvisorFetchFunc(c client.HTTPClient, queries []prometheus.Query) data.FetchFunc
CadvisorFetchFunc creates a FetchFunc that fetches data from the kubelet cadvisor metrics path.
func FromRawEntityIDGroupEntityIDGenerator ¶
func FromRawEntityIDGroupEntityIDGenerator(key string) definition.EntityIDGeneratorFunc
FromRawEntityIDGroupEntityIDGenerator generates an entityID from the raw entity ID which is composed of namespace and pod name. It's used only for k8s pods.
func FromRawGroupsEntityIDGenerator ¶
func FromRawGroupsEntityIDGenerator(key string) definition.EntityIDGeneratorFunc
FromRawGroupsEntityIDGenerator generates an entityID from the pod name from kubelet. It's only used for k8s containers.
func FromRawGroupsEntityTypeGenerator ¶
func FromRawGroupsEntityTypeGenerator(groupLabel string, rawEntityID string, groups definition.RawGroups, clusterName string) (string, error)
FromRawGroupsEntityTypeGenerator generates the entity type using the cluster name and group label. If group label is different than "namespace" or "node", then entity type is also composed of namespace. If group label is "container" then pod name is also included.
func FromRawWithFallbackToDefaultInterface ¶
func FromRawWithFallbackToDefaultInterface(metricKey string) definition.FetchFunc
FromRawWithFallbackToDefaultInterface fetches network metrics from the raw groups, if the metric is not present it tries to find the default interface network metrics and gets the required metric from there.
func GetMetricsData ¶
func GetMetricsData(c client.HTTPClient) (v1.Summary, error)
GetMetricsData calls kubelet /stats/summary endpoint and returns unmarshalled response
func GroupStatsSummary ¶
func GroupStatsSummary(statsSummary v1.Summary) (definition.RawGroups, []error)
GroupStatsSummary groups specific data for pods, containers and node
func OneAttributePerAllocatable ¶
func OneAttributePerAllocatable(rawResources definition.FetchedValue) (definition.FetchedValue, error)
OneAttributePerAllocatable transforms a map of resources to FetchedValues type, which will be converted later to one attribute per allocatable resource.
The attribute names will be prefixed with `allocatable.`.
func OneAttributePerCapacity ¶
func OneAttributePerCapacity(rawResources definition.FetchedValue) (definition.FetchedValue, error)
OneAttributePerCapacity transforms a map of resources to FetchedValues type, which will be converted later to one attribute per capacity resource.
The attribute names will be prefixed with `capacity.`.
func OneMetricPerLabel ¶
func OneMetricPerLabel(rawLabels definition.FetchedValue) (definition.FetchedValue, error)
OneMetricPerLabel transforms a map of labels to FetchedValues type, which will be converted later to one metric per label. It also prefix the labels with 'label.'
Types ¶
type PodsFetcher ¶
type PodsFetcher struct {
// contains filtered or unexported fields
}
PodsFetcher queries the kubelet and fetches the information of pods running on the node. It contains an in-memory cache to store the results and avoid querying the kubelet multiple times in the same integration execution.
func NewPodsFetcher ¶
func NewPodsFetcher(l *logrus.Logger, c client.HTTPClient, enableStaticPodsStatus bool) *PodsFetcher
NewPodsFetcher returns a new PodsFetcher.
func (*PodsFetcher) FetchFuncWithCache ¶
func (f *PodsFetcher) FetchFuncWithCache() data.FetchFunc
FetchFuncWithCache creates a data.FetchFunc that fetches data from the kubelet pods path. The results are cached in memory, this means that the cache is maintain per integration execution.