class Periskop::Client::Exporter

Exporter exposes in json format all collected exceptions from the specified ‘collector`

Public Class Methods

new(collector) click to toggle source
# File lib/periskop/client/exporter.rb, line 8
def initialize(collector)
  @collector = collector
end

Public Instance Methods

export() click to toggle source
# File lib/periskop/client/exporter.rb, line 12
def export
  @collector.aggregated_exceptions.to_json
end
push_to_gateway(addr) click to toggle source
# File lib/periskop/client/exporter.rb, line 16
def push_to_gateway(addr)
  if !addr.nil? && !addr.empty?
    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
end