metrics

package
v0.27.3 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnableMetrics

func EnableMetrics() enginemetrics.Collector

EnableMetrics will enable the metrics for the application

func NoRoute added in v0.21.0

func NoRoute(c *gin.Context)

NoRoute is a middleware to set a flag in the context if the route is actually not found this is needed to distinguish no-route 404 from other 404s

func SetupGin added in v0.21.0

func SetupGin(ginEngine *gin.Engine)

SetupGin will register the metrics with the gin engine NOTE: Remember to add the metrics.NoRoute function to ginEngine.NoRoute

Types

type Metrics

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

Metrics is the metrics collector

func Get

func Get() (m *Metrics, enabled bool)

Get will return the metrics if enabled

func (*Metrics) HTTPHandler

func (m *Metrics) HTTPHandler() http.Handler

HTTPHandler will return the http.Handler for the metrics

type PrometheusCollector

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

PrometheusCollector is a collector for Prometheus metrics. It should implement spvwalletmodels.Collector.

func (*PrometheusCollector) RegisterCounterVec added in v0.21.0

func (c *PrometheusCollector) RegisterCounterVec(name string, labels ...string) *prometheus.CounterVec

RegisterCounterVec creates a new CounterVec and registers it with the collector.

func (*PrometheusCollector) RegisterGauge

func (c *PrometheusCollector) RegisterGauge(name string) prometheus.Gauge

RegisterGauge creates a new Gauge and registers it with the collector.

func (*PrometheusCollector) RegisterGaugeVec

func (c *PrometheusCollector) RegisterGaugeVec(name string, labels ...string) *prometheus.GaugeVec

RegisterGaugeVec creates a new GaugeVec and registers it with the collector.

func (*PrometheusCollector) RegisterHistogramVec

func (c *PrometheusCollector) RegisterHistogramVec(name string, labels ...string) *prometheus.HistogramVec

RegisterHistogramVec creates a new HistogramVec and registers it with the collector.

type RequestMetrics added in v0.21.0

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

RequestMetrics is the metrics for the http requests

func (*RequestMetrics) Track added in v0.21.0

func (m *RequestMetrics) Track(method, path string) *RequestTracker

Track will return a RequestTracker to track the request

type RequestTracker added in v0.21.0

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

RequestTracker is used to track the duration and status of a request

func (*RequestTracker) End added in v0.21.0

func (r *RequestTracker) End(status int)

End will end the tracking of the request

func (*RequestTracker) EndWithNoRoute added in v0.21.0

func (r *RequestTracker) EndWithNoRoute()

EndWithNoRoute will end the tracking of the request with a 404 status

func (*RequestTracker) Start added in v0.21.0

func (r *RequestTracker) Start()

Start will start the tracking of the request

Jump to

Keyboard shortcuts

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