We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 6f25e5d commit 53693f1Copy full SHA for 53693f1
gateway/src/apicast/metrics/3scale_backend_status.lua
@@ -0,0 +1,25 @@
1
+local prometheus = require('apicast.prometheus')
2
+local metrics_updater = require('apicast.metrics.updater')
3
+
4
+local format = string.format
5
6
+local _M = {}
7
8
+local backend_response_metric = prometheus(
9
+ 'counter',
10
+ 'backend_response',
11
+ "Response status codes from 3scale's backend",
12
+ { 'status' }
13
+)
14
15
+function _M.inc(status)
16
+ if not status or status == 0 then
17
+ ngx.log(ngx.WARN, 'Invalid status received')
18
+ end
19
20
+ local label = format("%dxx", status/100)
21
22
+ metrics_updater.inc(backend_response_metric, label)
23
+end
24
25
+return _M
0 commit comments