Send log errors to DataDog

pull/1427/head
Rick Carlino 2019-09-11 10:18:24 -05:00
parent f5aaf4acd9
commit 34cd38bbbf
1 changed files with 3 additions and 1 deletions

View File

@ -8,16 +8,18 @@ class LogService < AbstractServiceRunner
T.new(1.day) => 0.5 * 100_000
LOG_TPL = "FBOS LOG (device_%s): %s"
ERR_TPL = "LOG ERROR: %s"
def process(delivery_info, payload)
params = { routing_key: delivery_info.routing_key, payload: payload }
m = AmqpLogParser.run!(params)
binding.pry
if Rails.env.production?
puts LOG_TPL % [m.device_id, m.payload["message"]]
end
THROTTLE_POLICY.track(m.device_id)
maybe_deliver(m)
rescue Mutations::ValidationException => e
puts ERR_TPL % [params.merge({ e: e }).to_json]
end
def maybe_deliver(data)