@@ -29,47 +29,45 @@ import (
29
29
"github.com/prometheus/client_golang/prometheus/promhttp"
30
30
)
31
31
32
- var (
33
- addr = flag .String ("listen-address" , ":8080" , "The address to listen on for HTTP requests." )
34
- uniformDomain = flag .Float64 ("uniform.domain" , 0.0002 , "The domain for the uniform distribution." )
35
- normDomain = flag .Float64 ("normal.domain" , 0.0002 , "The domain for the normal distribution." )
36
- normMean = flag .Float64 ("normal.mean" , 0.00001 , "The mean for the normal distribution." )
37
- oscillationPeriod = flag .Duration ("oscillation-period" , 10 * time .Minute , "The duration of the rate oscillation period." )
38
- )
32
+ func main () {
33
+ var (
34
+ addr = flag .String ("listen-address" , ":8080" , "The address to listen on for HTTP requests." )
35
+ uniformDomain = flag .Float64 ("uniform.domain" , 0.0002 , "The domain for the uniform distribution." )
36
+ normDomain = flag .Float64 ("normal.domain" , 0.0002 , "The domain for the normal distribution." )
37
+ normMean = flag .Float64 ("normal.mean" , 0.00001 , "The mean for the normal distribution." )
38
+ oscillationPeriod = flag .Duration ("oscillation-period" , 10 * time .Minute , "The duration of the rate oscillation period." )
39
+ )
39
40
40
- var (
41
- // Create a summary to track fictional interservice RPC latencies for three
42
- // distinct services with different latency distributions. These services are
43
- // differentiated via a "service" label.
44
- rpcDurations = prometheus .NewSummaryVec (
45
- prometheus.SummaryOpts {
46
- Name : "rpc_durations_seconds" ,
47
- Help : "RPC latency distributions." ,
48
- Objectives : map [float64 ]float64 {0.5 : 0.05 , 0.9 : 0.01 , 0.99 : 0.001 },
49
- },
50
- []string {"service" },
41
+ flag .Parse ()
42
+
43
+ var (
44
+ // Create a summary to track fictional interservice RPC latencies for three
45
+ // distinct services with different latency distributions. These services are
46
+ // differentiated via a "service" label.
47
+ rpcDurations = prometheus .NewSummaryVec (
48
+ prometheus.SummaryOpts {
49
+ Name : "rpc_durations_seconds" ,
50
+ Help : "RPC latency distributions." ,
51
+ Objectives : map [float64 ]float64 {0.5 : 0.05 , 0.9 : 0.01 , 0.99 : 0.001 },
52
+ },
53
+ []string {"service" },
54
+ )
55
+ // The same as above, but now as a histogram, and only for the normal
56
+ // distribution. The buckets are targeted to the parameters of the
57
+ // normal distribution, with 20 buckets centered on the mean, each
58
+ // half-sigma wide.
59
+ rpcDurationsHistogram = prometheus .NewHistogram (prometheus.HistogramOpts {
60
+ Name : "rpc_durations_histogram_seconds" ,
61
+ Help : "RPC latency distributions." ,
62
+ Buckets : prometheus .LinearBuckets (* normMean - 5 * * normDomain , .5 * * normDomain , 20 ),
63
+ })
51
64
)
52
- // The same as above, but now as a histogram, and only for the normal
53
- // distribution. The buckets are targeted to the parameters of the
54
- // normal distribution, with 20 buckets centered on the mean, each
55
- // half-sigma wide.
56
- rpcDurationsHistogram = prometheus .NewHistogram (prometheus.HistogramOpts {
57
- Name : "rpc_durations_histogram_seconds" ,
58
- Help : "RPC latency distributions." ,
59
- Buckets : prometheus .LinearBuckets (* normMean - 5 * * normDomain , .5 * * normDomain , 20 ),
60
- })
61
- )
62
65
63
- func init () {
64
66
// Register the summary and the histogram with Prometheus's default registry.
65
67
prometheus .MustRegister (rpcDurations )
66
68
prometheus .MustRegister (rpcDurationsHistogram )
67
69
// Add Go module build info.
68
70
prometheus .MustRegister (prometheus .NewBuildInfoCollector ())
69
- }
70
-
71
- func main () {
72
- flag .Parse ()
73
71
74
72
start := time .Now ()
75
73
0 commit comments