Skip to content

Commit e76f5d7

Browse files
authored
Merge pull request #83 from weaveworks/tune-historgram-buckets
Tune histogram bucket sizes
2 parents 9914a89 + eb15c42 commit e76f5d7

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

chunk/chunk_cache.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ var (
3939
Namespace: "cortex",
4040
Name: "memcache_request_duration_seconds",
4141
Help: "Total time spent in seconds doing memcache requests.",
42-
Buckets: []float64{.001, .0025, .005, .01, .025, .05},
42+
// Memecache requests are very quick: smallest bucket is 16us, biggest is 1s
43+
Buckets: prometheus.ExponentialBuckets(0.000016, 4, 8),
4344
}, []string{"method", "status_code"})
4445
)
4546

chunk/chunk_store.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,10 @@ var (
5454
Namespace: "cortex",
5555
Name: "dynamo_request_duration_seconds",
5656
Help: "Time spent doing DynamoDB requests.",
57-
Buckets: []float64{.001, .0025, .005, .01, .025, .05, .1, .25, .5, 1},
57+
58+
// DynamoDB latency seems to range from a few ms to a few sec and is
59+
// important. So use 8 buckets from 64us to 8s.
60+
Buckets: prometheus.ExponentialBuckets(0.000128, 4, 8),
5861
}, []string{"operation", "status_code"})
5962
dynamoRequestPages = prometheus.NewHistogram(prometheus.HistogramOpts{
6063
Namespace: "cortex",

cmd/cortex/main.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,12 @@ var (
5353
Namespace: "cortex",
5454
Name: "request_duration_seconds",
5555
Help: "Time (in seconds) spent serving HTTP requests.",
56-
Buckets: prometheus.DefBuckets,
56+
57+
// Cortex latency can be very low (ingesters typically take a few ms to
58+
// process a request), all the way to very high (queries can take tens of
59+
// second). As its important, we use 10 buckets. Smallest is 128us
60+
// biggest is 130s.
61+
Buckets: prometheus.ExponentialBuckets(0.000128, 4, 10),
5762
}, []string{"method", "route", "status_code", "ws"})
5863
)
5964

0 commit comments

Comments
 (0)