Skip to content

Commit 1e22069

Browse files
authored
Merge pull request weaveworks#3599 from weaveworks/per-tenant-metrics
Add metrics for report size and count per tenant
2 parents 474ada4 + 870b52e commit 1e22069

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

app/multitenant/aws_collector.go

+14
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,16 @@ var (
6868
Help: "Distribution of memcache report sizes",
6969
Buckets: prometheus.ExponentialBuckets(4096, 2.0, 10),
7070
})
71+
reportsPerUser = prometheus.NewCounterVec(prometheus.CounterOpts{
72+
Namespace: "scope",
73+
Name: "reports_stored_total",
74+
Help: "Total count of stored reports per user.",
75+
}, []string{"user"})
76+
reportSizePerUser = prometheus.NewCounterVec(prometheus.CounterOpts{
77+
Namespace: "scope",
78+
Name: "reports_bytes_total",
79+
Help: "Total bytes stored in reports per user.",
80+
}, []string{"user"})
7181

7282
natsRequests = prometheus.NewCounterVec(prometheus.CounterOpts{
7383
Namespace: "scope",
@@ -83,6 +93,8 @@ func init() {
8393
prometheus.MustRegister(inProcessCacheRequests)
8494
prometheus.MustRegister(inProcessCacheHits)
8595
prometheus.MustRegister(reportSizeHistogram)
96+
prometheus.MustRegister(reportsPerUser)
97+
prometheus.MustRegister(reportSizePerUser)
8698
prometheus.MustRegister(natsRequests)
8799
}
88100

@@ -434,6 +446,8 @@ func (c *awsCollector) Add(ctx context.Context, rep report.Report, buf []byte) e
434446
return err
435447
}
436448
reportSizeHistogram.Observe(float64(reportSize))
449+
reportSizePerUser.WithLabelValues(userid).Add(float64(reportSize))
450+
reportsPerUser.WithLabelValues(userid).Inc()
437451

438452
// third, put it in memcache
439453
if c.cfg.MemcacheClient != nil {

0 commit comments

Comments
 (0)