lib/skylight/instrumenter.rb in skylight-0.2.2 vs lib/skylight/instrumenter.rb in skylight-0.2.3
- old
+ new
@@ -77,11 +77,11 @@
@subscriber.register!
self
rescue Exception => e
- error "failed to start instrumenter; msg=%s", e.message
+ log_error "failed to start instrumenter; msg=%s", e.message
nil
end
def shutdown
@subscriber.unregister!
@@ -97,11 +97,11 @@
end
begin
trace = Messages::Trace::Builder.new(self, endpoint, Util::Clock.micros, cat, title, desc, annot)
rescue Exception => e
- error e.message
+ log_error e.message
t { e.backtrace.join("\n") }
return
end
@trace_info.current = trace
@@ -181,17 +181,13 @@
set[description] = true
description
end
end
- def error(reason, body)
- t { fmt "processing error; reason=%s; body=%s", reason, body }
+ def error(type, description, details=nil)
+ t { fmt "processing error; type=%s; description=%s", type, description }
- if body.encoding == Encoding::BINARY || !body.valid_encoding?
- body = Base64.encode64(body)
- end
-
- message = Skylight::Messages::Error.new(reason: reason, body: body)
+ message = Skylight::Messages::Error.new(type: type, description: description, details: details && details.to_json)
unless @worker.submit(message)
warn "failed to submit error to worker"
end
end