Help us shape the future of Go! Take the 2026 Go Developer Survey

prometheus

package
v1.10.2 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2021 License: MIT Imports: 11 Imported by: 1

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 NewService

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

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

func PromRegistry

func PromRegistry() *prometheus.Registry

PromRegistry return the registry of prometheus service

func StopService

func StopService() error

StopService stop the 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 (*Service) Start

func (s *Service) 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 the service gracefully.

Jump to

Keyboard shortcuts

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