class Chef::Telemetry::Event

Constants

SKELETON

Attributes

install_context[R]
origin[R]
product[R]
product_version[R]
session[R]

Public Class Methods

new(product, session, origin = "command-line", install_context = "omnibus", product_version = "0.0.0") click to toggle source
# File lib/chef/telemetry/event.rb, line 15
def initialize(product, session, origin = "command-line",
               install_context = "omnibus", product_version = "0.0.0")
  @product = product
  @session = session
  @origin = origin
  @product_version = product_version
  @install_context = install_context
end

Public Instance Methods

prepare(event) click to toggle source
# File lib/chef/telemetry/event.rb, line 24
def prepare(event)
  time = timestamp
  event[:properties][:timestamp] = time
  body = SKELETON.dup
  body.tap do |b|
    b[:session_id] = session.id
    b[:origin] = origin
    b[:product] = product
    b[:product_version] = product_version
    b[:install_context] = install_context
    b[:timestamp] = time
    b[:payload] = event
  end
end
timestamp() click to toggle source
# File lib/chef/telemetry/event.rb, line 39
def timestamp
  Time.now.utc.strftime("%FT%TZ")
end