prometheus

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2023 License: MulanPSL-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Counter

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

Counter implements Counter, via a Prometheus CounterVec.

func NewCounter

func NewCounter(cv *prometheus.CounterVec) *Counter

NewCounter wraps the CounterVec and returns a usable Counter object.

func NewCounterFrom

func NewCounterFrom(opts prometheus.CounterOpts, labelNames []string) *Counter

NewCounterFrom constructs and registers a Prometheus CounterVec, and returns a usable Counter object.

func (*Counter) Add

func (c *Counter) Add(delta float64)

Add implements Counter.

func (*Counter) With

func (c *Counter) With(labelValues ...string) ICounter

With implements Counter.

type Endpoint

type Endpoint func(r *ghttp.Request)

type Histogram

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

Histogram implements Histogram via a Prometheus HistogramVec. The difference between a Histogram and a Summary is that Histograms require predefined quantile buckets, and can be statistically aggregated.

func NewHistogram

func NewHistogram(hv *prometheus.HistogramVec) *Histogram

NewHistogram wraps the HistogramVec and returns a usable Histogram object.

func NewHistogramFrom

func NewHistogramFrom(opts prometheus.HistogramOpts, labelNames []string) *Histogram

NewHistogramFrom constructs and registers a Prometheus HistogramVec, and returns a usable Histogram object.

func (*Histogram) Observe

func (h *Histogram) Observe(value float64)

Observe implements Histogram.

func (*Histogram) With

func (h *Histogram) With(labelValues ...string) IHistogram

With implements Histogram.

type ICounter

type ICounter interface {
	With(labelValues ...string) ICounter
	Add(delta float64)
}

Counter describes a metric that accumulates values monotonically. An example of a counter is the number of received HTTP requests.

type IHistogram

type IHistogram interface {
	With(labelValues ...string) IHistogram
	Observe(value float64)
}

Histogram describes a metric that takes repeated observations of the same kind of thing, and produces a statistical summary of those observations, typically expressed as quantiles or buckets. An example of a histogram is HTTP request latencies.

type LabelValues

type LabelValues []string

func (LabelValues) With

func (lvs LabelValues) With(labelValues ...string) LabelValues

type Metrics

type Metrics struct {
	Counter ICounter
	Latency IHistogram
}

func NewMetrics

func NewMetrics(s *ghttp.Server, counter ICounter, latency IHistogram) *Metrics

func (*Metrics) MiddlewareServerTracing

func (ms *Metrics) MiddlewareServerTracing(r *ghttp.Request)

type Summary

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

Summary implements Histogram, via a Prometheus SummaryVec. The difference between a Summary and a Histogram is that Summaries don't require predefined quantile buckets, but cannot be statistically aggregated.

func NewSummary

func NewSummary(sv *prometheus.SummaryVec) *Summary

NewSummary wraps the SummaryVec and returns a usable Summary object.

func NewSummaryFrom

func NewSummaryFrom(opts prometheus.SummaryOpts, labelNames []string) *Summary

NewSummaryFrom constructs and registers a Prometheus SummaryVec, and returns a usable Summary object.

func (*Summary) Observe

func (s *Summary) Observe(value float64)

Observe implements Histogram.

func (*Summary) With

func (s *Summary) With(labelValues ...string) IHistogram

With implements Histogram.

Directories

Path Synopsis
examples

Jump to

Keyboard shortcuts

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