Class: ChefApply::Telemeter
- Inherits:
-
Object
- Object
- ChefApply::Telemeter
- Defined in:
- lib/chef_apply/telemeter.rb
Class Method Summary collapse
Class Method Details
.capture(name, data = {}, options = {}) ⇒ Object
40 41 42 |
# File 'lib/chef_apply/telemeter.rb', line 40 def self.capture(name, data = {}, = {}) Chef::Telemeter.capture(name, data, ) end |
.timed_action_capture(action, &block) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/chef_apply/telemeter.rb', line 24 def self.timed_action_capture(action, &block) # Note: we do not directly capture hostname for privacy concerns, but # using a sha1 digest will allow us to anonymously see # unique hosts to derive number of hosts affected by a command target = action.target_host target_data = { platform: {}, hostname_sha1: nil, transport_type: nil } if target target_data[:platform][:name] = target.base_os # :windows, :linux, eventually :macos target_data[:platform][:version] = target.version target_data[:platform][:architecture] = target.architecture target_data[:hostname_sha1] = Digest::SHA1.hexdigest(target.hostname.downcase) target_data[:transport_type] = target.transport_type end Chef::Telemeter.timed_capture(:action, { action: action.name, target: target_data }, &block) end |