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.
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.
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.
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.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
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, clusterName string, skipNonZeroMetricsValidation bool) ([]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"` OverheadCPU model.SampleValue `json:"OverheadCPU,omitempty" yaml:"OverheadCPU,omitempty"` OverheadMemory model.SampleValue `json:"OverheadMemory,omitempty" yaml:"OverheadMemory,omitempty"` }
func GetNodesMetrics ¶
func GetNodesMetrics(ctx context.Context, dynamicClient dynamic.Interface, restMapper meta.RESTMapper, api prometheusV1.API, clusterName string) (*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