metrics

package
v0.0.0-...-bc40552 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RunMetricServer

func RunMetricServer(cfg MetricsServerConfig) error

Types

type Metrics

type Metrics interface {
	IncHits(status int, method, path string)
	ObserveResponseTime(status int, method, path string, observeTime float64)
	IncBytesUploaded(bytesUploaded int)
	IncRestPanicsTotal()
	IncGrpcPanicsTotal()
}

func CreateMetrics

func CreateMetrics(name string) (Metrics, error)

type MetricsServerConfig

type MetricsServerConfig struct {
	Host string `yaml:"host" env:"METRIC_HOST"`
	Port string `yaml:"port" env:"METRIC_PORT"`
}

type PrometheusMetrics

type PrometheusMetrics struct {
	HitsTotal             prometheus.Counter
	Hits                  *prometheus.CounterVec
	Times                 *prometheus.HistogramVec
	BytesUploaded         prometheus.Counter
	RestPanicRecoverTotal prometheus.Counter
	GrpcPanicRecoverTotal prometheus.Counter
}

func (*PrometheusMetrics) IncBytesUploaded

func (metr *PrometheusMetrics) IncBytesUploaded(bytesUploaded int)

func (*PrometheusMetrics) IncGrpcPanicsTotal

func (metr *PrometheusMetrics) IncGrpcPanicsTotal()

func (*PrometheusMetrics) IncHits

func (metr *PrometheusMetrics) IncHits(status int, method, path string)

func (*PrometheusMetrics) IncRestPanicsTotal

func (metr *PrometheusMetrics) IncRestPanicsTotal()

func (*PrometheusMetrics) ObserveResponseTime

func (metr *PrometheusMetrics) ObserveResponseTime(status int, method, path string, observeTime float64)

Directories

Path Synopsis
Package mock_metrics is a generated GoMock package.
Package mock_metrics is a generated GoMock package.

Jump to

Keyboard shortcuts

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