o11y

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2023 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Overview

Package o11y (a numeronym for "observability") exports server-specific metric collectors to Prometheus for monitoring of the service and Ensign nodes. The package also manages the http server that presents the metric collectors to the Prometheus scraper in an on demand fashion.

At least once before use, an external caller needs to call the package Serve() method with the desired configuration -- this will ensure the collector server starts up and that the metrics collected are available for use in external packages. To clean up the server, external callers should call the Shutdown() method.

Index

Constants

View Source
const (
	NamespaceEnsign = "ensign"
	NamespaceGRPC   = "grpc"
)

Prometheus namespaces for the collectors defined in this package.

Variables

View Source
var (
	// All Ensign specific collectors for observability are defined here.
	Events            *prometheus.CounterVec
	OnlinePublishers  prometheus.Gauge
	OnlineSubscribers prometheus.Gauge

	// Generic gRPC collectors for observability defined here.
	RPCStarted    *prometheus.CounterVec
	RPCHandled    *prometheus.CounterVec
	RPCDuration   *prometheus.HistogramVec
	StreamMsgSent *prometheus.CounterVec
	StreamMsgRecv *prometheus.CounterVec
)

Functions

func PreRegisterGRPCMetrics

func PreRegisterGRPCMetrics(srv *grpc.Server)

Initializes all gRPC metrics with their appropriate null value for a gRPC service. This is useful to ensure that all metrics exist when collecting and querying without having to wait for an RPC to be called. This method should not be called before the Serve method is called otherwise it will panic.

func Serve

func Serve(conf config.MonitoringConfig) error

Serve the prometheus metric collectors server so that the Prometheus scraper can collect metrics from the node. This method must be called at least once before any of the metrics in this package can be used. Calling serve multiple times will not cause problems but only the first call to Serve (and therefore the first config) will be used. It is possible to call Serve again after calling Shutdown.

func Shutdown

func Shutdown(ctx context.Context) error

Shutdown the prometheus metrics collectors server and reset the package. This method should be called at least once by outside callers before the process shuts down to ensure that system resources are cleaned up correctly.

Types

This section is empty.

Jump to

Keyboard shortcuts

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