metrics

package
v0.24.4 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2016 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event struct {
	Name   string
	Labels map[string]string
	Value  string
}

Event is a Prometheus Metric Event

func (*Event) Equals

func (e *Event) Equals(newEvent *Event) bool

Equals checks if two Events refer to the same Prometheus event

func (*Event) String

func (e *Event) String() string

String formats an event for printing

type Metric

type Metric struct {
	Name   string
	Events []*Event
	Type   string
}

Metric is a Prometheus Metric

func (*Metric) UpdateEvent

func (m *Metric) UpdateEvent(event *Event) error

UpdateEvent adds an event, or updates it if the event already exists

type PrometheusMetrics

type PrometheusMetrics struct {
	Instance       string
	PushgatewayURL string
	Metrics        map[string]*Metric
}

PrometheusMetrics is a struct to push metrics to Prometheus

func NewMetrics

func NewMetrics(instance, pushgatewayURL string) *PrometheusMetrics

NewMetrics returns a new metrics struct

func (*PrometheusMetrics) GetMetrics

func (p *PrometheusMetrics) GetMetrics() (err error)

GetMetrics returns a map of existing metrics

func (*PrometheusMetrics) NewMetric

func (p *PrometheusMetrics) NewMetric(name, mType string) (m *Metric)

NewMetric adds a new metric if it doesn't exist yet or returns the existing matching metric otherwise

func (*PrometheusMetrics) Push

func (p *PrometheusMetrics) Push() (err error)

Push sends metrics to a Prometheus push gateway

Source Files

  • metrics.go

Jump to

Keyboard shortcuts

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