phsserver

package
v0.0.0-...-c22fb0d Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClientMetricsRegister

func ClientMetricsRegister(m *ClientMetrics)

func ServerMetricsRegister

func ServerMetricsRegister(m *ServerMetrics)

SerrverMetricsRegister registers all the metrics with Prometheus. It takes care not to register the buckets, if they have not been configured. The counters are registered anyways.

func WrapHandler

func WrapHandler(h http.Handler, name string, m *ServerMetrics) http.Handler

Wrap encapsulates a http.Handler which collects prometheus metrics.

Types

type BucketConfig

type BucketConfig []float64

BucketConfig stores the values for buckets. The values must be strict monotonic growing. Use NewBuckconfig to create a configuration from a semicolon separated string.

func NewBucketConfig

func NewBucketConfig(config string) (*BucketConfig, error)

NewBuckConfig returns a new bucketconfiguration from a string representation of the buckets. The string consits of a semicolon separated list of time values, which represent the upper bound of the bucket. Leading and trailing semicolons are forbiddem, as well as double semicolons, which would result in an invalid border. The value of the entroes, when parsed as floats, must e strict monotonic growing.

func NewLargeSizes

func NewLargeSizes() BucketConfig

func NewSlowBuckets

func NewSlowBuckets() BucketConfig

type ClientMetrics

type ClientMetrics struct {
	ReqCounter *prometheus.CounterVec

	ReqDurationHisto    *prometheus.HistogramVec
	ReqDurationHistConf BucketConfig

	ReqDurationPercentiles    *prometheus.SummaryVec
	ReqDurationPercentileConf PercentileConfig
}

func NewDefaultClientMetrics

func NewDefaultClientMetrics() *ClientMetrics

type PercentileConfig

type PercentileConfig map[float64]float64

PercentileConfig stores percentiles to be reported.

func NewPercentileConfig

func NewPercentileConfig(config string) (*PercentileConfig, error)

NewBuckConfig returns a new bucketconfiguration from a string representation of the buckets. The string consits of a semicolon separated list of time values, which represent the upper bound of the bucket. Leading and trailing semicolons are forbiddem, as well as double semicolons, which would result in an invalid border. The value of the entroes, when parsed as floats, must e strict monotonic growing.

type ServerMetrics

type ServerMetrics struct {
	ReqInflight prometheus.Gauge
	ReqCounter  *prometheus.CounterVec

	ReqDurationHisto    *prometheus.HistogramVec
	ReqDurationHistConf BucketConfig

	ReqDurationPercentiles    *prometheus.SummaryVec
	ReqDurationPercentileConf PercentileConfig

	ReqSize        *prometheus.HistogramVec
	ReqSizeBuckets BucketConfig

	RespSize        *prometheus.HistogramVec
	RespSizeBuckets BucketConfig
}

Metics holds the prometheus metrics for server side metrics.

func NewDefaultServerMetrics

func NewDefaultServerMetrics() *ServerMetrics

Jump to

Keyboard shortcuts

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