metrics

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2023 License: GPL-3.0 Imports: 21 Imported by: 0

Documentation

Overview

Copyright © 2020 Chris Kim

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.

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.

Copyright © 2020 Chris Kim 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

View Source
const (
	POD  Resource = "PODS"
	NODE Resource = "NODES"

	DIVISOR int64 = 1024 * 1024
)

Variables

This section is empty.

Functions

This section is empty.

Types

type MetricValue

type MetricValue struct {
	Name       string
	CPUPercent float64
	MemPercent float64
	CPUCores   resource.Quantity
	CPULimit   resource.Quantity
	MemCores   int64
	MemLimit   int64
	Timestamp  metav1.Time

	Namespace string
	Node      string
	Status    string
	Age       string
	Restarts  int
	Ready     int
	Total     int
}

MetricValue is an object containing the cpu/memory resources for a pod/node that is used to populate termui widgets

type MetricsClient

type MetricsClient struct {
	// contains filtered or unexported fields
}

func New

func New(flags *genericclioptions.ConfigFlags, showManagedFields bool, allNs *bool) MetricsClient

func (MetricsClient) GetNode

func (m MetricsClient) GetNode(name string) (string, error)

func (MetricsClient) GetNodeMetrics

func (m MetricsClient) GetNodeMetrics(o *top.TopNodeOptions) ([]MetricValue, error)

GetNodeMetrics returns a slice of objects that are meant to be easily consumable by the various termui widgets

func (MetricsClient) GetPod

func (m MetricsClient) GetPod(name, ns string) (string, error)

func (*MetricsClient) GetPodMetrics

func (m *MetricsClient) GetPodMetrics(o *top.TopPodOptions) ([]MetricValue, error)

GetPodMetrics returns a slice of objects that are meant to be easily consumable by the various termui widgets

type Resource

type Resource string

func (Resource) LowerCase added in v0.1.4

func (r Resource) LowerCase() string

Jump to

Keyboard shortcuts

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