monitor

package
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultRegisterer

func DefaultRegisterer() prometheus.Registerer

DefaultRegisterer returns the default Prometheus registerer. Exposed as a function so callers don't need to import prometheus directly.

Types

type Metrics

type Metrics struct {
	MessagesTotal     *prometheus.CounterVec
	AuthTotal         *prometheus.CounterVec
	MessageLatency    *prometheus.HistogramVec
	ChildProcessUp    prometheus.Gauge
	RateLimitRejected *prometheus.CounterVec
}

Metrics holds all Prometheus metric collectors.

func NewMetrics

func NewMetrics(reg prometheus.Registerer) *Metrics

NewMetrics creates and registers all metrics with the default registerer.

type Server

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

Server is the monitoring HTTP server.

func New

func New(addr string, metrics *Metrics, logger *slog.Logger) *Server

New creates a new monitoring Server.

func (*Server) SetChildPID

func (s *Server) SetChildPID(pid int)

SetChildPID records the child process PID for health checks.

func (*Server) SetMuxSetup added in v0.2.0

func (s *Server) SetMuxSetup(fn func(mux *http.ServeMux))

SetMuxSetup registers a callback to add extra routes before the server starts.

func (*Server) SetUpstreamURL

func (s *Server) SetUpstreamURL(url string)

SetUpstreamURL sets the upstream URL to probe during health checks (proxy mode). An empty string disables upstream probing.

func (*Server) Shutdown

func (s *Server) Shutdown(ctx context.Context)

Shutdown gracefully stops the monitoring server.

func (*Server) Start

func (s *Server) Start()

Start launches the monitoring HTTP server in a background goroutine.

Jump to

Keyboard shortcuts

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