metrics

package
v1.25.2 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2022 License: Apache-2.0 Imports: 4 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	APIRequestMetrics = &OpenstackMetrics{
		Duration: metrics.NewHistogramVec(
			&metrics.HistogramOpts{
				Name: "openstack_api_request_duration_seconds",
				Help: "Latency of an OpenStack API call",
			}, []string{"request"}),
		Total: metrics.NewCounterVec(
			&metrics.CounterOpts{
				Name: "openstack_api_requests_total",
				Help: "Total number of OpenStack API calls",
			}, []string{"request"}),
		Errors: metrics.NewCounterVec(
			&metrics.CounterOpts{
				Name: "openstack_api_request_errors_total",
				Help: "Total number of errors for an OpenStack API call",
			}, []string{"request"}),
	}
)

Functions

func RegisterMetrics

func RegisterMetrics()

Types

type MetricContext

type MetricContext struct {
	Start      time.Time
	Attributes []string
	Metrics    *OpenstackMetrics
}

MetricContext indicates the context for OpenStack metrics.

func NewMetricContext

func NewMetricContext(resource string, request string) *MetricContext

NewMetricContext creates a new MetricContext.

func (*MetricContext) Observe

func (mc *MetricContext) Observe(om *OpenstackMetrics, err error) error

ObserveRequest records the request latency and counts the errors.

func (*MetricContext) ObserveReconcile

func (mc *MetricContext) ObserveReconcile(err error) error

ObserveReconcile records the request reconciliation duration

func (*MetricContext) ObserveRequest

func (mc *MetricContext) ObserveRequest(err error) error

ObserveRequest records the request latency and counts the errors.

type OpenstackMetrics

type OpenstackMetrics struct {
	Duration *metrics.HistogramVec
	Total    *metrics.CounterVec
	Errors   *metrics.CounterVec
}

Jump to

Keyboard shortcuts

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