common

package
v0.0.0-...-4fe64e7 Latest Latest
Warning

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

Go to latest
Published: May 29, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddToLabelMap

func AddToLabelMap(key string, value string, labelPath map[string]string)

AddToLabelMap used to add values to label map used for attributes.

func Format

func Format(t *time.Time) string

func FormatTime

func FormatTime(mt model.Time) string

func FormatTimeInSec

func FormatTimeInSec(i int64) string

func GetCsvHeaderFormat

func GetCsvHeaderFormat(entityKind string) (string, bool)

func GetVersion

func GetVersion(args *Parameters) (version string, err error)

func GetWorkload

func GetWorkload(fileName, metricName, query string, metricField []model.LabelName, args *Parameters, entityKind string)

GetWorkload used to query for the workload data and then calls write workload

func MetricCollect

func MetricCollect(args *Parameters, query string, range5m v1.Range) (value model.Value, err error)

MetricCollect is used to query Prometheus to get data for specific query and return the results to be processed.

func TimeRange

func TimeRange(args *Parameters, historyInterval time.Duration) (promRange v1.Range)

TimeRange allows you to define the start and end values of the range will pass to the Prometheus for the query.

func WriteWorkload

func WriteWorkload(file io.Writer, result model.Value, metricField []model.LabelName, args *Parameters, entityKind string)

WriteWorkload will write out the workload data specific to metric provided to the file that was passed in.

Types

type Parameters

type Parameters struct {
	ClusterName, PromURL, PromAddress, FileName, Interval *string
	IntervalSize, History, Offset                         *int
	Debug                                                 bool
	CurrentTime                                           *time.Time
	LabelSuffix                                           string
	InfoLogger, WarnLogger, ErrorLogger, DebugLogger      *log.Logger
	SampleRate                                            int
	SampleRateString, NodeGroupList                       string
	OAuthTokenPath                                        string
	CaCertPath                                            string
	Deployments, CronJobs                                 bool
}

Parameters - Reusable structure that holds common arguments used in the project

Jump to

Keyboard shortcuts

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