Move flags and metrics into main()
Fixes #933. Signed-off-by: beorn7 <beorn@grafana.com>
This commit is contained in:
parent
679eb0d315
commit
f78dc19a65
|
@ -29,6 +29,7 @@ import (
|
||||||
"github.com/prometheus/client_golang/prometheus/promhttp"
|
"github.com/prometheus/client_golang/prometheus/promhttp"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
var (
|
var (
|
||||||
addr = flag.String("listen-address", ":8080", "The address to listen on for HTTP requests.")
|
addr = flag.String("listen-address", ":8080", "The address to listen on for HTTP requests.")
|
||||||
uniformDomain = flag.Float64("uniform.domain", 0.0002, "The domain for the uniform distribution.")
|
uniformDomain = flag.Float64("uniform.domain", 0.0002, "The domain for the uniform distribution.")
|
||||||
|
@ -37,6 +38,8 @@ var (
|
||||||
oscillationPeriod = flag.Duration("oscillation-period", 10*time.Minute, "The duration of the rate oscillation period.")
|
oscillationPeriod = flag.Duration("oscillation-period", 10*time.Minute, "The duration of the rate oscillation period.")
|
||||||
)
|
)
|
||||||
|
|
||||||
|
flag.Parse()
|
||||||
|
|
||||||
var (
|
var (
|
||||||
// Create a summary to track fictional interservice RPC latencies for three
|
// Create a summary to track fictional interservice RPC latencies for three
|
||||||
// distinct services with different latency distributions. These services are
|
// distinct services with different latency distributions. These services are
|
||||||
|
@ -60,16 +63,11 @@ var (
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
|
||||||
// Register the summary and the histogram with Prometheus's default registry.
|
// Register the summary and the histogram with Prometheus's default registry.
|
||||||
prometheus.MustRegister(rpcDurations)
|
prometheus.MustRegister(rpcDurations)
|
||||||
prometheus.MustRegister(rpcDurationsHistogram)
|
prometheus.MustRegister(rpcDurationsHistogram)
|
||||||
// Add Go module build info.
|
// Add Go module build info.
|
||||||
prometheus.MustRegister(prometheus.NewBuildInfoCollector())
|
prometheus.MustRegister(prometheus.NewBuildInfoCollector())
|
||||||
}
|
|
||||||
|
|
||||||
func main() {
|
|
||||||
flag.Parse()
|
|
||||||
|
|
||||||
start := time.Now()
|
start := time.Now()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue