api

package
v1.2.6 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TypeCounter       = iota << 2
	TypeCounterLabels = iota << 2
	TypeGauge         = iota << 2
	TypeGaugeLabels   = iota << 2
	TypeSummary       = iota << 2
	TypeSummaryLabels = iota << 2
	TypeHistogram     = iota << 2
)

Variables

View Source
var DefaultBuckets = prometheus.DefBuckets
View Source
var (
	DefaultObjectives = map[float64]float64{0.5: 0.01, 0.75: 0.01, 0.9: 0.01, 0.95: 0.01, 0.99: 0.01, 0.999: 0.01}
)

Functions

func NormaliseAndLowercaseName

func NormaliseAndLowercaseName(name string) string

Types

type CounterFacade

type CounterFacade interface {
	Inc()
	IncBy(inc float64)
}

type DecGaugeByValue added in v1.2.0

type DecGaugeByValue interface {
	Value(inc float64)
}

type ErrorCounter

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

type GaugeFacade

type GaugeFacade interface {
	SetValue(value float64)
	Inc()
	IncBy(inc float64)
	Dec()
	DecBy(dec float64)
}

type HistogramFacade

type HistogramFacade interface {
	Update(value float64)
}

type IncByValue

type IncByValue interface {
	Value(inc float64)
}

type IncGaugeByValue added in v1.2.0

type IncGaugeByValue interface {
	Value(inc float64)
}

type LabelledCounterFacade

type LabelledCounterFacade interface {
	IncLabel(labelValues ...string)
	IncLabelBy(labelValues ...string) IncByValue
}

type LabelledGaugeFacade added in v1.2.0

type LabelledGaugeFacade interface {
	IncLabels(labelValues ...string)
	IncLabelsBy(labelValues ...string) IncGaugeByValue
	DecLabels(labelValues ...string)
	DecLabelsBy(labelValues ...string) DecGaugeByValue
	SetLabels(labelValues ...string) SetGaugeByValue
}

type LabelledSummaryFacade added in v1.1.0

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

func (LabelledSummaryFacade) Observe added in v1.1.0

func (f LabelledSummaryFacade) Observe(value float64, labelValues ...string)

type LabelsMap

type LabelsMap map[string]map[string]*clientmodel.Metric

type MetricBuilder

type MetricBuilder func(p *PrometheusMetricsImpl, name string, desc string) interface{}

type MetricDescriptions

type MetricDescriptions map[string]string

type MetricOpts

type MetricOpts struct {
	Registry                 prometheus.Registerer
	MetricNamePrefix         string
	PrefixSeparator          string
	Descriptions             MetricDescriptions
	CaseSensitiveMetricNames bool // true is faster, default is Insensitive
}

type MetricRegistrations

type MetricRegistrations struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

type PrometheusMetrics

type PrometheusMetrics interface {
	Register(metric prometheus.Collector) error
	MustRegister(metric prometheus.Collector)
	TestHelper() *TestHelper

	Counter(name string, optionalDesc ...string) CounterFacade
	CounterWithLabel(name string, labelName string, optionalDesc ...string) LabelledCounterFacade
	CounterWithLabels(name string, labelNames []string, optionalDesc ...string) LabelledCounterFacade
	Error(name string) ErrorCounter
	Gauge(name string, optionalDesc ...string) GaugeFacade
	GaugeWithLabel(name string, labelName string, optionalDesc ...string) LabelledGaugeFacade
	GaugeWithLabels(name string, labelNames []string, optionalDesc ...string) LabelledGaugeFacade
	Histogram(name string, buckets []float64, optionalDesc ...string) HistogramFacade
	HistogramForResponseTime(name string, optionalDesc ...string) HistogramFacade
	Summary(name string, optionalDesc ...string) SummaryFacade
	SummaryWithLabel(name string, labelName string, optionalDesc ...string) LabelledSummaryFacade
	SummaryWithLabels(name string, labelNames []string, optionalDesc ...string) LabelledSummaryFacade
	Timer(Name string) func() time.Duration
	TimerWithLabel(Name string, labelName string, labelValue string) func() time.Duration
	TimerWithLabels(Name string, labelNames []string, labelValues []string) func() time.Duration
}

type PrometheusMetricsImpl added in v1.1.0

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

func NewMetrics

func NewMetrics(opts MetricOpts) PrometheusMetricsImpl

func (*PrometheusMetricsImpl) Counter added in v1.1.0

func (p *PrometheusMetricsImpl) Counter(name string, optionalDesc ...string) CounterFacade

func (*PrometheusMetricsImpl) CounterWithLabel added in v1.1.0

func (p *PrometheusMetricsImpl) CounterWithLabel(name string, labelName string, optionalDesc ...string) LabelledCounterFacade

func (*PrometheusMetricsImpl) CounterWithLabels added in v1.1.0

func (p *PrometheusMetricsImpl) CounterWithLabels(name string, labelNames []string, optionalDesc ...string) LabelledCounterFacade

func (*PrometheusMetricsImpl) Error added in v1.1.0

func (p *PrometheusMetricsImpl) Error(name string) ErrorCounter

func (*PrometheusMetricsImpl) Gauge added in v1.1.0

func (p *PrometheusMetricsImpl) Gauge(name string, optionalDesc ...string) GaugeFacade

func (*PrometheusMetricsImpl) GaugeWithLabel added in v1.2.0

func (p *PrometheusMetricsImpl) GaugeWithLabel(name string, labelName string, optionalDesc ...string) LabelledGaugeFacade

func (*PrometheusMetricsImpl) GaugeWithLabels added in v1.2.0

func (p *PrometheusMetricsImpl) GaugeWithLabels(name string, labelNames []string, optionalDesc ...string) LabelledGaugeFacade

func (*PrometheusMetricsImpl) Histogram added in v1.1.0

func (p *PrometheusMetricsImpl) Histogram(name string, buckets []float64, optionalDesc ...string) HistogramFacade

func (*PrometheusMetricsImpl) HistogramForResponseTime added in v1.1.0

func (p *PrometheusMetricsImpl) HistogramForResponseTime(name string, optionalDesc ...string) HistogramFacade

func (*PrometheusMetricsImpl) MustRegister added in v1.2.3

func (p *PrometheusMetricsImpl) MustRegister(metric prometheus.Collector)

func (*PrometheusMetricsImpl) Register added in v1.2.2

func (p *PrometheusMetricsImpl) Register(metric prometheus.Collector) error

func (*PrometheusMetricsImpl) Summary added in v1.1.0

func (p *PrometheusMetricsImpl) Summary(name string, optionalDesc ...string) SummaryFacade

func (*PrometheusMetricsImpl) SummaryWithLabel added in v1.1.0

func (p *PrometheusMetricsImpl) SummaryWithLabel(name string, labelName string, optionalDesc ...string) LabelledSummaryFacade

func (*PrometheusMetricsImpl) SummaryWithLabels added in v1.1.0

func (p *PrometheusMetricsImpl) SummaryWithLabels(name string, labelNames []string, optionalDesc ...string) LabelledSummaryFacade

func (*PrometheusMetricsImpl) TestHelper added in v1.1.0

func (p *PrometheusMetricsImpl) TestHelper() *TestHelper

func (*PrometheusMetricsImpl) Timer added in v1.1.0

func (p *PrometheusMetricsImpl) Timer(Name string) func() time.Duration

func (*PrometheusMetricsImpl) TimerWithLabel added in v1.1.0

func (p *PrometheusMetricsImpl) TimerWithLabel(Name string, labelName string, labelValue string) func() time.Duration

func (*PrometheusMetricsImpl) TimerWithLabels added in v1.2.4

func (p *PrometheusMetricsImpl) TimerWithLabels(Name string, labelNames []string, labelValues []string) func() time.Duration

type SetGaugeByValue added in v1.2.0

type SetGaugeByValue interface {
	Value(inc float64)
}

type SummaryFacade

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

func (SummaryFacade) Observe

func (f SummaryFacade) Observe(value float64)

type TestHelper

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

func (*TestHelper) Clear

func (h *TestHelper) Clear()

func (*TestHelper) Gather

func (h *TestHelper) Gather() ([]*clientmodel.MetricFamily, error)

func (*TestHelper) GetMetricFamily

func (h *TestHelper) GetMetricFamily(metrics []*clientmodel.MetricFamily, name string) (*clientmodel.MetricFamily, error)

func (*TestHelper) GetMetricLabelValues

func (h *TestHelper) GetMetricLabelValues(name string) LabelsMap

func (*TestHelper) MetricNames

func (h *TestHelper) MetricNames() []string

Jump to

Keyboard shortcuts

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