-
Notifications
You must be signed in to change notification settings - Fork 170
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #919 from 3scale/metrics-backend-calls-type
Metrics: add the type of 3scale backend call (auth, authrep, report)
- Loading branch information
Showing
7 changed files
with
236 additions
and
137 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
local prometheus = require('apicast.prometheus') | ||
|
||
local format = string.format | ||
|
||
local _M = {} | ||
|
||
local threescale_backend_call = prometheus( | ||
'counter', | ||
'threescale_backend_calls', | ||
"Calls to the 3scale backend", | ||
{ 'endpoint', 'status' } | ||
) | ||
|
||
local function label_for_status(status) | ||
if not status or status == '' or status == 0 then | ||
return 'invalid_status' | ||
else | ||
return format("%dxx", status/100) | ||
end | ||
end | ||
|
||
function _M.report(endpoint, status) | ||
if threescale_backend_call then | ||
threescale_backend_call:inc(1, { endpoint, label_for_status(status) }) | ||
end | ||
end | ||
|
||
return _M |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.