Documentation ¶
Overview ¶
Package metrics implements the metrics server.
Index ¶
Constants ¶
View Source
const ( KindGauge = "gauge" KindHistogram = "histogram" KindCounter = "counter" )
Constants holding metric kinds.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Histogram ¶
type Histogram struct {
// contains filtered or unexported fields
}
Histogram is custom type emulating prometheus.Histogram
func NewHistogram ¶
func NewHistogram(opts HistogramOpts) *Histogram
NewHistogram creates new Histogram based on Histogram options
func (*Histogram) Collect ¶
func (h *Histogram) Collect(ch chan<- prometheus.Metric)
Collect sends histogram to a prometheus Metric channel.
func (*Histogram) Desc ¶
func (h *Histogram) Desc() *prometheus.Desc
Desc returns prometheus.Desc used by every Prometheus Metric.
func (*Histogram) Describe ¶
func (h *Histogram) Describe(ch chan<- *prometheus.Desc)
Describe sends metric description to a channel.
type HistogramOpts ¶
type HistogramOpts struct { // Namespace, Subsystem, and Name are components of the fully-qualified // name of the Histogram (created by joining these components with // "_"). Only Name is mandatory, the others merely help structuring the // name. Note that the fully-qualified name of the Histogram must be a // valid Prometheus metric name. Namespace string Subsystem string Name string // Help provides information about this Histogram. // // Metrics with the same fully-qualified name must have the same Help // string. Help string // ConstLabels are used to attach fixed labels to this metric. Metrics // with the same fully-qualified name must have the same label names in // their ConstLabels. // // ConstLabels are only used rarely. In particular, do not use them to // attach the same labels to all your metrics. Those use cases are // better covered by target labels set by the scraping Prometheus // server, or by one specific metric (e.g. a build_info or a // machine_role metric). See also // https://prometheus.io/docs/instrumenting/writing_exporters/#target-labels-not-static-scraped-labels ConstLabels prometheus.Labels Buckets []float64 }
HistogramOpts provides configuration options for Histogram.
type UpdateHandler ¶
type UpdateHandler struct {
// contains filtered or unexported fields
}
UpdateHandler handles updating metrics on request
func NewMetricsUpdateHandler ¶
func NewMetricsUpdateHandler(conf UpdateHandlerConfig) (*UpdateHandler, error)
NewMetricsUpdateHandler creates new metric update handler based on the config
func (*UpdateHandler) ServeHTTP ¶
func (h *UpdateHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
type UpdateHandlerConfig ¶
type UpdateHandlerConfig struct { NodeName string Metrics *internalversion.Metric Controller *controllers.Controller Environment *cel.Environment }
UpdateHandlerConfig is configuration for a single node
Click to show internal directories.
Click to hide internal directories.