From d2298aa8f3ec68bdcc51878c3e4c584dc413e486 Mon Sep 17 00:00:00 2001 From: Jonathan Lange Date: Tue, 12 Jul 2016 16:37:29 +0100 Subject: [PATCH 1/2] Store a histogram of report sizes --- app/multitenant/aws_collector.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/multitenant/aws_collector.go b/app/multitenant/aws_collector.go index d8e8c1721..e851b64c7 100644 --- a/app/multitenant/aws_collector.go +++ b/app/multitenant/aws_collector.go @@ -65,6 +65,12 @@ var ( Name: "report_size_bytes_total", Help: "Total compressed size of reports received in bytes.", }) + reportSizeHistogram = prometheus.NewHistogram(prometheus.HistogramOpts{ + Namespace: "scope", + Name: "report_size_bytes", + Help: "Distribution of memcache report sizes", + Buckets: prometheus.ExponentialBuckets(4096, 2.0, 10), + }) natsRequests = prometheus.NewCounterVec(prometheus.CounterOpts{ Namespace: "scope", @@ -80,6 +86,7 @@ func init() { prometheus.MustRegister(inProcessCacheRequests) prometheus.MustRegister(inProcessCacheHits) prometheus.MustRegister(reportSize) + prometheus.MustRegister(reportSizeHistogram) prometheus.MustRegister(natsRequests) } @@ -347,6 +354,7 @@ func (c *awsCollector) Add(ctx context.Context, rep report.Report) error { var buf bytes.Buffer rep.WriteBinary(&buf) reportSize.Add(float64(buf.Len())) + reportSizeHistogram.Observe(float64(buf.Len())) // second, put the report on s3 now := time.Now() From d83d7318d063d3ac750edf0ffec1fea9f3292158 Mon Sep 17 00:00:00 2001 From: Jonathan Lange Date: Tue, 12 Jul 2016 18:16:35 +0100 Subject: [PATCH 2/2] Remove the old metric --- app/multitenant/aws_collector.go | 7 ------- 1 file changed, 7 deletions(-) diff --git a/app/multitenant/aws_collector.go b/app/multitenant/aws_collector.go index e851b64c7..2365f8c55 100644 --- a/app/multitenant/aws_collector.go +++ b/app/multitenant/aws_collector.go @@ -60,11 +60,6 @@ var ( Help: "Total count of reports found in the in-process cache.", }) - reportSize = prometheus.NewCounter(prometheus.CounterOpts{ - Namespace: "scope", - Name: "report_size_bytes_total", - Help: "Total compressed size of reports received in bytes.", - }) reportSizeHistogram = prometheus.NewHistogram(prometheus.HistogramOpts{ Namespace: "scope", Name: "report_size_bytes", @@ -85,7 +80,6 @@ func init() { prometheus.MustRegister(dynamoValueSize) prometheus.MustRegister(inProcessCacheRequests) prometheus.MustRegister(inProcessCacheHits) - prometheus.MustRegister(reportSize) prometheus.MustRegister(reportSizeHistogram) prometheus.MustRegister(natsRequests) } @@ -353,7 +347,6 @@ func (c *awsCollector) Add(ctx context.Context, rep report.Report) error { // first, encode the report into a buffer and record its size var buf bytes.Buffer rep.WriteBinary(&buf) - reportSize.Add(float64(buf.Len())) reportSizeHistogram.Observe(float64(buf.Len())) // second, put the report on s3