Filippo Giunchedi has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/401535 )

Change subject: mtail: add program to count varnish backend metrics
......................................................................

mtail: add program to count varnish backend metrics

The histogram buckets will likely need some tuning.

Bug: T177199
Change-Id: Ia2fa39674be38ef340a7785e8f10722bd04373bf
---
A modules/mtail/files/programs/varnish_backend.mtail
1 file changed, 56 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/puppet 
refs/changes/35/401535/1

diff --git a/modules/mtail/files/programs/varnish_backend.mtail 
b/modules/mtail/files/programs/varnish_backend.mtail
new file mode 100644
index 0000000..360df7f
--- /dev/null
+++ b/modules/mtail/files/programs/varnish_backend.mtail
@@ -0,0 +1,56 @@
+# Three counters to implement Prometheus histograms
+counter varnish_backend_requests_seconds_bucket by le, status, method, backend
+counter varnish_backend_requests_seconds_sum by status, method, backend
+counter varnish_backend_requests_seconds_count by status, method, backend
+
+/http_status (?P<status>[0-9][0-9][0-9])\thttp_method 
(?P<method>[A-Z]+)\tbackend (?P<backend>\S+)\tttfb (?P<ttfb>[0-9]+)/ {
+  varnish_backend_requests_seconds_count[$status][$method][$backend]++
+  varnish_backend_requests_seconds_sum[$status][$method][$backend] += $ttfb
+
+  # Latency histogram buckets
+  $ttfb <= 0.005 {
+    http_request_duration_seconds_bucket["0.005"][$status][$method][$backend]++
+  }
+
+  $ttfb <= 0.010 {
+    http_request_duration_seconds_bucket["0.010"][$status][$method][$backend]++
+  }
+
+  $ttfb <= 0.050 {
+    http_request_duration_seconds_bucket["0.050"][$status][$method][$backend]++
+  }
+
+  $ttfb <= 0.100 {
+    http_request_duration_seconds_bucket["0.100"][$status][$method][$backend]++
+  }
+
+  $ttfb <= 0.120 {
+    http_request_duration_seconds_bucket["0.100"][$status][$method][$backend]++
+  }
+
+  $ttfb <= 0.150 {
+    http_request_duration_seconds_bucket["0.150"][$status][$method][$backend]++
+  }
+
+  $ttfb <= 0.200 {
+    http_request_duration_seconds_bucket["0.200"][$status][$method][$backend]++
+  }
+
+  $ttfb <= 0.500 {
+    http_request_duration_seconds_bucket["0.500"][$status][$method][$backend]++
+  }
+
+  $ttfb <= 1.000 {
+    http_request_duration_seconds_bucket["1.000"][$status][$method][$backend]++
+  }
+
+  $ttfb <= 5.000 {
+    http_request_duration_seconds_bucket["5.000"][$status][$method][$backend]++
+  }
+
+  $ttfb <= 10.000 {
+    
http_request_duration_seconds_bucket["10.000"][$status][$method][$backend]++
+  }
+
+  http_request_duration_seconds_bucket["+Inf"][$status][$method][$backend]++
+}

-- 
To view, visit https://gerrit.wikimedia.org/r/401535
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia2fa39674be38ef340a7785e8f10722bd04373bf
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Filippo Giunchedi <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to