Class: ReporterJob

Inherits:
Object
  • Object
show all
Includes:
SuckerPunch::Job
Defined in:
lib/statter/reporter_job.rb

Instance Method Summary collapse

Instance Method Details

#perform(config, type, name, data) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/statter/reporter_job.rb', line 8

def perform(config, type, name, data)
  Statter::Agent.log("ReporterJob sending type: #{type}, name: #{name}, data: #{data}")

  resp = HTTParty.post(
              "#{config.url}/stats",
              headers: {
                "x-auth-header" => config.auth_header
              },
              body: { 
                type: type, 
                name: name,
                data: data
                }
              )
  Statter::Agent.log("sent type: #{type}, name: #{name}, data: #{data}, response: [#{resp.code}] #{resp.headers.inspect}")

rescue => e
  Statter::Agent.log("Exception sending type: #{type}, name: #{name}, data: #{data}: #{e.message}\n#{e.backtrace.join("\n")}")

end