Documentation
¶
Index ¶
- Variables
- func AppendNamespace(namespace, name string) string
- func AsCollector(m interface{}) prometheus.Collector
- func HTTPHandler(gatherer prometheus.Gatherer, opts promhttp.HandlerOpts) http.Handler
- func Handler() http.Handler
- func HandlerFor(gatherer prometheus.Gatherer) http.Handler
- func HandlerForContext(gatherer GathererWithContext, opts HandlerOpts) http.Handler
- func InstrumentMetricHandler(reg prometheus.Registerer, handler http.Handler) http.Handler
- func MustNewPrometheusConstMetric(desc *prometheus.Desc, valueType prometheus.ValueType, value float64, ...) prometheus.Metric
- func NewContextCollectorWrapper(c CollectorWithContext) prometheus.Collector
- func NewGoCollector() prometheus.Collector
- func NewProcessCollector(opts ProcessCollectorOpts) prometheus.Collector
- func NewPrometheusDesc(fqName, help string, variableLabels []string, constLabels prometheus.Labels) *prometheus.Desc
- func SetFactory(factory Factory)
- func ToPrometheusGatherer(r Registry) prometheus.Gatherer
- func ToPrometheusRegisterer(r Registry) prometheus.Registerer
- func WithContextFunc(fn func(*http.Request) context.Context) func(*HandlerOpts)
- func WithErrorLog(logger func(error)) func(*HandlerOpts)
- func WithMaxRequestsInFlight(max int) func(*HandlerOpts)
- func WithTimeout(timeout time.Duration) func(*HandlerOpts)
- func WrapPrometheusRegistererWith(labels prometheus.Labels, reg prometheus.Registerer) prometheus.Registerer
- func WrapPrometheusRegistererWithPrefix(prefix string, reg prometheus.Registerer) prometheus.Registerer
- type Averager
- type Client
- type Collector
- type CollectorAdapter
- type CollectorFunc
- type CollectorWithContext
- type ContextCollectorWrapper
- type ContextRegistry
- func (r *ContextRegistry) Gather() ([]*dto.MetricFamily, error)
- func (r *ContextRegistry) GatherWithContext(ctx context.Context) ([]*dto.MetricFamily, error)
- func (r *ContextRegistry) MustRegister(cs ...prometheus.Collector)
- func (r *ContextRegistry) Register(c prometheus.Collector) error
- func (r *ContextRegistry) Unregister(c prometheus.Collector) bool
- type Counter
- type CounterOpts
- type CounterVec
- type DTOMetricFamily
- type Desc
- type Errs
- type Factory
- type Gatherer
- type GathererFunc
- type GathererWithContext
- type GathererWithContextFunc
- type Gatherers
- type Gauge
- type GaugeOpts
- type GaugeVec
- type HTTPHandlerOpts
- type HandlerOpts
- type Histogram
- type HistogramOpts
- type HistogramVec
- type Labels
- type Metric
- type MetricFamilies
- type MetricFamily
- type Metrics
- type MetricsHTTPHandler
- type MultiGatherer
- type MultiGathererWithContext
- type ProcessCollectorOpts
- type PrometheusCollector
- type PrometheusDesc
- type PrometheusGatherer
- type PrometheusLabels
- type PrometheusMetric
- type PrometheusMetricFamily
- type PrometheusRegisterer
- type PrometheusValueType
- type Registerer
- type Registry
- type Request
- type ResponseWriter
- type Summary
- type SummaryOpts
- type SummaryVec
- type TextParser
- type Timer
Constants ¶
This section is empty.
Variables ¶
var ( NewHistogram = prometheus.NewHistogram NewSummary = prometheus.NewSummary NewSummaryVec = prometheus.NewSummaryVec NewRegistry = prometheus.NewRegistry NewDesc = prometheus.NewDesc MustNewConstMetric = prometheus.MustNewConstMetric Register = prometheus.Register MustRegister = prometheus.MustRegister Unregister = prometheus.Unregister )
Keep these as direct aliases since they don't need wrapping
var ErrFailedRegistering = errors.New("failed registering metric")
var NewPrometheusRegistry = NewRegistry
NewPrometheusRegistry is an alias for NewRegistry for backward compatibility
Functions ¶
func AppendNamespace ¶
AppendNamespace appends a namespace to a metric name if needed
func AsCollector ¶
func AsCollector(m interface{}) prometheus.Collector
AsCollector returns a metric as a prometheus.Collector for registration
func HTTPHandler ¶
func HTTPHandler(gatherer prometheus.Gatherer, opts promhttp.HandlerOpts) http.Handler
HTTPHandler creates an HTTP handler for metrics
func HandlerFor ¶
func HandlerFor(gatherer prometheus.Gatherer) http.Handler
HandlerFor creates an HTTP handler with context support for the given gatherer.
func HandlerForContext ¶
func HandlerForContext(gatherer GathererWithContext, opts HandlerOpts) http.Handler
HandlerForContext creates an HTTP handler that serves metrics with context support. It respects the X-Prometheus-Scrape-Timeout-Seconds header and propagates context through the gathering process.
func InstrumentMetricHandler ¶
func InstrumentMetricHandler(reg prometheus.Registerer, handler http.Handler) http.Handler
InstrumentMetricHandler wraps a metrics handler with standard HTTP instrumentation.
func MustNewPrometheusConstMetric ¶
func MustNewPrometheusConstMetric(desc *prometheus.Desc, valueType prometheus.ValueType, value float64, labelValues ...string) prometheus.Metric
MustNewPrometheusConstMetric creates a new constant metric
func NewContextCollectorWrapper ¶
func NewContextCollectorWrapper(c CollectorWithContext) prometheus.Collector
NewContextCollectorWrapper creates a wrapper for a context-aware collector.
func NewGoCollector ¶
func NewGoCollector() prometheus.Collector
NewGoCollector creates a new Go collector
func NewProcessCollector ¶
func NewProcessCollector(opts ProcessCollectorOpts) prometheus.Collector
NewProcessCollector creates a new process collector
func NewPrometheusDesc ¶
func NewPrometheusDesc(fqName, help string, variableLabels []string, constLabels prometheus.Labels) *prometheus.Desc
NewPrometheusDesc creates a new prometheus descriptor
func ToPrometheusGatherer ¶
func ToPrometheusGatherer(r Registry) prometheus.Gatherer
ToPrometheusGatherer converts our Registry to a prometheus.Gatherer Since Registry is already *prometheus.Registry, just return it
func ToPrometheusRegisterer ¶
func ToPrometheusRegisterer(r Registry) prometheus.Registerer
ToPrometheusRegisterer converts our Registry to a prometheus.Registerer Since Registry is already *prometheus.Registry, just return it
func WithContextFunc ¶
func WithContextFunc(fn func(*http.Request) context.Context) func(*HandlerOpts)
WithContextFunc returns a HandlerOpts option that sets a custom context function.
func WithErrorLog ¶
func WithErrorLog(logger func(error)) func(*HandlerOpts)
WithErrorLog returns a HandlerOpts option that sets the error logger.
func WithMaxRequestsInFlight ¶
func WithMaxRequestsInFlight(max int) func(*HandlerOpts)
WithMaxRequestsInFlight returns a HandlerOpts option that sets the max concurrent requests.
func WithTimeout ¶
func WithTimeout(timeout time.Duration) func(*HandlerOpts)
WithTimeout returns a HandlerOpts option that sets the timeout.
func WrapPrometheusRegistererWith ¶
func WrapPrometheusRegistererWith(labels prometheus.Labels, reg prometheus.Registerer) prometheus.Registerer
WrapPrometheusRegistererWith wraps a prometheus registerer with labels
func WrapPrometheusRegistererWithPrefix ¶
func WrapPrometheusRegistererWithPrefix(prefix string, reg prometheus.Registerer) prometheus.Registerer
WrapPrometheusRegistererWithPrefix wraps a prometheus registerer with a prefix
Types ¶
type Averager ¶
type Averager interface {
Observe(float64)
}
func NewAverager ¶
func NewAverager(name, desc string, reg Registerer) (Averager, error)
func NewAveragerWithErrs ¶
func NewAveragerWithErrs(name, desc string, reg Registerer, errs *Errs) Averager
func NewNoAverager ¶
func NewNoAverager() Averager
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client for requesting metrics from a remote Lux Node instance
func (*Client) GetMetrics ¶
GetMetrics returns the metrics from the connected node. The metrics are returned as a map of metric family name to the metric family.
type Collector ¶
type Collector = prometheus.Collector
Collector is an alias for prometheus.Collector
type CollectorAdapter ¶
type CollectorAdapter struct {
prometheus.Collector
}
CollectorAdapter wraps a standard prometheus.Collector to implement CollectorWithContext.
func (*CollectorAdapter) CollectWithContext ¶
func (a *CollectorAdapter) CollectWithContext(ctx context.Context, ch chan<- prometheus.Metric)
CollectWithContext implements CollectorWithContext by ignoring the context.
type CollectorFunc ¶
type CollectorFunc struct {
// contains filtered or unexported fields
}
CollectorFunc is an adapter to allow the use of ordinary functions as context-aware collectors.
func NewCollectorFunc ¶
func NewCollectorFunc( descFunc func(chan<- *prometheus.Desc), collectFunc func(context.Context, chan<- prometheus.Metric), ) *CollectorFunc
NewCollectorFunc creates a new CollectorFunc.
func (*CollectorFunc) Collect ¶
func (f *CollectorFunc) Collect(ch chan<- prometheus.Metric)
Collect implements prometheus.Collector.
func (*CollectorFunc) CollectWithContext ¶
func (f *CollectorFunc) CollectWithContext(ctx context.Context, ch chan<- prometheus.Metric)
CollectWithContext implements CollectorWithContext.
func (*CollectorFunc) Describe ¶
func (f *CollectorFunc) Describe(ch chan<- *prometheus.Desc)
Describe implements prometheus.Collector.
type CollectorWithContext ¶
type CollectorWithContext interface {
prometheus.Collector // Embeds the base interface for compatibility
// CollectWithContext works like Collect but accepts a context for
// timeout/cancellation and request-scoped values.
CollectWithContext(ctx context.Context, ch chan<- prometheus.Metric)
}
CollectorWithContext is a Collector that can consume a Context for timeout/cancellation and request-scoped values.
func NewCollectorAdapter ¶
func NewCollectorAdapter(c prometheus.Collector) CollectorWithContext
NewCollectorAdapter creates a new adapter for a standard collector.
type ContextCollectorWrapper ¶
type ContextCollectorWrapper struct {
// contains filtered or unexported fields
}
ContextCollectorWrapper wraps a CollectorWithContext to implement prometheus.Collector.
func (*ContextCollectorWrapper) Collect ¶
func (w *ContextCollectorWrapper) Collect(ch chan<- prometheus.Metric)
Collect implements prometheus.Collector.
func (*ContextCollectorWrapper) Describe ¶
func (w *ContextCollectorWrapper) Describe(ch chan<- *prometheus.Desc)
Describe implements prometheus.Collector.
type ContextRegistry ¶
type ContextRegistry struct {
// contains filtered or unexported fields
}
ContextRegistry is a registry that supports both standard and context-aware collectors. It implements both prometheus.Gatherer and GathererWithContext interfaces.
func NewContextRegistry ¶
func NewContextRegistry() *ContextRegistry
NewContextRegistry creates a new registry that supports both standard and context-aware collectors.
func NewPedanticContextRegistry ¶
func NewPedanticContextRegistry() *ContextRegistry
NewPedanticContextRegistry creates a new registry with extra validation enabled.
func (*ContextRegistry) Gather ¶
func (r *ContextRegistry) Gather() ([]*dto.MetricFamily, error)
Gather implements prometheus.Gatherer for backward compatibility.
func (*ContextRegistry) GatherWithContext ¶
func (r *ContextRegistry) GatherWithContext(ctx context.Context) ([]*dto.MetricFamily, error)
GatherWithContext implements GathererWithContext interface.
func (*ContextRegistry) MustRegister ¶
func (r *ContextRegistry) MustRegister(cs ...prometheus.Collector)
MustRegister registers collectors and panics on error.
func (*ContextRegistry) Register ¶
func (r *ContextRegistry) Register(c prometheus.Collector) error
Register registers a collector (either standard or context-aware).
func (*ContextRegistry) Unregister ¶
func (r *ContextRegistry) Unregister(c prometheus.Collector) bool
Unregister removes a collector from the registry.
type Counter ¶
type Counter interface {
prometheus.Collector
// Inc increments the counter by 1
Inc()
// Add increments the counter by the given value
Add(float64)
// Get returns the current value
Get() float64
}
Counter is a metric that can only increase
func NewCounter ¶
func NewCounter(opts CounterOpts) Counter
Constructor functions that return wrapped types
func NewCounterWithOpts ¶
func NewCounterWithOpts(opts prometheus.CounterOpts) Counter
NewCounterWithOpts creates a wrapped counter from options
func NewNoopCounter ¶
NewNoopCounter creates a new standalone noop counter metric
func WrapPrometheusCounter ¶
func WrapPrometheusCounter(c prometheus.Counter) Counter
WrapPrometheusCounter wraps a prometheus.Counter to implement our Counter interface
type CounterVec ¶
type CounterVec interface {
prometheus.Collector
// With returns a counter with the given label values
With(Labels) Counter
// WithLabelValues returns a counter with the given label values
WithLabelValues(labelValues ...string) Counter
}
CounterVec is a vector of counters
func NewCounterVec ¶
func NewCounterVec(opts CounterOpts, labelNames []string) CounterVec
func NewCounterVecWithOpts ¶
func NewCounterVecWithOpts(opts prometheus.CounterOpts, labelNames []string) CounterVec
NewCounterVecWithOpts creates a wrapped counter vec from options
func WrapPrometheusCounterVec ¶
func WrapPrometheusCounterVec(cv *prometheus.CounterVec) CounterVec
WrapPrometheusCounterVec wraps a prometheus.CounterVec to implement our CounterVec interface
type DTOMetricFamily ¶ added in v1.4.7
type DTOMetricFamily = dto.MetricFamily
DTOMetricFamily is an alias for dto.MetricFamily for backward compatibility
type Errs ¶
type Errs struct{ Err error }
Errs is a simple error accumulator used for collecting multiple errors
type Factory ¶
type Factory interface {
// New creates a new metrics instance with the given namespace
New(namespace string) Metrics
// NewWithRegistry creates a new metrics instance with a custom registry
NewWithRegistry(namespace string, registry Registry) Metrics
}
Factory creates new metrics instances
func NewNoOpFactory ¶
func NewNoOpFactory() Factory
NewNoOpFactory creates a factory that produces noop metrics
func NewPrometheusFactory ¶
func NewPrometheusFactory() Factory
NewPrometheusFactory creates a factory that produces prometheus-backed metrics
func NewPrometheusFactoryWithRegistry ¶
func NewPrometheusFactoryWithRegistry(registry *prometheus.Registry) Factory
NewPrometheusFactoryWithRegistry creates a factory with a custom prometheus registry
type GathererFunc ¶
type GathererFunc func() ([]*dto.MetricFamily, error)
GathererFunc is an adapter to allow the use of ordinary functions as Gatherers.
func (GathererFunc) Gather ¶
func (f GathererFunc) Gather() ([]*dto.MetricFamily, error)
Gather implements prometheus.Gatherer.
type GathererWithContext ¶
type GathererWithContext interface {
prometheus.Gatherer // Embeds the base interface for compatibility
// GatherWithContext works like Gather but accepts a context for
// timeout/cancellation and request-scoped values.
GatherWithContext(ctx context.Context) ([]*dto.MetricFamily, error)
}
GathererWithContext is a Gatherer that accepts a context.Context for timeout/cancellation propagation and request-scoped values.
type GathererWithContextFunc ¶
type GathererWithContextFunc func(context.Context) ([]*dto.MetricFamily, error)
GathererWithContextFunc is an adapter to allow the use of ordinary functions as context-aware Gatherers.
func (GathererWithContextFunc) Gather ¶
func (f GathererWithContextFunc) Gather() ([]*dto.MetricFamily, error)
Gather implements prometheus.Gatherer for backward compatibility.
func (GathererWithContextFunc) GatherWithContext ¶
func (f GathererWithContextFunc) GatherWithContext(ctx context.Context) ([]*dto.MetricFamily, error)
GatherWithContext implements GathererWithContext.
type Gauge ¶
type Gauge interface {
prometheus.Collector
// Set sets the gauge to the given value
Set(float64)
// Inc increments the gauge by 1
Inc()
// Dec decrements the gauge by 1
Dec()
// Add adds the given value to the gauge
Add(float64)
// Sub subtracts the given value from the gauge
Sub(float64)
// Get returns the current value
Get() float64
}
Gauge is a metric that can increase or decrease
func NewGaugeWithOpts ¶
func NewGaugeWithOpts(opts prometheus.GaugeOpts) Gauge
NewGaugeWithOpts creates a wrapped gauge from options
func NewNoopGauge ¶
NewNoopGauge creates a new standalone noop gauge metric
func WrapPrometheusGauge ¶
func WrapPrometheusGauge(g prometheus.Gauge) Gauge
WrapPrometheusGauge wraps a prometheus.Gauge to implement our Gauge interface
type GaugeVec ¶
type GaugeVec interface {
prometheus.Collector
// With returns a gauge with the given label values
With(Labels) Gauge
// WithLabelValues returns a gauge with the given label values
WithLabelValues(labelValues ...string) Gauge
}
GaugeVec is a vector of gauges
func NewGaugeVec ¶
func NewGaugeVecWithOpts ¶
func NewGaugeVecWithOpts(opts prometheus.GaugeOpts, labelNames []string) GaugeVec
NewGaugeVecWithOpts creates a wrapped gauge vec from options
func WrapPrometheusGaugeVec ¶
func WrapPrometheusGaugeVec(gv *prometheus.GaugeVec) GaugeVec
WrapPrometheusGaugeVec wraps a prometheus.GaugeVec to implement our GaugeVec interface
type HTTPHandlerOpts ¶
type HTTPHandlerOpts = promhttp.HandlerOpts
HTTPHandlerOpts are options for the HTTP handler
type HandlerOpts ¶
type HandlerOpts struct {
// ErrorLog specifies an optional logger for errors.
ErrorLog func(error)
// ErrorHandling defines how errors are handled.
ErrorHandling promhttp.HandlerErrorHandling
// Registry is the gatherer to use for metrics.
Registry prometheus.Gatherer
// Timeout is the maximum duration for gathering metrics.
// If zero, no timeout is applied beyond what's in the request context.
Timeout time.Duration
// EnableOpenMetrics enables OpenMetrics format support.
EnableOpenMetrics bool
// MaxRequestsInFlight limits the number of concurrent metric requests.
// If zero, no limit is applied.
MaxRequestsInFlight int
// ContextFunc allows customizing how the context is derived from the request.
ContextFunc func(*http.Request) context.Context
}
HandlerOpts are options for the context-aware HTTP handler.
type Histogram ¶
type Histogram interface {
prometheus.Collector
// Observe adds a single observation to the histogram
Observe(float64)
}
Histogram samples observations and counts them in configurable buckets
func NewNoopHistogram ¶
NewNoopHistogram creates a new standalone noop histogram metric
type HistogramVec ¶
type HistogramVec interface {
prometheus.Collector
// With returns a histogram with the given label values
With(Labels) Histogram
// WithLabelValues returns a histogram with the given label values
WithLabelValues(labelValues ...string) Histogram
}
HistogramVec is a vector of histograms
func NewHistogramVec ¶
func NewHistogramVec(opts HistogramOpts, labelNames []string) HistogramVec
func WrapPrometheusHistogramVec ¶ added in v1.4.7
func WrapPrometheusHistogramVec(hv *prometheus.HistogramVec) HistogramVec
WrapPrometheusHistogramVec wraps a prometheus.HistogramVec to implement our HistogramVec interface
type MetricFamilies ¶
type MetricFamilies = []*dto.MetricFamily
MetricFamilies is a slice of metric families
type Metrics ¶
type Metrics interface {
// NewCounter creates a new counter
NewCounter(name, help string) Counter
// NewCounterVec creates a new counter vector
NewCounterVec(name, help string, labelNames []string) CounterVec
// NewGauge creates a new gauge
NewGauge(name, help string) Gauge
// NewGaugeVec creates a new gauge vector
NewGaugeVec(name, help string, labelNames []string) GaugeVec
// NewHistogram creates a new histogram
NewHistogram(name, help string, buckets []float64) Histogram
// NewHistogramVec creates a new histogram vector
NewHistogramVec(name, help string, labelNames []string, buckets []float64) HistogramVec
// NewSummary creates a new summary
NewSummary(name, help string, objectives map[float64]float64) Summary
// NewSummaryVec creates a new summary vector
NewSummaryVec(name, help string, labelNames []string, objectives map[float64]float64) SummaryVec
// Registry returns the underlying registry
Registry() Registry
// PrometheusRegistry returns the prometheus registerer for compatibility
PrometheusRegistry() interface{}
}
Metrics is the main interface for creating metrics
func NewNoOpMetrics ¶
NewNoOpMetrics creates a no-op metrics instance for testing
func NewPrometheusMetrics ¶
func NewPrometheusMetrics(namespace string, registry *prometheus.Registry) Metrics
NewPrometheusMetrics creates a new prometheus-backed metrics instance
func NewWithRegistry ¶
NewWithRegistry creates a new metrics instance with a custom registry
type MetricsHTTPHandler ¶
type MetricsHTTPHandler interface {
// ServeHTTP handles an HTTP request
ServeHTTP(w ResponseWriter, r *Request)
}
MetricsHTTPHandler handles HTTP requests for metrics
type MultiGatherer ¶
type MultiGatherer interface {
prometheus.Gatherer
// Register adds the outputs of [gatherer] to the results of future calls to
// Gather with the provided [namespace] added to the metrics.
Register(namespace string, gatherer prometheus.Gatherer) error
// Deregister removes the outputs of a gatherer with [namespace] from the results
// of future calls to Gather. Returns true if a gatherer with [namespace] was
// found.
Deregister(namespace string) bool
}
MultiGatherer extends the Gatherer interface by allowing additional gatherers to be registered and deregistered.
func NewLabelGatherer ¶
func NewLabelGatherer(labelName string) MultiGatherer
NewLabelGatherer returns a new MultiGatherer that adds a label to all metrics
func NewMultiGatherer ¶
func NewMultiGatherer() MultiGatherer
NewMultiGatherer returns a new MultiGatherer that merges metrics by namespace
func NewPrefixGatherer ¶
func NewPrefixGatherer() MultiGatherer
NewPrefixGatherer returns a new MultiGatherer that adds a prefix to all metrics
type MultiGathererWithContext ¶
type MultiGathererWithContext interface {
GathererWithContext
// Register adds the outputs of gatherer to the results of future calls to
// Gather with the provided namespace added to the metrics.
Register(namespace string, gatherer prometheus.Gatherer) error
// Deregister removes the outputs of a gatherer with namespace from the results
// of future calls to Gather.
Deregister(namespace string) bool
}
MultiGathererWithContext extends MultiGatherer with context support.
func NewMultiGathererWithContext ¶
func NewMultiGathererWithContext() MultiGathererWithContext
NewMultiGathererWithContext creates a new MultiGathererWithContext.
type ProcessCollectorOpts ¶
type ProcessCollectorOpts = collectors.ProcessCollectorOpts
ProcessCollectorOpts are options for the process collector
type PrometheusCollector ¶
type PrometheusCollector = prometheus.Collector
PrometheusCollector is an alias for prometheus.Collector Use this when you need to pass collectors to prometheus-specific code
type PrometheusDesc ¶
type PrometheusDesc = prometheus.Desc
PrometheusDesc is an alias for prometheus.Desc
type PrometheusGatherer ¶
type PrometheusGatherer = prometheus.Gatherer
PrometheusGatherer is an alias for prometheus.Gatherer Use this when you need prometheus gatherer functionality
type PrometheusLabels ¶
type PrometheusLabels = prometheus.Labels
PrometheusLabels is an alias for prometheus.Labels
type PrometheusMetric ¶
type PrometheusMetric = prometheus.Metric
PrometheusMetric is an alias for prometheus.Metric
type PrometheusMetricFamily ¶
type PrometheusMetricFamily = dto.MetricFamily
PrometheusMetricFamily is an alias for dto.MetricFamily
type PrometheusRegisterer ¶
type PrometheusRegisterer = prometheus.Registerer
PrometheusRegisterer is an alias for prometheus.Registerer Use this when you need prometheus registerer functionality
type PrometheusValueType ¶
type PrometheusValueType = prometheus.ValueType
PrometheusValueType is an alias for prometheus.ValueType
const ( CounterValue PrometheusValueType = prometheus.CounterValue GaugeValue PrometheusValueType = prometheus.GaugeValue UntypedValue PrometheusValueType = prometheus.UntypedValue )
Prometheus value types
type Registerer ¶
type Registerer = prometheus.Registerer
Registerer is an alias for prometheus.Registerer
type Registry ¶
type Registry = *prometheus.Registry
Registry is an alias for prometheus.Registry to keep it internal We use prometheus.Registry directly but alias it to avoid external dependencies
func MakeAndRegister ¶
func MakeAndRegister(gatherer MultiGatherer, namespace string) (Registry, error)
MakeAndRegister creates a new registry and registers it with the gatherer Returns our Registry alias which is just *prometheus.Registry
func NewNoOpRegistry ¶
func NewNoOpRegistry() Registry
NewNoOpRegistry creates a no-op registry for testing
func WrapPrometheusRegistry ¶
func WrapPrometheusRegistry(promReg *prometheus.Registry) Registry
WrapPrometheusRegistry wraps a prometheus registry in our Registry interface
type Request ¶
type Request interface {
// Context returns the request context
Context() context.Context
// Method returns the HTTP method
Method() string
// URL returns the request URL
URL() string
}
Request represents an HTTP request
type ResponseWriter ¶
type ResponseWriter interface {
// Write writes data to the response
Write([]byte) (int, error)
// WriteHeader writes the status code
WriteHeader(int)
// Header returns the response headers
Header() map[string][]string
}
ResponseWriter is an interface for writing HTTP responses
type Summary ¶
type Summary interface {
prometheus.Collector
// Observe adds a single observation to the summary
Observe(float64)
}
Summary captures individual observations and provides quantiles
func NewNoopSummary ¶
NewNoopSummary creates a new standalone noop summary metric
type SummaryVec ¶
type SummaryVec interface {
// With returns a summary with the given label values
With(Labels) Summary
// WithLabelValues returns a summary with the given label values
WithLabelValues(labelValues ...string) Summary
}
SummaryVec is a vector of summaries
type TextParser ¶ added in v1.4.7
type TextParser = expfmt.TextParser
TextParser is an alias for expfmt.TextParser