prometheus

package
v0.0.26 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2022 License: LGPL-3.0 Imports: 13 Imported by: 0

Documentation

Overview

Package prometheus defines a service which is used for metrics collection and health of a node in Harmony.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PromRegistry

func PromRegistry() *prometheus.Registry

PromRegistry return the registry of prometheus service

Types

type Config

type Config struct {
	Enabled    bool
	IP         string
	Port       int
	EnablePush bool   // enable pushgateway support
	Gateway    string // address of the pushgateway
	Network    string // network type, used as job prefix
	Legacy     bool   // legacy or not, legacy is harmony internal node
	NodeType   string // node type, validator or exlorer node
	Shard      uint32 // shard id, used as job suffix
	Instance   string //identifier of the instance in prometheus metrics
}

Config is the config for the prometheus service

func (Config) String

func (p Config) String() string

type Handler

type Handler struct {
	Path    string
	Handler func(http.ResponseWriter, *http.Request)
}

Handler represents a path and handler func to serve on the same port as /metrics, /healthz, /goroutinez, etc.

type Service

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

Service provides Prometheus metrics via the /metrics route. This route will show all the metrics registered with the Prometheus DefaultRegisterer.

func NewService

func NewService(cfg Config, additionalHandlers ...Handler) *Service

NewService sets up a new instance for a given address host:port. Anq empty host will match with any IP so an address like ":19000" is perfectly acceptable.

func (*Service) Start

func (s *Service) Start() error

Start start the prometheus service

func (*Service) Status

func (s *Service) Status() error

Status checks for any service failure conditions.

func (*Service) Stop

func (s *Service) Stop() error

Stop stop the Prometheus service

Jump to

Keyboard shortcuts

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