metrics

package
v2.0.5 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2026 License: Apache-2.0, Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API struct {
	Success labeled.StopWatch
	Failure labeled.StopWatch
}

func NewAPI

func NewAPI(scope promutils.Scope) API

func (API) Start

func (a API) Start(ctx context.Context) APITimer

type APITimer

type APITimer struct {
	Success labeled.Timer
	Failure labeled.Timer
}

func (APITimer) Stop

func (a APITimer) Stop(err *error)

type CRUD

type CRUD struct {
	Create   API
	Read     API
	Update   API
	Delete   API
	Undelete API
	List     API
	Count    API
}

func NewCRUD

func NewCRUD(scope promutils.Scope) CRUD

type Operation

type Operation struct {
	Success *prometheus.HistogramVec
	Failure *prometheus.HistogramVec
}

func NewOperationHistogram

func NewOperationHistogram(scope promutils.Scope, labels ...string) Operation

NewOperationHistogram creates 2 histogram metrics for tracking success & failure durations.

The resulting operations requires len(labels) + 1 labels, where the last label is the respective "operation".

Histograms have higher performance impact on Prometheus server when calculating quantiles: https://prometheus.io/docs/practices/histograms/#quantiles

func (Operation) Start

func (o Operation) Start(values ...string) OperationTimer

type OperationTimer

type OperationTimer struct {
	Start   time.Time
	Success prometheus.Observer
	Failure prometheus.Observer
}

func (OperationTimer) Stop

func (o OperationTimer) Stop(err *error)

type SuccessAndFailureCounter

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

func NewSuccessAndFailureCounter

func NewSuccessAndFailureCounter(scope promutils.Scope) SuccessAndFailureCounter

func (SuccessAndFailureCounter) Inc

func (c SuccessAndFailureCounter) Inc(err *error)

type SuccessAndFailureCounterVec

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

func NewSuccessAndFailureCounterVec

func NewSuccessAndFailureCounterVec(scope promutils.Scope, labels ...string) SuccessAndFailureCounterVec

func (SuccessAndFailureCounterVec) Inc

func (c SuccessAndFailureCounterVec) Inc(err *error, labels prometheus.Labels)

Jump to

Keyboard shortcuts

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