metrics

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2019 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const Name = "metrics"

Name is the name of the metrics condition type

Variables

This section is empty.

Functions

func GetAll

func GetAll() map[string]Provider

GetAll returns all metric providers

func Register

func Register(name string, provider Provider)

Register makes a metrics provider available by the provided name. If Register is called twice with the same name or if provider is nil, it panics.

Types

type Params

type Params = sparks.Params

Params is an alias for a map helper

type Provider

type Provider interface {
	// Init initializes the metrics provider
	Init(params Params) error
	// Query executes query based on the provided conditions and returns a vector of metrics values
	Query(

		conditions v1alpha1.RuleConditions,

		labelSelector map[string]string,
	) (*QueryResponse, error)
}

Provider defines a simple interface for metrics providers to collect and extract data

func Get

func Get(name string) (Provider, error)

Get returns the metrics provider with the give name

type QueryMatch

type QueryMatch struct {
	// Condition is the condition for the query match
	Condition *v1alpha1.LabelSelectorRequirement
	// Vectors are the matches vectors for above condition
	Vectors []Vector
}

QueryMatch represents a single matched condition and it's vectors

type QueryResponse

type QueryResponse struct {
	// Matches are the matches for the query
	Matches []QueryMatch
}

QueryResponse is the response for the Query method

type Vector

type Vector struct {
	// Name is the name of the metric
	Name string
	// Labels are labels tagged with the metric
	Labels map[string]string
	// Value is the actual value of the metric
	Value float64
}

Vector for a single metric and value

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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