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
# File 'lib/statter/reporter_job.rb', line 8

def perform(config, type, name, data)
  resp = Typhoeus.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.response_code}] #{resp.response_headers}")
end