common

package
v0.11.1 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package common is for some common functions for tooling

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalculateAverageAndPeak

func CalculateAverageAndPeak(data []Data) (float64, float64)

CalculateAverageAndPeak calculates the average and peak values of related metric

func ConstructPrometheusClient

func ConstructPrometheusClient(address string) (v1.API, error)

ConstructPrometheusClient creates a Prometheus API Client

func ConstructTimeRange

func ConstructTimeRange(startTime, endTime time.Time, stepDuration time.Duration) v1.Range

ConstructTimeRange creates a Range object that consists the start time, end time and step duration

Types

type Data

type Data struct {
	Timestamp time.Time
	Value     float64
}

Data represents a collected data

type Result

type Result struct {
	Data          []Data
	Metric        string
	MetricUnit    string
	Peak, Average float64
	PodName       string
}

Result represents all collected data for a metric

func ConstructResult

func ConstructResult(value model.Value, metric, unit string, podName string) (*Result, error)

ConstructResult creates a Result object from collected data

func (Result) Print

func (r Result) Print()

Print reports the results

Jump to

Keyboard shortcuts

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