common

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2023 License: Apache-2.0, BSD-2-Clause Imports: 2 Imported by: 10

Documentation

Index

Constants

View Source
const (
	LabelNamePodName       = "PodName"
	LabelNamePodNamespace  = "PodNamespace"
	LabelNamePodUid        = "PodUid"
	LabelNameContainerName = "ContainerName"
	LabelNameContainerId   = "ContainerId"
	LabelNameHasExtRes     = "HasExtRes"
)

Variables

This section is empty.

Functions

func GetValueByName added in v0.2.0

func GetValueByName(labels []Label, name string) string

func Labels2Maps

func Labels2Maps(labels []Label) map[string]string

Types

type Label

type Label struct {
	Name  string
	Value string
}

A Label is a Name and Value pair that provides additional information about the metric. It is metadata for the metric. For example, Kubernetes pod metrics always have 'namespace' label that represents which namespace the pod belongs to.

func (*Label) String

func (l *Label) String() string

type Operator

type Operator string
const (
	OperatorEqual         Operator = "="
	OperatorNotEqual      Operator = "!="
	OperatorRegexMatch    Operator = "=~"
	OperatorNotRegexMatch Operator = "!~"
	OperatorIn            Operator = "in"
)

type Options

type Options map[string]interface{}

type QueryCondition

type QueryCondition struct {
	Key      string
	Operator Operator
	Value    []string
}

QueryCondition is a key, operator, value triple. E.g. 'namespace = default', 'role in [Admin, Developer]'

type Sample

type Sample struct {
	Value     float64
	Timestamp int64
}

Sample pairs a Value with a Timestamp.

func (*Sample) String

func (s *Sample) String() string

type TimeSeries

type TimeSeries struct {
	// A collection of Labels that are attached by monitoring system as metadata
	// for the metrics, which are known as dimensions.
	Labels []Label
	// A collection of Samples in chronological order.
	Samples []Sample
}

TimeSeries is a stream of samples that belong to a metric with a set of labels

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)

func (*TimeSeries) SetLabels

func (ts *TimeSeries) SetLabels(labels []Label)

func (*TimeSeries) SetSamples

func (ts *TimeSeries) SetSamples(samples []Sample)

func (*TimeSeries) SortSampleAsc added in v0.3.0

func (ts *TimeSeries) SortSampleAsc()

Jump to

Keyboard shortcuts

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