metrics

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2019 License: MIT Imports: 9 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateRegistryAndServeHTTP

func CreateRegistryAndServeHTTP(addr string) (registry *prometheus.Registry, cancel func())

CreateRegistryAndServeHTTP establishes an HTTP server that exposes the /metrics endpoint for Prometheus at the given address. It returns a new prometheus registry (to register the metrics on) and a canceling function that ends the server.

func ServeHTTP

func ServeHTTP(addr string, registry *prometheus.Registry) (cancel func())

ServeHTTP establishes an HTTP server that exposes the /metrics endpoint for Prometheus at the given address. It takes an existing Prometheus registry and returns a canceling function that ends the server.

Types

type HandlerPrometheusMetricsMiddleware

type HandlerPrometheusMetricsMiddleware struct {
	// contains filtered or unexported fields
}

func (HandlerPrometheusMetricsMiddleware) Middleware

type PrometheusMetricsBuilder

type PrometheusMetricsBuilder struct {
	// PrometheusRegistry may be filled with a pre-existing Prometheus registry, or left empty for the default registry.
	PrometheusRegistry *prometheus.Registry

	Namespace string
	Subsystem string
}

PrometheusMetricsBuilder provides methods to decorate publishers, subscribers and handlers.

func NewPrometheusMetricsBuilder

func NewPrometheusMetricsBuilder(prometheusRegistry *prometheus.Registry, namespace string, subsystem string) PrometheusMetricsBuilder

func (PrometheusMetricsBuilder) AddPrometheusRouterMetrics

func (b PrometheusMetricsBuilder) AddPrometheusRouterMetrics(r *message.Router)

AddPrometheusRouterMetrics is a convenience function that acts on the message router to add the metrics middleware to all its handlers. The handlers' publishers and subscribers are also decorated.

func (PrometheusMetricsBuilder) DecoratePublisher

func (b PrometheusMetricsBuilder) DecoratePublisher(pub message.Publisher) (message.Publisher, error)

DecoratePublisher wraps the underlying publisher with Prometheus metrics.

func (PrometheusMetricsBuilder) DecorateSubscriber

func (b PrometheusMetricsBuilder) DecorateSubscriber(sub message.Subscriber) (message.Subscriber, error)

DecorateSubscriber wraps the underlying subscriber with Prometheus metrics.

func (PrometheusMetricsBuilder) NewRouterMiddleware

type PublisherPrometheusMetricsDecorator

type PublisherPrometheusMetricsDecorator struct {
	// contains filtered or unexported fields
}

func (PublisherPrometheusMetricsDecorator) Close

Close decreases the total publisher count, closes the Prometheus HTTP server and calls wrapped Close.

func (PublisherPrometheusMetricsDecorator) Publish

func (m PublisherPrometheusMetricsDecorator) Publish(topic string, messages ...*message.Message) (err error)

Publish updates the relevant publisher metrics and calls the wrapped publisher's Publish.

type SubscriberPrometheusMetricsDecorator

type SubscriberPrometheusMetricsDecorator struct {
	message.Subscriber
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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