Skip to content

Commit 1b59396

Browse files
authored
Add missing asynclog stats (#38)
Signed-off-by: John Pena <[email protected]>
1 parent f159f89 commit 1b59396

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ The exporter collects a number of statistics from mcrouter:
3232
```
3333
# HELP mcrouter_asynclog_requests Number of failed deletes written to spool file.
3434
# TYPE mcrouter_asynclog_requests counter
35+
# HELP mcrouter_asynclog_requests_rate Number of requests that were attempted to be spooled to disk.
36+
# TYPE mcrouter_asynclog_requests_rate gauge
37+
# HELP mcrouter_asynclog_spool_success_rate Number of requests that were spooled successfully.
38+
# TYPE mcrouter_asynclog_spool_success_rate gauge
3539
# HELP mcrouter_clients Number of connected clients.
3640
# TYPE mcrouter_clients counter
3741
# HELP mcrouter_command_count Total number of received requests drilled down by operation.

main.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ type Exporter struct {
6565
residentMemory *prometheus.Desc
6666
virtualMemory *prometheus.Desc
6767
asynclogRequests *prometheus.Desc
68+
asynclogRequestsRate *prometheus.Desc
69+
asynclogSpoolSuccessRate *prometheus.Desc
6870
serverDuration *prometheus.Desc
6971
serverProxyReqsProcessing *prometheus.Desc
7072
serverProxyInflightReqs *prometheus.Desc
@@ -296,6 +298,18 @@ func NewExporter(server string, timeout time.Duration, server_stats bool, logger
296298
nil,
297299
nil,
298300
),
301+
asynclogRequestsRate: prometheus.NewDesc(
302+
prometheus.BuildFQName(namespace, "", "asynclog_requests_rate"),
303+
"Number of requests that were attempted to be spooled to disk.",
304+
nil,
305+
nil,
306+
),
307+
asynclogSpoolSuccessRate: prometheus.NewDesc(
308+
prometheus.BuildFQName(namespace, "", "asynclog_spool_success_rate"),
309+
"Number of requests that were spooled successfully.",
310+
nil,
311+
nil,
312+
),
299313
serverDuration: prometheus.NewDesc(
300314
prometheus.BuildFQName(namespace, "", "server_duration_us"),
301315
"Average time of processing a request per-server (i.e. receiving request and sending a reply).",
@@ -431,6 +445,8 @@ func (e *Exporter) Describe(ch chan<- *prometheus.Desc) {
431445
ch <- e.residentMemory
432446
ch <- e.virtualMemory
433447
ch <- e.asynclogRequests
448+
ch <- e.asynclogRequestsRate
449+
ch <- e.asynclogSpoolSuccessRate
434450

435451
if e.server_stats {
436452
ch <- e.serverDuration
@@ -559,6 +575,8 @@ func (e *Exporter) Collect(ch chan<- prometheus.Metric) {
559575
ch <- prometheus.MustNewConstMetric(e.virtualMemory, prometheus.CounterValue, e.parse(s, "ps_vsize"))
560576

561577
ch <- prometheus.MustNewConstMetric(e.asynclogRequests, prometheus.CounterValue, e.parse(s, "asynclog_requests"))
578+
ch <- prometheus.MustNewConstMetric(e.asynclogRequestsRate, prometheus.GaugeValue, e.parse(s, "asynclog_requests_rate"))
579+
ch <- prometheus.MustNewConstMetric(e.asynclogSpoolSuccessRate, prometheus.GaugeValue, e.parse(s, "asynclog_spool_success_rate"))
562580

563581
if e.server_stats {
564582
// Per-server stats

0 commit comments

Comments
 (0)