summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/prometheus/client_golang/examples
diff options
context:
space:
mode:
authorChristopher Speller <crspeller@gmail.com>2017-06-21 19:06:17 -0700
committerCorey Hulen <corey@hulen.com>2017-06-21 19:06:17 -0700
commit42f28ab8e374137fe3f5d25424489d879d4724f8 (patch)
tree20353f2446b506d32e6d353b72a57bf48f070389 /vendor/github.com/prometheus/client_golang/examples
parent6b39c308d882a0aeac533f8ab1d90b48a2ae4b5a (diff)
downloadchat-42f28ab8e374137fe3f5d25424489d879d4724f8.tar.gz
chat-42f28ab8e374137fe3f5d25424489d879d4724f8.tar.bz2
chat-42f28ab8e374137fe3f5d25424489d879d4724f8.zip
Updating server dependancies (#6712)
Diffstat (limited to 'vendor/github.com/prometheus/client_golang/examples')
-rw-r--r--vendor/github.com/prometheus/client_golang/examples/random/main.go21
-rw-r--r--vendor/github.com/prometheus/client_golang/examples/simple/main.go7
2 files changed, 12 insertions, 16 deletions
diff --git a/vendor/github.com/prometheus/client_golang/examples/random/main.go b/vendor/github.com/prometheus/client_golang/examples/random/main.go
index eef50d200..563957193 100644
--- a/vendor/github.com/prometheus/client_golang/examples/random/main.go
+++ b/vendor/github.com/prometheus/client_golang/examples/random/main.go
@@ -18,21 +18,19 @@ package main
import (
"flag"
- "log"
"math"
"math/rand"
"net/http"
"time"
"github.com/prometheus/client_golang/prometheus"
- "github.com/prometheus/client_golang/prometheus/promhttp"
)
var (
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.")
- normDomain = flag.Float64("normal.domain", 0.0002, "The domain for the normal distribution.")
- normMean = flag.Float64("normal.mean", 0.00001, "The mean for the normal distribution.")
+ uniformDomain = flag.Float64("uniform.domain", 200, "The domain for the uniform distribution.")
+ normDomain = flag.Float64("normal.domain", 200, "The domain for the normal distribution.")
+ normMean = flag.Float64("normal.mean", 10, "The mean for the normal distribution.")
oscillationPeriod = flag.Duration("oscillation-period", 10*time.Minute, "The duration of the rate oscillation period.")
)
@@ -42,9 +40,8 @@ var (
// differentiated via a "service" label.
rpcDurations = prometheus.NewSummaryVec(
prometheus.SummaryOpts{
- Name: "rpc_durations_seconds",
- Help: "RPC latency distributions.",
- Objectives: map[float64]float64{0.5: 0.05, 0.9: 0.01, 0.99: 0.001},
+ Name: "rpc_durations_microseconds",
+ Help: "RPC latency distributions.",
},
[]string{"service"},
)
@@ -53,7 +50,7 @@ var (
// normal distribution, with 20 buckets centered on the mean, each
// half-sigma wide.
rpcDurationsHistogram = prometheus.NewHistogram(prometheus.HistogramOpts{
- Name: "rpc_durations_histogram_seconds",
+ Name: "rpc_durations_histogram_microseconds",
Help: "RPC latency distributions.",
Buckets: prometheus.LinearBuckets(*normMean-5**normDomain, .5**normDomain, 20),
})
@@ -94,13 +91,13 @@ func main() {
go func() {
for {
- v := rand.ExpFloat64() / 1e6
+ v := rand.ExpFloat64()
rpcDurations.WithLabelValues("exponential").Observe(v)
time.Sleep(time.Duration(50*oscillationFactor()) * time.Millisecond)
}
}()
// Expose the registered metrics via HTTP.
- http.Handle("/metrics", promhttp.Handler())
- log.Fatal(http.ListenAndServe(*addr, nil))
+ http.Handle("/metrics", prometheus.Handler())
+ http.ListenAndServe(*addr, nil)
}
diff --git a/vendor/github.com/prometheus/client_golang/examples/simple/main.go b/vendor/github.com/prometheus/client_golang/examples/simple/main.go
index 1fc23249a..19620d2b3 100644
--- a/vendor/github.com/prometheus/client_golang/examples/simple/main.go
+++ b/vendor/github.com/prometheus/client_golang/examples/simple/main.go
@@ -16,16 +16,15 @@ package main
import (
"flag"
- "log"
"net/http"
- "github.com/prometheus/client_golang/prometheus/promhttp"
+ "github.com/prometheus/client_golang/prometheus"
)
var addr = flag.String("listen-address", ":8080", "The address to listen on for HTTP requests.")
func main() {
flag.Parse()
- http.Handle("/metrics", promhttp.Handler())
- log.Fatal(http.ListenAndServe(*addr, nil))
+ http.Handle("/metrics", prometheus.Handler())
+ http.ListenAndServe(*addr, nil)
}