api

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: May 22, 2021 License: Apache-2.0 Imports: 25 Imported by: 7

Documentation

Overview

Copyright 2020 The Kubernetes Authors.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

View Source
var (
	// Scheme contains the types needed by the resource metrics API.
	Scheme = runtime.NewScheme()
	// Codecs is a codec factory for serving the resource metrics API.
	Codecs = serializer.NewCodecFactory(Scheme)
)

Functions

func Build

Build constructs APIGroupInfo the metrics.k8s.io API group using the given getters.

func Install

func Install(metrics MetricsGetter, podLister corev1.PodLister, nodeLister corev1.NodeLister, server *genericapiserver.GenericAPIServer) error

InstallStorage builds the metrics for the metrics.k8s.io API, and then installs it into the given API metrics-server.

func RegisterAPIMetrics

func RegisterAPIMetrics(registrationFunc func(metrics.Registerable) error) error

RegisterAPIMetrics registers a histogram metric for the freshness of exported metrics.

Types

type MetricsGetter

type MetricsGetter interface {
	PodMetricsGetter
	NodeMetricsGetter
}

MetricsGetter is both a PodMetricsGetter and a NodeMetricsGetter

type NodeMetricsGetter

type NodeMetricsGetter interface {
	// GetNodeMetrics gets the latest metrics for the given nodes,
	// returning both the metrics and the associated collection timestamp.
	// If a node is missing, the resourcelist should be nil for that node.
	GetNodeMetrics(nodes ...string) ([]TimeInfo, []corev1.ResourceList, error)
}

NodeMetricsGetter knows how to fetch metrics for a node.

type PodMetricsGetter

type PodMetricsGetter interface {
	// GetPodMetrics gets the latest metrics for all containers in each listed pod,
	// returning both the metrics and the associated collection timestamp.
	// If a pod is missing, the container metrics should be nil for that pod.
	GetPodMetrics(pods ...apitypes.NamespacedName) ([]TimeInfo, [][]metrics.ContainerMetrics, error)
}

PodMetricsGetter knows how to fetch metrics for the containers in a pod.

type TimeInfo

type TimeInfo struct {

	// Timestamp is the time at which the metrics were initially collected.
	// In the case of a rate metric, it should be the timestamp of the last
	// data point used in the calculation.  If it represents multiple metric
	// points, it should be the earliest such timestamp from all of the points.
	Timestamp time.Time

	// Window represents the window used to calculate rate metrics associated
	// with this timestamp.
	Window time.Duration
}

TimeInfo represents the timing information for a metric, which was potentially calculated over some window of time (e.g. for CPU usage rate).

Directories

Path Synopsis
generated
openapi
package openapi contains autogenerated openapi schema definitions for the metrics.k8s.io API.
package openapi contains autogenerated openapi schema definitions for the metrics.k8s.io API.

Jump to

Keyboard shortcuts

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