Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterStrategyFields ¶
RegisterStrategyFields registers the fields of metrics and Strategies that comprise a Strategy with the Prometheus DefaultRegisterer.
Types ¶
type Distribution ¶ added in v0.0.2
type Distribution struct { Histogram *prometheus.HistogramVec Summary *prometheus.SummaryVec }
Distribution encapsulates the two Prometheus metric types used to track the distribution of a set of observed values.
func NewDistribution ¶ added in v0.0.2
func NewDistribution(opts DistributionOpts) (*Distribution, error)
NewDistribution creates a Distribution.
func (Distribution) Register ¶ added in v0.0.2
func (r Distribution) Register() error
Register registers the Distribution strategy with the Prometheus DefaultRegisterer.
type DistributionOpts ¶ added in v0.0.2
type DistributionOpts struct { Namespace string `validate:"required"` Name string `validate:"required"` Help string `validate:"required"` Labels []string `validate:"required"` // Buckets defines the histogram buckets into which observations are counted. // Each element in the slice is the upper inclusive bound of a bucket. Buckets []float64 // Objectives defines the summary quantile rank estimates with their respective // absolute error. Objectives map[float64]float64 }
DistributionOpts is the options to create a Distribution strategy.
type FourGoldenSignals ¶
type FourGoldenSignals struct { // Latency is the time it takes to service a request. It’s important to // distinguish between the latency of successful requests and the latency of failed // requests. Latency *Distribution // Traffic is a measure of how much demand is being placed on your system, // measured in a high-level system-specific metric. For a web service, this // measurement is usually HTTP requests per second, perhaps broken out by the // nature of the requests (e.g., static versus dynamic content). Traffic *prometheus.CounterVec // Errors is the rate of requests that fail, either explicitly (e.g., HTTP 500s), // implicitly (for example, an HTTP 200 success response, but coupled with the wrong content) Errors *prometheus.CounterVec // Saturation is How "full" your service is. A measure of your system fraction, // emphasizing the resources that are most constrained. The degree to which extra // work is queued (or denied) that can't be serviced (e.g., in a memory-constrained system, // show memory; in an I/O-constrained system, show I/O or another example could be // scheduler run queue length). Saturation *prometheus.GaugeVec }
FourGoldenSignals of monitoring are latency, traffic, errors, and saturation. If you can only measure four metrics of your user-facing system, focus on these four. https://sre.google/sre-book/monitoring-distributed-systems/
func NewFourGoldenSignals ¶
func NewFourGoldenSignals(opts FourGoldenSignalsOpts) (*FourGoldenSignals, error)
NewFourGoldenSignals creates a new FourGoldenSignals strategy.
func (FourGoldenSignals) Register ¶
func (f FourGoldenSignals) Register() error
Register registers the FourGoldenSignals strategy with the Prometheus DefaultRegisterer.
type FourGoldenSignalsOpts ¶
type FourGoldenSignalsOpts struct { Namespace string `validate:"required"` LatencyName string `validate:"required"` LatencyHelp string `validate:"required"` LatencyLabels []string `validate:"required"` // Buckets defines the histogram buckets into which observations are counted. Each // element in the slice is the upper inclusive bound of a bucket. LatencyBuckets []float64 // Objectives defines the summary quantile rank estimates with their respective // absolute error. LatencyObjectives map[float64]float64 TrafficName string `validate:"required"` TrafficHelp string `validate:"required"` TrafficLabels []string `validate:"required"` SaturationName string `validate:"required"` SaturationHelp string `validate:"required"` SaturationLabels []string `validate:"required"` }
FourGoldenSignalsOpts is the options for a FourGoldenSignals strategy.
type RED ¶
type RED struct { // The number of requests per second. Requests *prometheus.CounterVec // Errors is the rate of requests that fail, either explicitly (e.g., HTTP 500s), // implicitly (for example, an HTTP 200 success response, but coupled with the wrong content). Errors *prometheus.CounterVec // Distributions of the amount of time each request takes Duration *Distribution }
RED describes a set of metrics that work well for monitoring request-handling services (like an HTTP API server or a database server). https://www.slideshare.net/weaveworks/monitoring-microservices
type REDOpts ¶
type REDOpts struct { RequestType string `validate:"required"` Namespace string `validate:"required"` RequestLabels []string `validate:"required"` DurationLabels []string `validate:"required"` // Buckets defines the histogram buckets into which observations are counted. Each // element in the slice is the upper inclusive bound of a bucket. Buckets []float64 // Objectives defines the summary quantile rank estimates with their respective // absolute error. Objectives map[float64]float64 }
REDOpts is the options to create a RED strategy.
type Strategy ¶
type Strategy interface {
Register() error
}
Strategy describes a collection of metrics built with a struct, allowing any multi-level combination of the 4 Prometheus metric types and other Strategies. e.g. RED - describes a set of metrics that work well for monitoring request-handling services.
type RED struct { Requests *prometheus.CounterVec Errors *prometheus.CounterVec Duration *Distribution }
type USE ¶
type USE struct { // Utilization is the average time that the resource was busy servicing work, // a percent over a time interval. The average time that the resource was // busy (e.g. one disk at 90% I/O utilization). Utilization *prometheus.GaugeVec // Saturation is How "full" your service is. A measure of your system fraction, // emphasizing the resources that are most constrained. The degree to which extra // work is queued (or denied) that can't be serviced (e.g., in a memory-constrained system, // show memory; in an I/O-constrained system, show I/O or another example could be // scheduler run queue length). Saturation *prometheus.GaugeVec // Errors is the rate of requests that fail, either explicitly (e.g., HTTP 500s), // implicitly (for example, an HTTP 200 success response, but coupled with the wrong content). Errors *prometheus.CounterVec }
USE describes a set of metrics that are useful for measuring the performance and usage of things that behave like resources that can be either used or unused (queues, CPUs, memory, disk space, etc.). https://www.brendangregg.com/usemethod.html
type USEOpts ¶
type USEOpts struct { Namespace string `validate:"required"` SaturationName string `validate:"required"` SaturationHelp string `validate:"required"` SaturationLabels []string `validate:"required"` UtilizationName string `validate:"required"` UtilizationHelp string `validate:"required"` UtilizationLabels []string `validate:"required"` }
USEOpts is the options to create a USE strategy.