metrics_storage

package
v1.0.0-beta.9 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2020 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseMetric

type BaseMetric struct {
	Metric string
	Value  float64
	Labels map[string]string
}

func (*BaseMetric) LabelsNames

func (metric *BaseMetric) LabelsNames() []string

type CounterMetric

type CounterMetric struct {
	BaseMetric
}

func NewCounterMetric

func NewCounterMetric(metric string, value float64, labels map[string]string) *CounterMetric

type GaugeMetric

type GaugeMetric struct {
	BaseMetric
}

func NewGaugeMetric

func NewGaugeMetric(metric string, value float64, labels map[string]string) *GaugeMetric

type Metric

type Metric interface {
	// contains filtered or unexported methods
}

type MetricCounterVec

type MetricCounterVec struct {
	*prometheus.CounterVec
	Name       string
	LabelNames []string
}

func NewMetricCounterVec

func NewMetricCounterVec(counter *prometheus.CounterVec, name string, labelNames []string) *MetricCounterVec

func (*MetricCounterVec) UpdateValue

func (metricVec *MetricCounterVec) UpdateValue(labels prometheus.Labels, value float64)

type MetricGaugeVec

type MetricGaugeVec struct {
	*prometheus.GaugeVec
	Name       string
	LabelNames []string
}

func NewMetricGaugeVec

func NewMetricGaugeVec(gauge *prometheus.GaugeVec, name string, labelNames []string) *MetricGaugeVec

func (*MetricGaugeVec) UpdateValue

func (metricVec *MetricGaugeVec) UpdateValue(labels prometheus.Labels, value float64)

type MetricOperation

type MetricOperation struct {
	Name   string            `json:"name"`
	Add    *float64          `json:"add,omitempty"`
	Set    *float64          `json:"set,omitempty"`
	Labels map[string]string `json:"labels"`
}

func MetricOperationsFromBytes

func MetricOperationsFromBytes(data []byte) ([]MetricOperation, error)

func MetricOperationsFromFile

func MetricOperationsFromFile(filePath string) ([]MetricOperation, error)

func MetricOperationsFromReader

func MetricOperationsFromReader(r io.Reader) ([]MetricOperation, error)

type MetricStorage

type MetricStorage struct {
	MetricChan chan Metric
	MetricVecs map[string]MetricVec
	Prefix     string
	// contains filtered or unexported fields
}

MetricStorage is used to synchronously register metric values.

func NewMetricStorage

func NewMetricStorage() *MetricStorage

func (*MetricStorage) SendBatch

func (m *MetricStorage) SendBatch(ops []MetricOperation, labels map[string]string) error

func (*MetricStorage) SendCounter

func (m *MetricStorage) SendCounter(metric string, value float64, labels map[string]string)

func (*MetricStorage) SendCounterNoPrefix

func (m *MetricStorage) SendCounterNoPrefix(metric string, value float64, labels map[string]string)

func (*MetricStorage) SendGauge

func (m *MetricStorage) SendGauge(metric string, value float64, labels map[string]string)

func (*MetricStorage) SendGaugeNoPrefix

func (m *MetricStorage) SendGaugeNoPrefix(metric string, value float64, labels map[string]string)

func (*MetricStorage) Start

func (m *MetricStorage) Start()

func (*MetricStorage) Stop

func (m *MetricStorage) Stop()

func (*MetricStorage) WithContext

func (m *MetricStorage) WithContext(ctx context.Context)

func (*MetricStorage) WithPrefix

func (m *MetricStorage) WithPrefix(prefix string)

type MetricVec

type MetricVec interface {
	UpdateValue(labels prometheus.Labels, value float64)
}

Jump to

Keyboard shortcuts

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