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 ¶
- Variables
- func Build(pod, node rest.Storage) genericapiserver.APIGroupInfo
- func Install(m MetricsGetter, podMetadataLister cache.GenericLister, ...) error
- func RegisterAPIMetrics(registrationFunc func(metrics.Registerable) error) error
- type MetricsGetter
- type NodeMetricsGetter
- type PodMetricsGetter
- type TimeInfo
Constants ¶
This section is empty.
Variables ¶
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 ¶
func Build(pod, node rest.Storage) genericapiserver.APIGroupInfo
Build constructs APIGroupInfo the metrics.k8s.io API group using the given getters.
func Install ¶
func Install(m MetricsGetter, podMetadataLister cache.GenericLister, nodeLister corev1.NodeLister, server *genericapiserver.GenericAPIServer, nodeSelector []labels.Requirement) error
Install 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. GetNodeMetrics(nodes ...*corev1.Node) ([]metrics.NodeMetrics, 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. GetPodMetrics(pods ...*metav1.PartialObjectMetadata) ([]metrics.PodMetrics, 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).