metrics

package
v3.8.2 Latest Latest
Warning

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

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

Documentation

Overview

Package metrics creates the metrics registry and exposes some common metrics.

Index

Constants

View Source
const Namespace = "ttn_lw"

Namespace for metrics.

Variables

View Source
var (
	StreamServerInterceptor = serverMetrics.StreamServerInterceptor()
	UnaryServerInterceptor  = serverMetrics.UnaryServerInterceptor()
)

Server interceptors.

View Source
var (
	StreamClientInterceptor = clientMetrics.StreamClientInterceptor()
	UnaryClientInterceptor  = clientMetrics.UnaryClientInterceptor()
)

Client interceptors.

View Source
var ContextLabelNames []string

ContextLabelNames are the label names that can be retrieved from a context for XXXVec metrics.

View Source
var Exporter http.Handler = exporter

Exporter for the metrics registry.

View Source
var LabelsFromContext func(ctx context.Context) prometheus.Labels

LabelsFromContext returns the values for ContextLabelNames.

View Source
var Registry prometheus.Registerer = registry

Registry for metrics.

View Source
var StatsHandler stats.Handler = gRPCStats

StatsHandler for gRPC.

Functions

func InitializeServerMetrics

func InitializeServerMetrics(s *grpc.Server)

InitializeServerMetrics initializes server metrics for the given gRPC server.

func MustRegister

func MustRegister(cs ...prometheus.Collector)

MustRegister registers the given Collectors in the registry and panics on errors.

func MustRegisterCounter

func MustRegisterCounter(opts prometheus.CounterOpts) prometheus.Counter

MustRegisterCounter is a convenience function for NewCounter and MustRegister.

func MustRegisterCounterFunc

func MustRegisterCounterFunc(opts prometheus.CounterOpts, function func() float64) prometheus.CounterFunc

MustRegisterCounterFunc is a convenience function for NewCounterFunc and MustRegister.

func MustRegisterCounterVec

func MustRegisterCounterVec(opts prometheus.CounterOpts, labelNames []string) *prometheus.CounterVec

MustRegisterCounterVec is a convenience function for NewCounterVec and MustRegister.

func MustRegisterGauge

func MustRegisterGauge(opts prometheus.GaugeOpts) prometheus.Gauge

MustRegisterGauge is a convenience function for NewGauge and MustRegister.

func MustRegisterGaugeFunc

func MustRegisterGaugeFunc(opts prometheus.GaugeOpts, function func() float64) prometheus.GaugeFunc

MustRegisterGaugeFunc is a convenience function for NewGaugeFunc and MustRegister.

func MustRegisterGaugeVec

func MustRegisterGaugeVec(opts prometheus.GaugeOpts, labelNames []string) *prometheus.GaugeVec

MustRegisterGaugeVec is a convenience function for NewGaugeVec and MustRegister.

func MustRegisterHistogram

func MustRegisterHistogram(opts prometheus.HistogramOpts) prometheus.Histogram

MustRegisterHistogram is a convenience function for NewHistogram and MustRegister.

func MustRegisterHistogramVec

func MustRegisterHistogramVec(opts prometheus.HistogramOpts, labelNames []string) *prometheus.HistogramVec

MustRegisterHistogramVec is a convenience function for NewHistogramVec and MustRegister.

func NewCounter

func NewCounter(opts prometheus.CounterOpts) prometheus.Counter

NewCounter returns a new Counter and sets its namespace.

func NewCounterFunc

func NewCounterFunc(opts prometheus.CounterOpts, function func() float64) prometheus.CounterFunc

NewCounterFunc returns a new CounterFunc and sets its namespace.

func NewCounterVec

func NewCounterVec(opts prometheus.CounterOpts, labelNames []string) *prometheus.CounterVec

NewCounterVec returns a new CounterVec and sets its namespace.

func NewGauge

func NewGauge(opts prometheus.GaugeOpts) prometheus.Gauge

NewGauge returns a new Gauge and sets its namespace.

func NewGaugeFunc

func NewGaugeFunc(opts prometheus.GaugeOpts, function func() float64) prometheus.GaugeFunc

NewGaugeFunc returns a new GaugeFunc and sets its namespace.

func NewGaugeVec

func NewGaugeVec(opts prometheus.GaugeOpts, labelNames []string) *prometheus.GaugeVec

NewGaugeVec returns a new GaugeVec and sets its namespace.

func NewHistogram

func NewHistogram(opts prometheus.HistogramOpts) prometheus.Histogram

NewHistogram returns a new Histogram and sets its namespace.

func NewHistogramVec

func NewHistogramVec(opts prometheus.HistogramOpts, labelNames []string) *prometheus.HistogramVec

NewHistogramVec returns a new HistogramVec and sets its namespace.

func Register

func Register(c prometheus.Collector) error

Register registers the given Collector in the registry.

func Unregister

func Unregister(c prometheus.Collector) bool

Unregister the given Collector from the Prometheus registry.

Types

type ContextualCounterVec

type ContextualCounterVec struct {
	*prometheus.CounterVec
}

ContextualCounterVec wraps a CounterVec in order to get labels from the context.

func MustRegisterContextualCounterVec

func MustRegisterContextualCounterVec(opts prometheus.CounterOpts, labelNames []string) *ContextualCounterVec

MustRegisterContextualCounterVec is a convenience function for NewContextualCounterVec and MustRegister.

func NewContextualCounterVec

func NewContextualCounterVec(opts prometheus.CounterOpts, labelNames []string) *ContextualCounterVec

NewContextualCounterVec returns a new ContextualCounterVec and sets its namespace.

func (ContextualCounterVec) With

With is the equivalent of CounterVec.With, but with a context.

func (ContextualCounterVec) WithLabelValues

func (c ContextualCounterVec) WithLabelValues(ctx context.Context, lvs ...string) prometheus.Counter

WithLabelValues is the equivalent of CounterVec.WithLabelValues, but with a context.

type ContextualGaugeVec

type ContextualGaugeVec struct {
	*prometheus.GaugeVec
}

ContextualGaugeVec wraps a GaugeVec in order to get labels from the context.

func MustRegisterContextualGaugeVec

func MustRegisterContextualGaugeVec(opts prometheus.GaugeOpts, labelNames []string) *ContextualGaugeVec

MustRegisterContextualGaugeVec is a convenience function for NewContextualGaugeVec and MustRegister.

func NewContextualGaugeVec

func NewContextualGaugeVec(opts prometheus.GaugeOpts, labelNames []string) *ContextualGaugeVec

NewContextualGaugeVec returns a new ContextualGaugeVec and sets its namespace.

func (ContextualGaugeVec) With

With is the equivalent of GaugeVec.With, but with a context.

func (ContextualGaugeVec) WithLabelValues

func (c ContextualGaugeVec) WithLabelValues(ctx context.Context, lvs ...string) prometheus.Gauge

WithLabelValues is the equivalent of GaugeVec.WithLabelValues, but with a context.

type ContextualHistogramVec

type ContextualHistogramVec struct {
	*prometheus.HistogramVec
}

ContextualHistogramVec wraps a HistogramVec in order to get labels from the context.

func MustRegisterContextualHistogramVec

func MustRegisterContextualHistogramVec(opts prometheus.HistogramOpts, labelNames []string) *ContextualHistogramVec

MustRegisterContextualHistogramVec is a convenience function for NewContextualHistogramVec and MustRegister.

func NewContextualHistogramVec

func NewContextualHistogramVec(opts prometheus.HistogramOpts, labelNames []string) *ContextualHistogramVec

NewContextualHistogramVec returns a new ContextualHistogramVec and sets its namespace.

func (ContextualHistogramVec) With

With is the equivalent of HistogramVec.With, but with a context.

func (ContextualHistogramVec) WithLabelValues

func (c ContextualHistogramVec) WithLabelValues(ctx context.Context, lvs ...string) prometheus.Observer

WithLabelValues is the equivalent of HistogramVec.WithLabelValues, but with a context.

Jump to

Keyboard shortcuts

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