Update skylight, rollbar, add instrumentation for images endpoint slowness

pull/325/merge
Rick Carlino 2017-05-02 10:58:38 -05:00
parent 892e965d24
commit ae9799d059
4 changed files with 16 additions and 8 deletions

View File

@ -67,7 +67,7 @@ GEM
cocaine (0.5.8)
climate_control (>= 0.0.3, < 1.0)
coderay (1.1.1)
concurrent-ruby (1.0.2)
concurrent-ruby (1.0.5)
daemons (1.2.4)
database_cleaner (1.5.3)
delayed_job (4.1.2)
@ -112,7 +112,7 @@ GEM
activesupport (>= 4.1.0)
http-cookie (1.0.3)
domain_name (~> 0.5)
i18n (0.7.0)
i18n (0.8.1)
json (1.8.3)
json-schema-generator (0.0.9)
jsonpath
@ -134,7 +134,7 @@ GEM
mime-types-data (3.2016.0521)
mimemagic (0.3.2)
mini_portile2 (2.1.0)
minitest (5.9.1)
minitest (5.10.1)
montrose (0.6.0)
activesupport (>= 4.1, < 5.1)
multi_json (1.12.1)
@ -203,7 +203,7 @@ GEM
http-cookie (>= 1.0.2, < 2.0)
mime-types (>= 1.16, < 4.0)
netrc (~> 0.8)
rollbar (2.13.3)
rollbar (2.14.1)
multi_json
rspec (3.5.0)
rspec-core (~> 3.5.0)
@ -232,7 +232,7 @@ GEM
json (>= 1.8, < 3)
simplecov-html (~> 0.10.0)
simplecov-html (0.10.0)
skylight (1.0.1)
skylight (1.2.2)
activesupport (>= 3.0.0)
slop (3.6.0)
sprockets (3.7.0)
@ -247,8 +247,8 @@ GEM
eventmachine (~> 1.0, >= 1.0.4)
rack (>= 1, < 3)
thor (0.19.4)
thread_safe (0.3.5)
tzinfo (1.2.2)
thread_safe (0.3.6)
tzinfo (1.2.3)
thread_safe (~> 0.1)
unf (0.1.4)
unf_ext

View File

@ -1,5 +1,7 @@
module Api
class ImagesController < Api::AbstractController
include Skylight::Helpers
BUCKET = ENV.fetch("GCS_BUCKET") { "YOU_MUST_CONFIG_GOOGLE_CLOUD_STORAGE" }
KEY = ENV.fetch("GCS_KEY") { "" }
SECRET = ENV.fetch("GCS_ID") { "" }
@ -8,6 +10,7 @@ module Api
mutate Images::Create.run({device: current_device}, raw_json)
end
instrument_method
def index
mutate Images::Fetch.run(device: current_device)
end

View File

@ -1,11 +1,14 @@
module Images
class Fetch < Mutations::Command
include Skylight::Helpers
required do
model :device, class: Device
end
instrument_method
def execute
device.images.order(created_at: :desc).first(device.max_images_count)
end
end
end
end

View File

@ -1,7 +1,9 @@
class ImageSerializer < ActiveModel::Serializer
include Skylight::Helpers
attributes :id, :device_id, :attachment_processed_at, :updated_at,
:created_at, :attachment_url, :meta
instrument_method
def attachment_url
object.attachment.url("x640")
end