prometheus

package
v1.3.6 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PrometheusCounter

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

PrometheusCounter adapts prometheus.Counter/CounterVec to srouter_metrics.Counter.

func (*PrometheusCounter) Add

func (c *PrometheusCounter) Add(val float64)

Add increments the counter by a given value. Label values are ignored as the SRouter interface expects Add(float64).

func (*PrometheusCounter) Description

func (c *PrometheusCounter) Description() string

func (*PrometheusCounter) Inc

func (c *PrometheusCounter) Inc()

Inc increments the counter. Label values are ignored as the SRouter interface expects Inc().

func (*PrometheusCounter) Name

func (c *PrometheusCounter) Name() string

func (*PrometheusCounter) Tags

func (*PrometheusCounter) Type

type PrometheusCounterBuilder

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

PrometheusCounterBuilder adapts Prometheus counter creation.

func (*PrometheusCounterBuilder) Build

Build creates and registers the Prometheus counter.

func (*PrometheusCounterBuilder) Description

func (*PrometheusCounterBuilder) LabelNames

func (*PrometheusCounterBuilder) Name

func (*PrometheusCounterBuilder) Tag

type PrometheusGauge

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

PrometheusGauge adapts prometheus.Gauge/GaugeVec to srouter_metrics.Gauge.

func (*PrometheusGauge) Add

func (g *PrometheusGauge) Add(val float64)

Add adds the given value to the gauge. Label values are ignored as the SRouter interface expects Add(float64).

func (*PrometheusGauge) Dec

func (g *PrometheusGauge) Dec()

Dec decrements the gauge. Label values are ignored as the SRouter interface expects Dec().

func (*PrometheusGauge) Description

func (g *PrometheusGauge) Description() string

func (*PrometheusGauge) Inc

func (g *PrometheusGauge) Inc()

Inc increments the gauge. Label values are ignored as the SRouter interface expects Inc().

func (*PrometheusGauge) Name

func (g *PrometheusGauge) Name() string

func (*PrometheusGauge) Set

func (g *PrometheusGauge) Set(val float64)

Set sets the gauge value. Label values are ignored as the SRouter interface expects Set(float64).

func (*PrometheusGauge) Sub

func (g *PrometheusGauge) Sub(val float64)

Sub subtracts the given value from the gauge. Label values are ignored as the SRouter interface expects Sub(float64).

func (*PrometheusGauge) Tags

func (*PrometheusGauge) Type

func (*PrometheusGauge) WithTags

type PrometheusGaugeBuilder

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

PrometheusGaugeBuilder adapts Prometheus gauge creation.

func (*PrometheusGaugeBuilder) Build

Build creates and registers the Prometheus gauge.

func (*PrometheusGaugeBuilder) Description

func (*PrometheusGaugeBuilder) LabelNames

func (*PrometheusGaugeBuilder) Name

func (*PrometheusGaugeBuilder) Tag

type PrometheusHistogram

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

PrometheusHistogram adapts prometheus.Histogram/HistogramVec to srouter_metrics.Histogram.

func (*PrometheusHistogram) Description

func (h *PrometheusHistogram) Description() string

func (*PrometheusHistogram) Name

func (h *PrometheusHistogram) Name() string

func (*PrometheusHistogram) Observe

func (h *PrometheusHistogram) Observe(val float64)

Observe adds a single observation to the histogram. Label values are ignored as the SRouter interface expects Observe(float64).

func (*PrometheusHistogram) Tags

func (*PrometheusHistogram) Type

func (*PrometheusHistogram) WithTags

type PrometheusHistogramBuilder

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

PrometheusHistogramBuilder adapts Prometheus histogram creation.

func (*PrometheusHistogramBuilder) Buckets

Buckets sets the histogram buckets, accepting a slice per the interface.

func (*PrometheusHistogramBuilder) Build

Build creates and registers the Prometheus histogram.

func (*PrometheusHistogramBuilder) Description

func (*PrometheusHistogramBuilder) LabelNames

func (*PrometheusHistogramBuilder) Name

func (*PrometheusHistogramBuilder) Tag

type PrometheusRegistry added in v1.2.1

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

PrometheusRegistry adapts a Prometheus Registerer/Gatherer to SRouter's MetricsRegistry interface.

func NewPrometheusRegistry added in v1.2.1

func NewPrometheusRegistry(registry prometheus.Registerer, namespace, subsystem string, logger *zap.Logger) *PrometheusRegistry

NewPrometheusRegistry creates a new adapter using a prometheus.Registerer and a zap logger.

func (*PrometheusRegistry) Clear added in v1.2.1

func (s *PrometheusRegistry) Clear()

Clear attempts to unregister all metrics. Prometheus registry doesn't have a ClearAll. We can iterate and unregister, but it's not atomic.

func (*PrometheusRegistry) Get added in v1.2.1

Get attempts to retrieve a metric by name. Prometheus client doesn't directly support this easily, especially differentiating between metrics with the same name but different labels/tags or types. This implementation returns nil, false. The application should retain references to the metrics it builds.

func (*PrometheusRegistry) NewCounter added in v1.2.1

func (*PrometheusRegistry) NewGauge added in v1.2.1

func (*PrometheusRegistry) NewHistogram added in v1.2.1

func (*PrometheusRegistry) NewSummary added in v1.2.1

func (*PrometheusRegistry) Register added in v1.2.1

Register is handled implicitly by the Build methods using registry.Register

func (*PrometheusRegistry) Unregister added in v1.2.1

func (s *PrometheusRegistry) Unregister(name string) bool

Unregister attempts to unregister a metric by name. NOTE: Prometheus client library makes unregistering by name difficult and potentially unsafe if multiple metrics share the same name (e.g., different labels). This implementation currently cannot reliably unregister by name only. It's effectively a no-op.

func (*PrometheusRegistry) WithTags added in v1.2.1

WithTags creates a new registry instance scoped with additional tags (const labels).

type PrometheusSummary

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

PrometheusSummary adapts prometheus.Summary/SummaryVec to srouter_metrics.Summary.

func (*PrometheusSummary) Description

func (s *PrometheusSummary) Description() string

func (*PrometheusSummary) Name

func (s *PrometheusSummary) Name() string

func (*PrometheusSummary) Objectives

func (s *PrometheusSummary) Objectives() map[float64]float64

func (*PrometheusSummary) Observe

func (s *PrometheusSummary) Observe(val float64)

Observe adds a single observation to the summary. Label values are ignored as the SRouter interface expects Observe(float64).

func (*PrometheusSummary) Tags

func (*PrometheusSummary) Type

func (*PrometheusSummary) WithTags

type PrometheusSummaryBuilder

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

PrometheusSummaryBuilder adapts Prometheus summary creation.

func (*PrometheusSummaryBuilder) AgeBuckets

AgeBuckets sets the number of buckets used to calculate quantiles over time. Accepts int per the interface.

func (*PrometheusSummaryBuilder) BufCap

func (*PrometheusSummaryBuilder) Build

Build creates and registers the Prometheus summary.

func (*PrometheusSummaryBuilder) Description

func (*PrometheusSummaryBuilder) LabelNames

func (*PrometheusSummaryBuilder) MaxAge

func (*PrometheusSummaryBuilder) Name

func (*PrometheusSummaryBuilder) Objectives

func (*PrometheusSummaryBuilder) Tag

Jump to

Keyboard shortcuts

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