datasource

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: May 10, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalculateSamplesPercentile

func CalculateSamplesPercentile(samples []Sample, percentile float64) float64

Types

type Metric

type Metric struct {
	// to be extended when new datasource is added
	Namespace     string
	Kind          string
	APIVersion    string
	WorkloadName  string
	PodName       string
	ContainerName string
	Resource      v1.ResourceName
	Selectors     string
}

func (*Metric) SetSelector

func (m *Metric) SetSelector(selectors map[string]string)

type PrometheusQuery

type PrometheusQuery struct {
	Query string
}

type Query

type Query struct {
	// to be extended when new datasource is added
	Prometheus *PrometheusQuery
}

type Sample

type Sample struct {
	Value     float64
	Timestamp int64
}

Sample is a single timestamped value of the metric.

type SamplesOverview

type SamplesOverview struct {
	AvgValue            float64
	MinValue            float64
	MaxValue            float64
	Percentile50thValue float64
	Percentile90thValue float64
	LastTimestamp       int64
	FirstTimestamp      int64
	Count               int
}

func GetSamplesOverview

func GetSamplesOverview(timeSeries *TimeSeries) *SamplesOverview

type TimeSeries

type TimeSeries struct {
	Labels  map[string]string
	Samples []Sample
}

TimeSeries represents a metric with given labels, with its values possibly changing in time.

func NewTimeSeries

func NewTimeSeries() *TimeSeries

func (*TimeSeries) AppendLabel

func (ts *TimeSeries) AppendLabel(key, val string)

func (*TimeSeries) AppendSample

func (ts *TimeSeries) AppendSample(timestamp int64, val float64)

type WorkloadKind

type WorkloadKind string

WorkloadKind is k8s resource kind

const (
	// workload kind is deployment
	WorkloadDeployment WorkloadKind = "Deployment"
)

Resource Name

Jump to

Keyboard shortcuts

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