utils

package
v0.0.0-...-3b4f3f7 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2018 License: MIT Imports: 11 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HistogramMetric

type HistogramMetric interface {
	Desc() *prometheus.Desc
	Init()
	Match(name string, value string) bool
	Collect(ch chan<- prometheus.Metric)
}

HistogramMetric …

type MatchMetric

type MatchMetric interface {
	Desc() *prometheus.Desc
	// Match return true if the metrics match and can be collected
	Match(name string, value float64, ch chan<- prometheus.Metric) bool
}

MatchMetric define a metric where multiples stats map to a single metric with labels

func NewRegexMetric

func NewRegexMetric(ns string, name string, description string, valueType prometheus.ValueType, labels []string, pattern string) MatchMetric

NewRegexMetric returns a new RegexMetric

type MetricsExporter

type MetricsExporter struct {
	// contains filtered or unexported fields
}

MetricsExporter …

func NewMetricExporter

func NewMetricExporter(name string, protocol string, host string, ca string, cert string, key string, simpleMetrics map[string]SimpleMetric, matchMetrics []MatchMetric, histogramMetrics []HistogramMetric) (*MetricsExporter, error)

NewMetricExporter …

func (*MetricsExporter) Collect

func (m *MetricsExporter) Collect(ch chan<- prometheus.Metric)

Collect …

func (*MetricsExporter) Describe

func (m *MetricsExporter) Describe(ch chan<- *prometheus.Desc)

Describe …

type RegexMetric

type RegexMetric struct {
	// contains filtered or unexported fields
}

RegexMetric MatchMetric that uses regex to match a metric name and extract labels values

func (*RegexMetric) Desc

func (m *RegexMetric) Desc() *prometheus.Desc

Desc …

func (*RegexMetric) Match

func (m *RegexMetric) Match(name string, value float64, ch chan<- prometheus.Metric) bool

Match uses regex pattern to extract label and collect the resulting value

type SimpleMetric

type SimpleMetric struct {
	// contains filtered or unexported fields
}

SimpleMetric define a metric without label and static 'stats' name

func NewSimpleMetric

func NewSimpleMetric(ns string, name string, description string, valueType prometheus.ValueType) SimpleMetric

NewSimpleMetric returns a new SimpleMetric

Jump to

Keyboard shortcuts

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