metrics

package
v0.0.0-...-e5acbb5 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2021 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

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

Manager Manager

func NewMetricsManager

func NewMetricsManager(metrics Metrics) *Manager

NewMetricsManager InterceptorManager constructor

func (*Manager) Metrics

func (im *Manager) Metrics(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error)

Metrics :

type Metrics

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

Metrics details of hits , response time

func CreateMetrics

func CreateMetrics(config *config.Config) Metrics

CreateMetrics : Create Metrics will create the metrics in prometheus server.

type PrometheusMetrics

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

func (*PrometheusMetrics) IncHits

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

IncHits : increment the total hits

func (*PrometheusMetrics) ObserveResponseTime

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

ObserveResponseTime :

Jump to

Keyboard shortcuts

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