Class: Chef::Handler::Datadog
- Inherits:
-
Chef::Handler
- Object
- Chef::Handler
- Chef::Handler::Datadog
- Defined in:
- lib/chef/handler/datadog.rb
Overview
Datadog handler to send Chef run details to Datadog
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
Instance Method Summary collapse
-
#initialize(config = {}) ⇒ Datadog
constructor
For the tags to work, the client must have created an Application Key on the “Account Settings” page here: app.datadoghq.com/account/settings It should be passed along from the node/role/environemnt attributes, as the default is nil.
- #report ⇒ Object
Constructor Details
#initialize(config = {}) ⇒ Datadog
For the tags to work, the client must have created an Application Key on the “Account Settings” page here: app.datadoghq.com/account/settings It should be passed along from the node/role/environemnt attributes, as the default is nil.
19 20 21 22 23 |
# File 'lib/chef/handler/datadog.rb', line 19 def initialize(config = {}) @config = Mash.new(config) @dogs = prepare_the_pack end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
14 15 16 |
# File 'lib/chef/handler/datadog.rb', line 14 def config @config end |
Instance Method Details
#report ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/chef/handler/datadog.rb', line 25 def report # use datadog agent proxy settings, if available use_agent_proxy unless ENV['DATADOG_PROXY'].nil? # prepare the metrics, event, and tags information to be reported prepare_report_for_datadog @dogs.each do |dog| # post the report information to the datadog service Chef::Log.debug("Sending Chef report to #{dog.datadog_host}") send_report_to_datadog dog end ensure # restore the env proxy settings before leaving to avoid downstream side-effects restore_env_proxies unless ENV['DATADOG_PROXY'].nil? end |