metrics

package
v0.0.0-...-5fb8a3f Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CoreRegistry = prometheus.NewRegistry()

CoreRegistry is the metrics registry that will be served at /core. All prometheus metrics exported by the node core should register here.

View Source
var DefaultExporters = []*Exporter{
	{
		Name:     "core",
		Gatherer: CoreRegistry,
	},
	{
		Name:       "node",
		Port:       node.MetricsNodeListenerPort,
		Executable: "/metrics/bin/node_exporter",
		Arguments: []string{
			"--web.listen-address=127.0.0.1:" + node.MetricsNodeListenerPort.PortString(),
			"--collector.buddyinfo",
			"--collector.zoneinfo",
			"--collector.tcpstat",
			"--collector.cpu.info",
			"--collector.ethtool",
			"--collector.cpu_vulnerabilities",
			"--collector.ethtool.device-exclude=^(veth.*|sit.*|lo|clusternet)$",
			"--collector.netclass.ignored-devices=^(veth.*)$",
			"--collector.netdev.device-exclude=^(veth.*)$",
			"--collector.filesystem.mount-points-exclude=^/(dev|proc|sys|data/kubernetes/kubelet/pods/.+|tmp/.+|ephemeral/containerd/.+)($|/)",
		},
	},
	{
		Name: "etcd",
		Port: node.MetricsEtcdListenerPort,
	},
	{
		Name: "kubernetes-scheduler",
		Port: node.MetricsKubeSchedulerListenerPort,
	},
	{
		Name: "kubernetes-controller-manager",
		Port: node.MetricsKubeControllerManagerListenerPort,
	},
	{
		Name: "kubernetes-apiserver",
		Port: node.MetricsKubeAPIServerListenerPort,
	},
	{
		Name: "containerd",
		Port: node.MetricsContainerdListenerPort,
		Path: "/v1/metrics",
	},
}

DefaultExporters are the exporters which we run by default in Metropolis.

Functions

This section is empty.

Types

type Discovery

type Discovery struct {
	Curator ipb.CuratorClient
	// contains filtered or unexported fields
}

func (*Discovery) Run

func (s *Discovery) Run(ctx context.Context) error

Run is the sub-runnable responsible for fetching and serving node updates.

func (*Discovery) ServeHTTP

func (s *Discovery) ServeHTTP(w http.ResponseWriter, r *http.Request)

type Exporter

type Exporter struct {
	// Name of the exporter, which becomes part of the metrics URL for this exporter.
	Name string
	// Gatherer, if provided, is a Prometheus registry (or other Gatherer) that will
	// be queried for metrics for this exporter. Exactly one of Gatherer or Port must
	// be set.
	Gatherer prometheus.Gatherer
	// Port on which an exporter is/will be running to which metrics requests will be
	// proxied to. Exactly one of Gatherer or Port must be set.
	Port node.Port
	// Executable to run to start the exporter. If empty, no executable will be
	// started.
	Executable string
	// Arguments to start the exporter. The exporter should listen at 127.0.0.1 and
	// the port specified by Port, and serve its metrics on /metrics.
	Arguments []string
	// Path to scrape metrics at. Defaults to /metrics.
	Path string
}

An Exporter is a source of Prometheus metrics. There are two possible kinds of exporters:

1. A binary running under the Metrics service which collects some metrics and exposes them on a locally bound TCP port (either started by the Exporter or already running as part of Metropolis).

2. An in-memory Prometheus registry/gatherer for metrics generated by the Metropolis core process.

The Metrics Service will forward requests from /metrics/<name> to the exporter.

func (*Exporter) ServeHTTP

func (e *Exporter) ServeHTTP(w http.ResponseWriter, r *http.Request)

type Service

type Service struct {
	// Credentials used to run the TLS/HTTPS listener and verify incoming
	// connections.
	Credentials *identity.NodeCredentials
	Discovery   Discovery

	// List of Exporters to run and to forward HTTP requests to. If not set, defaults
	// to DefaultExporters.
	Exporters []*Exporter
	// contains filtered or unexported fields
}

Service is the Metropolis Metrics Service.

Currently, metrics means Prometheus metrics.

It runs a forwarding proxy from a public HTTPS listener to a number of locally-running exporters, themselves listening over HTTP. The listener uses the main cluster CA and the node's main certificate, authenticating incoming connections with the same CA.

Each exporter is exposed on a separate path, /metrics/<name>, where <name> is the name of the exporter.

The HTTPS listener is bound to node.MetricsPort.

func (*Service) Run

func (s *Service) Run(ctx context.Context) error

Directories

Path Synopsis
fake_exporter is a tiny Prometheus-compatible metrics exporter which exports a single metric with a value configured at startup.
fake_exporter is a tiny Prometheus-compatible metrics exporter which exports a single metric with a value configured at startup.

Jump to

Keyboard shortcuts

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