Class: Periskop::Client::Exporter
- Inherits:
-
Object
- Object
- Periskop::Client::Exporter
- Defined in:
- lib/periskop/client/exporter.rb
Overview
Exporter exposes in json format all collected exceptions from the specified ‘collector`
Instance Method Summary collapse
- #export ⇒ Object
-
#initialize(collector) ⇒ Exporter
constructor
A new instance of Exporter.
- #push_to_gateway(addr) ⇒ Object
Constructor Details
#initialize(collector) ⇒ Exporter
Returns a new instance of Exporter.
8 9 10 |
# File 'lib/periskop/client/exporter.rb', line 8 def initialize(collector) @collector = collector end |
Instance Method Details
#export ⇒ Object
12 13 14 |
# File 'lib/periskop/client/exporter.rb', line 12 def export @collector.aggregated_exceptions.to_json end |
#push_to_gateway(addr) ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/periskop/client/exporter.rb', line 16 def push_to_gateway(addr) uri = URI.parse("#{addr}/errors") http = Net::HTTP.new(uri.host, uri.port) request = Net::HTTP::Post.new(uri.request_uri, 'Content-Type' => 'application/json') request.body = export http.request(request) end |