metrics

package
v0.0.0-...-840a1b4 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2017 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	B  = 1
	KB = 1024 * B
	MB = 1024 * KB
	GB = 1024 * MB
)
View Source
const Key = "metrics"

Key is the key name of the metrics in the Gin context.

Variables

This section is empty.

Functions

func PrometheusHandler

func PrometheusHandler() gin.HandlerFunc

PrometheusHandler serves the collected service information for Prometheus.

func ToContext

func ToContext(c Setter, metrics *Metrics)

ToContext adds the metric to this context if it supports the Setter interface.

Types

type Metrics

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

Metrics stores instrument data.

func FromContext

func FromContext(c context.Context) *Metrics

FromContext returns the metric associated with this context.

func New

func New() *Metrics

New defines the instrument elements.

func (*Metrics) Handler

func (m *Metrics) Handler() gin.HandlerFunc

Handler handles and parses, calculates the incoming http requests.

type Setter

type Setter interface {
	Set(string, interface{})
}

Setter defines a context that enables setting values.

Jump to

Keyboard shortcuts

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