data

package
v0.0.0-...-b39e775 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Copyright 2020 FairwindsOps Inc

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.

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.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetClient

func GetClient(address string) (prometheusV1.API, error)

GetClient returns a Prometheus API client for a given address

Types

type CombinedRequest

type CombinedRequest struct {
	Owner
	// contains filtered or unexported fields
}

CombinedRequest is the cpu/memory and requests for a given pod/container

func GetMetrics

func GetMetrics(ctx context.Context, dynamicClient dynamic.Interface, restMapper meta.RESTMapper, api prometheusV1.API) ([]CombinedRequest, error)

GetMetrics returns the memory/cpu and requests for each container running in the cluster.

type NodesMetrics

type NodesMetrics struct {
	IdleCPU    model.SampleValue `json:"IdleCPU,omitempty" yaml:"IdleCPU,omitempty"`
	IdleMemory model.SampleValue `json:"IdleMemory,omitempty" yaml:"IdleMemory,omitempty"`
}

func GetNodesMetrics

func GetNodesMetrics(ctx context.Context, dynamicClient dynamic.Interface, restMapper meta.RESTMapper, api prometheusV1.API) (*NodesMetrics, error)

type Owner

type Owner struct {
	Container           string
	PodName             string
	ControllerNamespace string
	ControllerName      string
	ControllerKind      string
}

Owner is the information about a pod that a set of metrics belongs to.

type Statistics

type Statistics struct {
	Owner
	StartTime  time.Time
	Metric     string
	Value      int64
	Request    int64
	LimitValue int64
}

Statistics is an aggregation of the metrics by pod/container

func CalculateStatistics

func CalculateStatistics(values []CombinedRequest) []Statistics

CalculateStatistics finds the max/min/avg for a set of data points by hour

Jump to

Keyboard shortcuts

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