Documentation ¶
Index ¶
- func HandlerFor(m Metrics, o Options) http.Handler
- func NewDefaultHandler(o Options) http.Handler
- type Metrics
- type Options
- type Prometheus
- func (p *Prometheus) CreateHandler() http.Handler
- func (p *Prometheus) DecEventSubscribers()
- func (p *Prometheus) IncEventSubscribers()
- func (p *Prometheus) IncOpenApiRequestsTotal(code, method, name string)
- func (p *Prometheus) MeasureApiEventDuration(error string, start time.Time)
- func (p *Prometheus) MeasureOpenApiRequestDuration(code, method, name string, start time.Time)
- func (p *Prometheus) RegisterHandler(path string, mux *http.ServeMux)
- func (p *Prometheus) SetCalculatorInstanceDemandResult(service, provider string, value float64)
- func (p *Prometheus) SetCalculatorInstancesTotal(service, provider, status string, value float64)
- func (p *Prometheus) SetReceiverMetricValue(service string, value float64)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HandlerFor ¶
HandlerFor returns a collection of metrics handlers.
func NewDefaultHandler ¶
NewDefaultHandler returns a default metrics handler.
Types ¶
type Metrics ¶
type Metrics interface { MeasureOpenApiRequestDuration(code, method, name string, start time.Time) IncOpenApiRequestsTotal(code, method, name string) MeasureApiEventDuration(error string, start time.Time) IncEventSubscribers() DecEventSubscribers() SetReceiverMetricValue(service string, value float64) SetCalculatorInstancesTotal(service, provider, status string, value float64) SetCalculatorInstanceDemandResult(service, provider string, value float64) RegisterHandler(path string, handler *http.ServeMux) }
Metrics is the generic interface that all the required backends should implement to be an updraft metrics compatible backend.
type Options ¶
type Options struct { // Enable metrics Enabled bool // Common prefix for the keys of the different // collected metrics. Prefix string // EnableProfile exposes profiling information on /pprof of the // metrics listener. EnableProfile bool // enables go runtime metrics EnableRuntimeMetrics bool // A new registry is created if this option is nil. PrometheusRegistry *prometheus.Registry }
Options for initializing metrics collection.
func DefaultOptions ¶
func DefaultOptions() Options
type Prometheus ¶
type Prometheus struct {
// contains filtered or unexported fields
}
Prometheus implements the prometheus metrics backend.
func NewDefaultPrometheus ¶
func NewDefaultPrometheus() *Prometheus
func NewPrometheus ¶
func NewPrometheus(opts Options) *Prometheus
NewPrometheus returns a new Prometheus metric backend.
func (*Prometheus) CreateHandler ¶
func (p *Prometheus) CreateHandler() http.Handler
func (*Prometheus) DecEventSubscribers ¶
func (p *Prometheus) DecEventSubscribers()
func (*Prometheus) IncEventSubscribers ¶
func (p *Prometheus) IncEventSubscribers()
func (*Prometheus) IncOpenApiRequestsTotal ¶
func (p *Prometheus) IncOpenApiRequestsTotal(code, method, name string)
func (*Prometheus) MeasureApiEventDuration ¶
func (p *Prometheus) MeasureApiEventDuration(error string, start time.Time)
func (*Prometheus) MeasureOpenApiRequestDuration ¶
func (p *Prometheus) MeasureOpenApiRequestDuration(code, method, name string, start time.Time)
func (*Prometheus) RegisterHandler ¶
func (p *Prometheus) RegisterHandler(path string, mux *http.ServeMux)
RegisterHandler satisfies Metrics interface.
func (*Prometheus) SetCalculatorInstanceDemandResult ¶
func (p *Prometheus) SetCalculatorInstanceDemandResult(service, provider string, value float64)
func (*Prometheus) SetCalculatorInstancesTotal ¶
func (p *Prometheus) SetCalculatorInstancesTotal(service, provider, status string, value float64)
func (*Prometheus) SetReceiverMetricValue ¶
func (p *Prometheus) SetReceiverMetricValue(service string, value float64)
Click to show internal directories.
Click to hide internal directories.