metrics

package
v3.4.3 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2023 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewNginxMetricsClient

func NewNginxMetricsClient(httpClient *http.Client) *prometheusClient.NginxClient

NewNginxMetricsClient creates an NginxClient to fetch stats from NGINX over an unix socket

func RunPrometheusListenerForNginx

func RunPrometheusListenerForNginx(port int, client *prometheusClient.NginxClient, registry *prometheus.Registry, constLabels map[string]string, prometheusSecret *v1.Secret)

RunPrometheusListenerForNginx runs an http server to expose Prometheus metrics for NGINX

func RunPrometheusListenerForNginxPlus

func RunPrometheusListenerForNginxPlus(port int, nginxPlusCollector prometheus.Collector, registry *prometheus.Registry, prometheusSecret *v1.Secret)

RunPrometheusListenerForNginxPlus runs an http server to expose Prometheus metrics for NGINX Plus

Types

type LatencyMetricsListener

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

LatencyMetricsListener implements the SyslogListener interface

func (LatencyMetricsListener) Run

func (l LatencyMetricsListener) Run()

Run reads from the unix connection until an unrecoverable error occurs or the connection is closed.

func (LatencyMetricsListener) Stop

func (l LatencyMetricsListener) Stop()

Stop closes the unix connection of the listener.

type Server

type Server struct {
	Server   *http.Server
	URL      string
	Registry prometheus.Gatherer
}

Server holds information about NIC metrics server.

func NewServer

func NewServer(addr string, registry prometheus.Gatherer, secret *v1.Secret) (*Server, error)

NewServer creates HTTP server for serving NIC metrics for Prometheus.

Metrics are exposed on the `/metrics` endpoint.

func (*Server) Home

func (s *Server) Home(w http.ResponseWriter, r *http.Request)

Home is a handler for serving metrics home page.

func (*Server) ListenAndServe

func (s *Server) ListenAndServe() error

ListenAndServe starts metrics server.

func (*Server) Shutdown

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

Shutdown shuts down metrics server.

type SyslogFakeListener

type SyslogFakeListener struct{}

SyslogFakeListener is a fake implementation of the SyslogListener interface

func NewSyslogFakeServer

func NewSyslogFakeServer() *SyslogFakeListener

NewSyslogFakeServer returns a SyslogFakeListener

func (SyslogFakeListener) Run

func (s SyslogFakeListener) Run()

Run is a fake implementation of SyslogListener Run

func (SyslogFakeListener) Stop

func (s SyslogFakeListener) Stop()

Stop is a fake implementation of SyslogListener Stop

type SyslogListener

type SyslogListener interface {
	Run()
	Stop()
}

SyslogListener is an interface for syslog metrics listener that reads syslog metrics logged by nginx

func NewLatencyMetricsListener

func NewLatencyMetricsListener(sockPath string, c collectors.LatencyCollector) SyslogListener

NewLatencyMetricsListener returns a LatencyMetricsListener that listens over a unix socket for syslog messages from nginx.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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