mirror of
https://github.com/puppetlabs/vmpooler.git
synced 2026-01-26 18:08:42 -05:00
(MAINT) Clarity refactor of Prom Stats code
Introducing the Prometheus Stats code into ABS showed that the Clarity could be improved a bit with better variable naming, some refactoring to reduce repitition and documenting the Metrics table itself. Filtering these changes back to the vmpooler code base.
This commit is contained in:
parent
2556ed6105
commit
0a6ad896f5
5 changed files with 173 additions and 56 deletions
|
|
@ -809,7 +809,7 @@ module Vmpooler
|
|||
|
||||
post "#{api_prefix}/ondemandvm/?" do
|
||||
content_type :json
|
||||
metrics.increment('api_vm.post.ondemand.requestid')
|
||||
metrics.increment('http_requests_vm_total.post.ondemand.requestid')
|
||||
|
||||
need_token! if Vmpooler::API.settings.config[:auth]
|
||||
|
||||
|
|
@ -847,7 +847,7 @@ module Vmpooler
|
|||
post "#{api_prefix}/ondemandvm/:template/?" do
|
||||
content_type :json
|
||||
result = { 'ok' => false }
|
||||
metrics.increment('api_vm.delete.ondemand.template')
|
||||
metrics.increment('http_requests_vm_total.delete.ondemand.template')
|
||||
|
||||
need_token! if Vmpooler::API.settings.config[:auth]
|
||||
|
||||
|
|
@ -874,7 +874,7 @@ module Vmpooler
|
|||
|
||||
get "#{api_prefix}/ondemandvm/:requestid/?" do
|
||||
content_type :json
|
||||
metrics.increment('api_vm.get.ondemand.request')
|
||||
metrics.increment('http_requests_vm_total.get.ondemand.request')
|
||||
|
||||
status 404
|
||||
result = check_ondemand_request(params[:requestid])
|
||||
|
|
@ -885,7 +885,7 @@ module Vmpooler
|
|||
delete "#{api_prefix}/ondemandvm/:requestid/?" do
|
||||
content_type :json
|
||||
need_token! if Vmpooler::API.settings.config[:auth]
|
||||
metrics.increment('api_vm.delete.ondemand.request')
|
||||
metrics.increment('http_requests_vm_total.delete.ondemand.request')
|
||||
|
||||
status 404
|
||||
result = delete_ondemand_request(params[:requestid])
|
||||
|
|
@ -896,7 +896,7 @@ module Vmpooler
|
|||
post "#{api_prefix}/vm/?" do
|
||||
content_type :json
|
||||
result = { 'ok' => false }
|
||||
metrics.increment('api_vm.post.vm.checkout')
|
||||
metrics.increment('http_requests_vm_total.post.vm.checkout')
|
||||
|
||||
payload = JSON.parse(request.body.read)
|
||||
|
||||
|
|
@ -1051,7 +1051,7 @@ module Vmpooler
|
|||
post "#{api_prefix}/vm/:template/?" do
|
||||
content_type :json
|
||||
result = { 'ok' => false }
|
||||
metrics.increment('api_vm.get.vm.template')
|
||||
metrics.increment('http_requests_vm_total.get.vm.template')
|
||||
|
||||
payload = extract_templates_from_query_params(params[:template])
|
||||
|
||||
|
|
@ -1075,7 +1075,7 @@ module Vmpooler
|
|||
|
||||
get "#{api_prefix}/vm/:hostname/?" do
|
||||
content_type :json
|
||||
metrics.increment('api_vm.get.vm.hostname')
|
||||
metrics.increment('http_requests_vm_total.get.vm.hostname')
|
||||
|
||||
result = {}
|
||||
|
||||
|
|
@ -1148,7 +1148,7 @@ module Vmpooler
|
|||
|
||||
delete "#{api_prefix}/vm/:hostname/?" do
|
||||
content_type :json
|
||||
metrics.increment('api_vm.delete.vm.hostname')
|
||||
metrics.increment('http_requests_vm_total.delete.vm.hostname')
|
||||
|
||||
result = {}
|
||||
|
||||
|
|
@ -1177,7 +1177,7 @@ module Vmpooler
|
|||
|
||||
put "#{api_prefix}/vm/:hostname/?" do
|
||||
content_type :json
|
||||
metrics.increment('api_vm.put.vm.modify')
|
||||
metrics.increment('http_requests_vm_total.put.vm.modify')
|
||||
|
||||
status 404
|
||||
result = { 'ok' => false }
|
||||
|
|
@ -1254,7 +1254,7 @@ module Vmpooler
|
|||
|
||||
post "#{api_prefix}/vm/:hostname/disk/:size/?" do
|
||||
content_type :json
|
||||
metrics.increment('api_vm.post.vm.disksize')
|
||||
metrics.increment('http_requests_vm_total.post.vm.disksize')
|
||||
|
||||
need_token! if Vmpooler::API.settings.config[:auth]
|
||||
|
||||
|
|
@ -1278,7 +1278,7 @@ module Vmpooler
|
|||
|
||||
post "#{api_prefix}/vm/:hostname/snapshot/?" do
|
||||
content_type :json
|
||||
metrics.increment('api_vm.post.vm.snapshot')
|
||||
metrics.increment('http_requests_vm_total.post.vm.snapshot')
|
||||
|
||||
need_token! if Vmpooler::API.settings.config[:auth]
|
||||
|
||||
|
|
@ -1304,7 +1304,7 @@ module Vmpooler
|
|||
|
||||
post "#{api_prefix}/vm/:hostname/snapshot/:snapshot/?" do
|
||||
content_type :json
|
||||
metrics.increment('api_vm.post.vm.disksize')
|
||||
metrics.increment('http_requests_vm_total.post.vm.disksize')
|
||||
|
||||
need_token! if Vmpooler::API.settings.config[:auth]
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue