metering

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FinishFn

type FinishFn func(counterLabels prometheus.Labels)

FinishFn is the function which will finish the metring for a request using the provided counter labels

type MetricsRegistry

type MetricsRegistry interface {
	// PromRegistry returns the prometheus registry
	PromRegistry() *prometheus.Registry
	// NewSummary gets or creates and registers a new Summary
	NewSummary(alias string, promOpts *prometheus.SummaryOpts, labelNames ...string) Summary
	// WithAlias returns the Summary with the provided alias
	WithAlias(alias string) Summary
	// WithAliasOrCreate tries to get a metering.Summary by the provided alias, or create it using the parameters
	WithAliasOrCreate(alias string, promOpts *prometheus.SummaryOpts, labelNames ...string) Summary
}

MetricsRegistry is a facade for registering metrics

func NewRegistry

func NewRegistry(registry *prometheus.Registry) MetricsRegistry

NewRegistry creates a new MetricsRegistry backed by a new prometheus.Registry

type Summary

type Summary interface {
	// StartMetering starts the metering for the provided prometheus.Labels returning a FinishFn to end the metering
	StartMetering(labels prometheus.Labels) FinishFn
	// MetricVec returns the prometheus.MetricVec for the summary
	MetricVec() *prometheus.MetricVec
}

Summary is provides a facade for metering using a counter and a summary

Jump to

Keyboard shortcuts

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