prom

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2021 License: Apache-2.0 Imports: 6 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ServeMetrics

func ServeMetrics(path, address string) error

ServeMetrics Creates a new Prometheus exporter, register it and run it

Types

type Builder

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

Builder structure to sreturn metrics with unique namespace, subsystem and static labels

func NewBuilder

func NewBuilder(namespace, subsystem string, staticLabels map[string]string) *Builder

NewBuilder Constructs a new Builder to return new Metrics

func (Builder) MustNewConstHistogram

func (b Builder) MustNewConstHistogram(
	metricDesc *prometheus.Desc,
	count uint64,
	sum float64,
	buckets map[float64]uint64,
	labelValues ...string) prometheus.Metric

MustNewConstHistogram Builds a new prometheus metric Counter/Gauge

func (Builder) MustNewConstMetric

func (b Builder) MustNewConstMetric(
	metricDesc *prometheus.Desc,
	metricType prometheus.ValueType,
	value float64,
	labelValues ...string) prometheus.Metric

MustNewConstMetric Builds a new prometheus Counter/Gauge const Metric, to be used with a custom Collector

func (Builder) MustNewConstSummary

func (b Builder) MustNewConstSummary(
	metricDesc *prometheus.Desc,
	count uint64,
	sum float64,
	quantiles map[float64]float64,
	labelValues ...string) prometheus.Metric

MustNewConstSummary Builds a new prometheus metric Counter/Gauge

func (Builder) NewMetricCounter

func (b Builder) NewMetricCounter(name, description string) (prometheus.Counter, error)

NewMetricCounter Builds a new prometheus metric Counter it returns an error if it fails to register the metric in Prometheus

func (Builder) NewMetricCounterVec

func (b Builder) NewMetricCounterVec(name, description string, dimensions []string) (*prometheus.CounterVec, error)

NewMetricCounterVec Builds a new prometheus metric CounterVec it returns an error if it fails to register the metric in Prometheus

func (Builder) NewMetricDesc

func (b Builder) NewMetricDesc(
	metricName,
	metricHelp string,
	labels []string,
	staticLabels map[string]string) *prometheus.Desc

NewMetricDesc Builds a new prometheus Metric Description

func (Builder) NewMetricGauge

func (b Builder) NewMetricGauge(
	name,
	description string) (prometheus.Gauge, error)

NewMetricGauge Builds a new prometheus metric Gauge it returns an error if it fails to register the metric in Prometheus

func (Builder) NewMetricGaugeVec

func (b Builder) NewMetricGaugeVec(
	name,
	description string,
	dimensions []string) (*prometheus.GaugeVec, error)

NewMetricGaugeVec Builds a new prometheus metric GaugeVec it returns an error if it fails to register the metric in Prometheus

func (Builder) NewMetricHistogram

func (b Builder) NewMetricHistogram(
	name,
	description string,
	buckets []float64,
	dimensions []string) (prometheus.Histogram, error)

NewMetricHistogram Builds a new prometheus metric Histogram it returns an error if it fails to register the metric in Prometheus

func (Builder) NewMetricHistogramVec

func (b Builder) NewMetricHistogramVec(
	name,
	description string,
	buckets []float64,
	dimensions []string) (*prometheus.HistogramVec, error)

NewMetricHistogramVec Builds a new prometheus metric HistogramVec it returns an error if it fails to register the metric in Prometheus

func (Builder) NewMetricSummary

func (b Builder) NewMetricSummary(
	name,
	description string,
	objectives map[float64]float64,
	dimensions []string) (prometheus.Summary, error)

NewMetricSummary Builds a new prometheus metric Summary it returns an error if it fails to register the metric in Prometheus

func (Builder) NewMetricSummaryVec

func (b Builder) NewMetricSummaryVec(
	name,
	description string,
	objectives map[float64]float64,
	dimensions []string) (*prometheus.SummaryVec, error)

NewMetricSummaryVec Builds a new prometheus metric SummaryVec, it returns an error if it fails to register the metric in Prometheus

type Collector

type Collector interface {
	Retrieve(ch chan<- prometheus.Metric) error
}

Collector Interface that defines the expected method of a Collector Retrieve method must send prometheus metrics to the ch channel

type Exporter

type Exporter interface {
	RegisterCollector(collectorName string, collector Collector) error
	Run() error
	Collect(ch chan<- prometheus.Metric)
	Describe(ch chan<- *prometheus.Desc)
}

Exporter Interface that defines the expected behavior of the Prometheus exporter, enabling collectors to be registered and the methods to Collect and Describe metrics

func NewExporter

func NewExporter(path, address string) Exporter

NewExporter Creates a Prometheus exporter

Jump to

Keyboard shortcuts

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