Documentation ¶
Index ¶
Constants ¶
View Source
const ( KB float64 = 1 << (10 * iota) MB )
Variables ¶
View Source
var WithReqDurBuckets = func(buckets []float64) PrometheusOption { return func(p *Prometheus) { if len(buckets) > 0 { p.ReqDurBuckets = buckets } } }
View Source
var WithReqSzBuckets = func(buckets []float64) PrometheusOption { return func(p *Prometheus) { if len(buckets) > 0 { p.ReqSzBuckets = buckets } } }
View Source
var WithResSzBuckets = func(buckets []float64) PrometheusOption { return func(p *Prometheus) { if len(buckets) > 0 { p.ResSzBuckets = buckets } } }
View Source
var WithSubsystem = func(subsystem string) PrometheusOption { return func(p *Prometheus) { if subsystem != "" { p.Subsystem = subsystem } } }
Functions ¶
This section is empty.
Types ¶
type IResponseWriter ¶
type IResponseWriter interface { http.ResponseWriter StatusCode() int Size() int }
type Prometheus ¶
type Prometheus struct {
ReqDurBuckets, ReqSzBuckets, ResSzBuckets []float64
Subsystem string
Ppg PushGateway
// contains filtered or unexported fields
}
Prometheus contains the metrics gathered by the instance and its path
func NewPrometheus ¶
func NewPrometheus(options ...PrometheusOption) *Prometheus
NewPrometheus generates a new set of metrics with a certain subsystem name
func (*Prometheus) HandlerFunc ¶
func (p *Prometheus) HandlerFunc(next func(http.ResponseWriter, *http.Request)) func(http.ResponseWriter, *http.Request)
HandlerFunc defines handler function for middleware
type PrometheusOption ¶
type PrometheusOption func(p *Prometheus)
type PushGateway ¶
type PushGateway struct { // Push interval in seconds //lint:ignore ST1011 renaming would be breaking change PushIntervalSeconds time.Duration // Push Gateway URL in format http://domain:port // where JOBNAME can be any string of your choice PushGatewayURL string // pushgateway job name, defaults to "recommend" Job string }
PushGateway contains the configuration for pushing to a Prometheus pushgateway (optional)
Click to show internal directories.
Click to hide internal directories.