Documentation
¶
Overview ¶
Package prometheusbp provides common code used for exporting Prometheus metrics.
Index ¶
Constants ¶
View Source
const ( // DefaultNativeHistogramBucketFactor is the default bucket factor for native histograms. // This controls the resolution of the histogram buckets. DefaultNativeHistogramBucketFactor = 1.1 // DefaultNativeHistogramMaxBucketNumber is the default maximum number of buckets // for native histograms. DefaultNativeHistogramMaxBucketNumber = 160 // DefaultNativeHistogramMinResetDuration is the default minimum duration between // resets for native histograms. DefaultNativeHistogramMinResetDuration = 1 * time.Hour )
Variables ¶
View Source
var ( // DefaultLatencyBuckets is the default bucket values for a prometheus latency histogram metric. // // These match the spec defined at https://github.snooguts.net/reddit/baseplate.spec/blob/master/component-apis/prom-metrics.md#latency-histograms DefaultLatencyBuckets = []float64{ 0.000_100, 0.000_500, 0.001_000, 0.002_500, 0.005_000, 0.010_000, 0.025_000, 0.050_000, 0.100_000, 0.250_000, 0.500_000, 1.000_000, 5.000_000, 15.000_000, 30.000_000, } // Deprecated: Please use DefaultLatencyBuckets instead for latencies if the buckets suit your needs, otherwise define your own buckets. DefaultBuckets = DefaultLatencyBuckets DefaultNativeHistogramBucketing = &NativeHistogramBucketing{ BucketFactor: DefaultNativeHistogramBucketFactor, MaxBucketNumber: DefaultNativeHistogramMaxBucketNumber, MinResetDuration: DefaultNativeHistogramMinResetDuration, } )
Functions ¶
func BoolString ¶ added in v0.9.5
BoolString returns the string version of a boolean value that should be used in a prometheus metric label.
func RecordModuleVersions ¶ added in v0.9.12
RecordModuleVersions records the modules linked into this binary in the baseplate_go_modules prometheus metric.
Users should not need to call this directly, as it is called by baseplate.New. This should generally not be called more than once, and it is not safe to call concurrently.
Types ¶
type HistogramOpts ¶
type HistogramOpts struct {
Name string
Help string
LegacyBuckets []float64
NativeHistogramBucketing *NativeHistogramBucketing
}
func (HistogramOpts) ToPrometheus ¶
func (opts HistogramOpts) ToPrometheus() prometheus.HistogramOpts
Click to show internal directories.
Click to hide internal directories.