class Chef::Telemetry
Constants
- VERSION
Attributes
install_context[RW]
origin[RW]
product[RW]
product_version[RW]
Public Class Methods
new(product: nil, origin: "command-line", product_version: "0.0.0", install_context: "omnibus")
click to toggle source
# File lib/chef/telemetry.rb, line 10 def initialize(product: nil, origin: "command-line", product_version: "0.0.0", install_context: "omnibus") # Reference: https://github.com/chef/es-telemetry-pipeline/blob/0730c1e2605624a50d34bab6d036b73c31e0ab0e/schema/event.schema.json#L77 @product = product @origin = origin @product_version = product_version @install_context = install_context # Valid: habitat, omnibus end
Public Instance Methods
client()
click to toggle source
# File lib/chef/telemetry.rb, line 40 def client endpoint = ENV.fetch("CHEF_TELEMETRY_ENDPOINT", Client::TELEMETRY_ENDPOINT) @client ||= Client.new(endpoint) end
deliver(data = {})
click to toggle source
# File lib/chef/telemetry.rb, line 20 def deliver(data = {}) unless opt_out? payload = event.prepare(data) client.await.fire(payload) end end
event()
click to toggle source
# File lib/chef/telemetry.rb, line 27 def event @event ||= Event.new(product, session, origin, install_context, product_version) end
opt_out?()
click to toggle source
# File lib/chef/telemetry.rb, line 36 def opt_out? @opt_out ||= Decision.opt_out? end
session()
click to toggle source
# File lib/chef/telemetry.rb, line 32 def session @session ||= Session.new end