Last active
November 7, 2017 23:58
-
-
Save maplebed/e82117529fb7c71880bece76ff0081c3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "net/http" | |
require "uri" | |
require "openssl" | |
require "json" | |
class Honeycomb | |
def self.report(run_status) | |
api_data = { | |
"node.name" => run_status.node.name, | |
"start_time" => run_status.start_time, | |
"end_time" => run_status.end_time, | |
"elapsed_time" => run_status.elapsed_time, | |
"success" => run_status.success?, | |
"exception" => run_status.exception, | |
"backtrace" => run_status.backtrace, | |
"run_id" => run_status.run_id, | |
} | |
headers = { | |
"X-Honeycomb-Team" => run_status.node['honeycomb']['writekey'], | |
"X-Event-Time" => run_status.start_time, | |
} | |
Chef::HTTP::SimpleJSON.new('https://api.honeycomb.io/').post('/1/events/chefrun', api_data, headers) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment