Documentation ¶
Overview ¶
Package prometheusx provides a canonical way to expose Prometheus metrics.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // GitShortCommit holds the truncated commit id for a git commit. It should be // equal to the first column of the output of `git log --oneline`. This string // is interpreted by init() as a base-16 number and the Prometheus metric // git_short_commit is set to the resulting numerical value. It is recommended // that the string be set as part of the build/link process, as follows: // // go build -ldflags "-X prometheusx.GitShortCommit=$(git log -1 --format=%h)" ./... // // This metric should be useful when determining whether code on various // systems is running the same version, which should, among other things, help // detect failed rollouts, or extended periods in which test deployments occur // but never a production deployment. GitShortCommit = "No commit specified" )
View Source
var ( // ListenAddress is a package flag to specify the prometheus metric // server listen address. ListenAddress = flag.String("prometheusx.listen-address", ":9990", "") )
Functions ¶
func MustServeMetrics ¶
MustServeMetrics starts the prometheus http metrics server with the package flag ListenAddress.
func MustStartPrometheus ¶
MustStartPrometheus starts an http server which exposes local metrics to Prometheus. If the passed-in address is ":0" then a random open port will be chosen and the .Addr element of the returned server will be udpated to reflect the actual port.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.