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 ¶
const ( NamespaceEnsign = "ensign" NamespaceGRPC = "grpc" )
Prometheus namespaces for the collectors defined in this package.
Variables ¶
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 ¶
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.
Types ¶
This section is empty.