metrics

package
v0.26.1 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Collector

type Collector interface {
	ApiErrorOccurred()
	ServerPanicked(err error)
	MeasureRequestDuration(start time.Time, labels prometheus.Labels)
}

func NewCollector

func NewCollector(logger zerolog.Logger) Collector

type DefaultCollector

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

func (*DefaultCollector) ApiErrorOccurred

func (c *DefaultCollector) ApiErrorOccurred()

func (*DefaultCollector) MeasureRequestDuration

func (c *DefaultCollector) MeasureRequestDuration(start time.Time, labels prometheus.Labels)

func (*DefaultCollector) ServerPanicked

func (c *DefaultCollector) ServerPanicked(err error)

type HttpHandler

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

HttpHandler is a thin middleware for gathering metrics about http request. It makes no decision about error handling. If one occurred, we log it and pass request on to the underlying handler to make a decision

func NewHttpHandler

func NewHttpHandler(handler http.Handler, collector Collector, logger zerolog.Logger) *HttpHandler

func (*HttpHandler) ServeHTTP

func (h *HttpHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type NoopCollector

type NoopCollector struct{}

func (*NoopCollector) ApiErrorOccurred

func (c *NoopCollector) ApiErrorOccurred()

func (*NoopCollector) MeasureRequestDuration

func (c *NoopCollector) MeasureRequestDuration(time.Time, prometheus.Labels)

func (*NoopCollector) ServerPanicked

func (c *NoopCollector) ServerPanicked(error)

type PrometheusConfig

type PrometheusConfig struct {
	ScrapeConfigs []ScrapeConfig `yaml:"scrape_configs"`
}

type ScrapeConfig

type ScrapeConfig struct {
	JobName       string         `yaml:"job_name"`
	StaticConfigs []StaticConfig `yaml:"static_configs"`
}

type Server

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

Server is the http server that will be serving the /metrics request for prometheus

func NewServer

func NewServer(log zerolog.Logger, prometheusConfigPath string) (*Server, error)

NewServer creates a new server that will start on the specified port, and responds to only the `/metrics` endpoint

func (*Server) Done

func (s *Server) Done() <-chan struct{}

func (*Server) Ready

func (s *Server) Ready() <-chan struct{}

type StaticConfig

type StaticConfig struct {
	Targets []string `yaml:"targets"`
}

Jump to

Keyboard shortcuts

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