Documentation ¶
Overview ¶
Package metrics creates the metrics registry and exposes some common metrics.
Index ¶
- Constants
- Variables
- func InitializeServerMetrics(s *grpc.Server)
- func MustRegister(cs ...prometheus.Collector)
- func MustRegisterCounter(opts prometheus.CounterOpts) prometheus.Counter
- func MustRegisterCounterFunc(opts prometheus.CounterOpts, function func() float64) prometheus.CounterFunc
- func MustRegisterCounterVec(opts prometheus.CounterOpts, labelNames []string) *prometheus.CounterVec
- func MustRegisterGauge(opts prometheus.GaugeOpts) prometheus.Gauge
- func MustRegisterGaugeFunc(opts prometheus.GaugeOpts, function func() float64) prometheus.GaugeFunc
- func MustRegisterGaugeVec(opts prometheus.GaugeOpts, labelNames []string) *prometheus.GaugeVec
- func MustRegisterHistogram(opts prometheus.HistogramOpts) prometheus.Histogram
- func MustRegisterHistogramVec(opts prometheus.HistogramOpts, labelNames []string) *prometheus.HistogramVec
- func NewCounter(opts prometheus.CounterOpts) prometheus.Counter
- func NewCounterFunc(opts prometheus.CounterOpts, function func() float64) prometheus.CounterFunc
- func NewCounterVec(opts prometheus.CounterOpts, labelNames []string) *prometheus.CounterVec
- func NewGauge(opts prometheus.GaugeOpts) prometheus.Gauge
- func NewGaugeFunc(opts prometheus.GaugeOpts, function func() float64) prometheus.GaugeFunc
- func NewGaugeVec(opts prometheus.GaugeOpts, labelNames []string) *prometheus.GaugeVec
- func NewHistogram(opts prometheus.HistogramOpts) prometheus.Histogram
- func NewHistogramVec(opts prometheus.HistogramOpts, labelNames []string) *prometheus.HistogramVec
- func Register(c prometheus.Collector) error
- func Unregister(c prometheus.Collector) bool
- type ContextualCounterVec
- type ContextualGaugeVec
- type ContextualHistogramVec
Constants ¶
const Namespace = "ttn_lw"
Namespace for metrics.
Variables ¶
var ( StreamServerInterceptor = serverMetrics.StreamServerInterceptor() UnaryServerInterceptor = serverMetrics.UnaryServerInterceptor() )
Server interceptors.
var ( StreamClientInterceptor = clientMetrics.StreamClientInterceptor() UnaryClientInterceptor = clientMetrics.UnaryClientInterceptor() )
Client interceptors.
var ContextLabelNames []string
ContextLabelNames are the label names that can be retrieved from a context for XXXVec metrics.
var Exporter http.Handler = promhttp.InstrumentMetricHandler( registry, promhttp.HandlerFor(registry, promhttp.HandlerOpts{}), )
Exporter for the metrics registry.
var LabelsFromContext func(ctx context.Context) prometheus.Labels
LabelsFromContext returns the values for ContextLabelNames.
var Registry prometheus.Registerer = registry
Registry for metrics.
var StatsHandler stats.Handler = gRPCStats
StatsHandler for gRPC.
Functions ¶
func InitializeServerMetrics ¶
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 ¶
func (c ContextualCounterVec) With(ctx context.Context, labels prometheus.Labels) prometheus.Counter
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 ¶
func (c ContextualGaugeVec) With(ctx context.Context, labels prometheus.Labels) prometheus.Gauge
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 ¶
func (c ContextualHistogramVec) With(ctx context.Context, labels prometheus.Labels) prometheus.Observer
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.