[QENG-4075] Rename usages of statsd -> metrics

Really, let's just support a generic metrics interface.
This commit is contained in:
Rick Bradley 2016-07-12 14:50:10 -05:00
parent 3a299af59d
commit 10e00a44f5
4 changed files with 12 additions and 12 deletions

View file

@ -42,10 +42,10 @@ module Vmpooler
use Vmpooler::API::Reroute use Vmpooler::API::Reroute
use Vmpooler::API::V1 use Vmpooler::API::V1
def configure(config, redis, statsd, environment = :production) def configure(config, redis, metrics, environment = :production)
self.settings.set :config, config self.settings.set :config, config
self.settings.set :redis, redis self.settings.set :redis, redis
self.settings.set :statsd, statsd self.settings.set :metrics, metrics
self.settings.set :environment, environment self.settings.set :environment, environment
end end

View file

@ -12,8 +12,8 @@ module Vmpooler
Vmpooler::API.settings.redis Vmpooler::API.settings.redis
end end
def statsd def metrics
Vmpooler::API.settings.statsd Vmpooler::API.settings.metrics
end end
def config def config
@ -92,11 +92,11 @@ module Vmpooler
vm, name = fetch_single_vm(requested) vm, name = fetch_single_vm(requested)
if !vm if !vm
failed = true failed = true
statsd.increment('checkout.empty.' + requested) metrics.increment('checkout.empty.' + requested)
break break
else else
vms << [ name, vm ] vms << [ name, vm ]
statsd.increment('checkout.success.' + name) metrics.increment('checkout.success.' + name)
end end
end end
end end
@ -382,7 +382,7 @@ module Vmpooler
result = atomically_allocate_vms(payload) result = atomically_allocate_vms(payload)
else else
invalid.each do |bad_template| invalid.each do |bad_template|
statsd.increment('checkout.invalid.' + bad_template) metrics.increment('checkout.invalid.' + bad_template)
end end
status 404 status 404
end end
@ -424,7 +424,7 @@ module Vmpooler
result = atomically_allocate_vms(payload) result = atomically_allocate_vms(payload)
else else
invalid.each do |bad_template| invalid.each do |bad_template|
statsd.increment('checkout.invalid.' + bad_template) metrics.increment('checkout.invalid.' + bad_template)
end end
status 404 status 404
end end

View file

@ -20,7 +20,7 @@ describe Vmpooler::API::V1 do
describe '/vm' do describe '/vm' do
let(:prefix) { '/api/v1' } let(:prefix) { '/api/v1' }
let(:statsd) { Vmpooler::DummyStatsd.new } let(:metrics) { Vmpooler::DummyStatsd.new }
let(:config) { let(:config) {
{ {
config: { config: {
@ -44,7 +44,7 @@ describe Vmpooler::API::V1 do
app.settings.set :config, config app.settings.set :config, config
app.settings.set :redis, redis app.settings.set :redis, redis
app.settings.set :statsd, statsd app.settings.set :metrics, metrics
app.settings.set :config, auth: false app.settings.set :config, auth: false
create_token('abcdefghijklmnopqrstuvwxyz012345', 'jdoe', current_time) create_token('abcdefghijklmnopqrstuvwxyz012345', 'jdoe', current_time)
end end

View file

@ -20,7 +20,7 @@ describe Vmpooler::API::V1 do
describe '/vm/:template' do describe '/vm/:template' do
let(:prefix) { '/api/v1' } let(:prefix) { '/api/v1' }
let(:statsd) { Vmpooler::DummyStatsd.new } let(:metrics) { Vmpooler::DummyStatsd.new }
let(:config) { let(:config) {
{ {
config: { config: {
@ -44,7 +44,7 @@ describe Vmpooler::API::V1 do
app.settings.set :config, config app.settings.set :config, config
app.settings.set :redis, redis app.settings.set :redis, redis
app.settings.set :statsd, statsd app.settings.set :metrics, metrics
app.settings.set :config, auth: false app.settings.set :config, auth: false
create_token('abcdefghijklmnopqrstuvwxyz012345', 'jdoe', current_time) create_token('abcdefghijklmnopqrstuvwxyz012345', 'jdoe', current_time)
end end