metrics

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ComponentNamespace = "component"

	// MessagingProducerMetricMillisecond is a prometheus histogram for measuring the duration of a request.
	MessagingProducerMetricMillisecond = prometheus.NewHistogramVec(prometheus.HistogramOpts{
		Namespace: ComponentNamespace,
		Subsystem: "messaging_producer_requests",
		Name:      "duration_ms",
		Help:      "requests duration(ms).",
		Buckets:   []float64{5, 10, 25, 50, 100, 250, 500, 1000, 2500, 5000},
	}, []string{"kind", "addr", "destination"})

	// MessagingProducerMetricRequests  is a counter vector of requests.
	MessagingProducerMetricRequests = prometheus.NewCounterVec(prometheus.CounterOpts{
		Namespace: ComponentNamespace,
		Subsystem: "messaging_producer_requests",
		Name:      "total",
		Help:      "The total number of processed requests",
	}, []string{"kind", "addr", "destination", "status"})

	// MessagingConsumerMetricMillisecond is a prometheus histogram for measuring the duration of a request.
	MessagingConsumerMetricMillisecond = prometheus.NewHistogramVec(prometheus.HistogramOpts{
		Namespace: ComponentNamespace,
		Subsystem: "messaging_consumer_requests",
		Name:      "duration_ms",
		Help:      "requests duration(ms).",
		Buckets:   []float64{5, 10, 25, 50, 100, 250, 500, 1000, 2500, 5000},
	}, []string{"kind", "addr", "destination", "group"})

	// MessagingConsumerMetricRequests  is a counter vector of requests.
	MessagingConsumerMetricRequests = prometheus.NewCounterVec(prometheus.CounterOpts{
		Namespace: ComponentNamespace,
		Subsystem: "messaging_consumer_requests",
		Name:      "total",
		Help:      "The total number of processed requests",
	}, []string{"kind", "addr", "destination", "group", "status"})
)

Functions

func Client

func Client(opts ...Option) middleware.Middleware

Client metrics.

func Server

func Server(opts ...Option) middleware.Middleware

Server metrics.

Types

type Option

type Option func(options *options)

Option is metrics option.

func WithAddr

func WithAddr(address string) Option

WithAddr with addr label.

func WithDisabled

func WithDisabled(disabled bool) Option

WithDisabled set disabled metrics.

func WithGroup

func WithGroup(group string) Option

func WithMillisecond

func WithMillisecond(c metrics.Observer) Option

WithMillisecond with seconds histogram.

func WithNamespace

func WithNamespace(namespace string) Option

func WithRequests

func WithRequests(c metrics.Counter) Option

WithRequests with requests counter.

Jump to

Keyboard shortcuts

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