chore: Enable runtime metrics on Heroku (#1178)

Co-authored-by: Pranav Raj S <pranav@thoughtwoot.com>
This commit is contained in:
Sojan Jose
2020-09-03 15:24:08 +05:30
committed by GitHub
parent e4336ffcb3
commit afb5694ed6
6 changed files with 11 additions and 4 deletions

View File

@@ -48,6 +48,8 @@ gem 'dotenv-rails'
gem 'foreman' gem 'foreman'
gem 'puma' gem 'puma'
gem 'webpacker', '~> 5.x' gem 'webpacker', '~> 5.x'
# metrics on heroku
gem 'barnes'
##--- gems for authentication & authorization ---## ##--- gems for authentication & authorization ---##
gem 'devise' gem 'devise'

View File

@@ -122,6 +122,9 @@ GEM
faraday (~> 1.0) faraday (~> 1.0)
faraday_middleware (~> 1.0.0.rc1) faraday_middleware (~> 1.0.0.rc1)
nokogiri (~> 1.10.4) nokogiri (~> 1.10.4)
barnes (0.0.8)
multi_json (~> 1)
statsd-ruby (~> 1.1)
bcrypt (3.1.13) bcrypt (3.1.13)
bindex (0.8.1) bindex (0.8.1)
bootsnap (1.4.6) bootsnap (1.4.6)
@@ -485,6 +488,7 @@ GEM
actionpack (>= 4.0) actionpack (>= 4.0)
activesupport (>= 4.0) activesupport (>= 4.0)
sprockets (>= 3.0.0) sprockets (>= 3.0.0)
statsd-ruby (1.4.0)
telegram-bot-ruby (0.12.0) telegram-bot-ruby (0.12.0)
faraday faraday
inflecto inflecto
@@ -558,6 +562,7 @@ DEPENDENCIES
attr_extras attr_extras
aws-sdk-s3 aws-sdk-s3
azure-storage-blob azure-storage-blob
barnes
bootsnap bootsnap
brakeman brakeman
browser browser

View File

@@ -50,7 +50,7 @@ class Messages::Facebook::MessageBuilder
def attach_file(attachment, file_url) def attach_file(attachment, file_url)
file_resource = LocalResource.new(file_url) file_resource = LocalResource.new(file_url)
attachment.file.attach(io: file_resource.file, filename: file_resource.tmp_filename, content_type: file_resource.encoding) attachment.file.attach(io: file_resource.file, filename: file_resource.tmp_filename, content_type: file_resource.encoding)
rescue Errno::ETIMEDOUT, Errno::ECONNREFUSED => e rescue Errno::ETIMEDOUT, Errno::ECONNREFUSED, SocketError => e
Rails.logger.info "invalid url #{file_url} : #{e.message}" Rails.logger.info "invalid url #{file_url} : #{e.message}"
end end

View File

@@ -81,7 +81,7 @@ class Api::V1::Accounts::CallbacksController < Api::V1::Accounts::BaseController
avatar_resource = LocalResource.new(uri) avatar_resource = LocalResource.new(uri)
facebook_inbox.avatar.attach(io: avatar_resource.file, filename: avatar_resource.tmp_filename, content_type: avatar_resource.encoding) facebook_inbox.avatar.attach(io: avatar_resource.file, filename: avatar_resource.tmp_filename, content_type: avatar_resource.encoding)
rescue Errno::ETIMEDOUT, Errno::ECONNREFUSED => e rescue Errno::ETIMEDOUT, Errno::ECONNREFUSED, SocketError => e
Rails.logger.info "invalid url #{file_url} : #{e.message}" Rails.logger.info "invalid url #{file_url} : #{e.message}"
end end

View File

@@ -4,7 +4,7 @@ class ContactAvatarJob < ApplicationJob
def perform(contact, avatar_url) def perform(contact, avatar_url)
avatar_resource = LocalResource.new(avatar_url) avatar_resource = LocalResource.new(avatar_url)
contact.avatar.attach(io: avatar_resource.file, filename: avatar_resource.tmp_filename, content_type: avatar_resource.encoding) contact.avatar.attach(io: avatar_resource.file, filename: avatar_resource.tmp_filename, content_type: avatar_resource.encoding)
rescue Errno::ETIMEDOUT, Errno::ECONNREFUSED => e rescue Errno::ETIMEDOUT, Errno::ECONNREFUSED, SocketError => e
Rails.logger.info "invalid url #{file_url} : #{e.message}" Rails.logger.info "invalid url #{file_url} : #{e.message}"
end end
end end

View File

@@ -107,7 +107,7 @@ class Twilio::IncomingMessageService
) )
@message.save! @message.save!
rescue Errno::ETIMEDOUT, Errno::ECONNREFUSED => e rescue Errno::ETIMEDOUT, Errno::ECONNREFUSED, SocketError => e
Rails.logger.info "invalid url #{file_url} : #{e.message}" Rails.logger.info "invalid url #{file_url} : #{e.message}"
end end
end end