-
Notifications
You must be signed in to change notification settings - Fork 116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SHACK-188] telemetry cleanup tasks #134
Changes from all commits
b85ec09
23a589f
be41399
ca739f2
c2e307a
af340d8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,6 +32,8 @@ module ChefCLI | |
# a main 'timed_capture', and it would be good to see ordering within nested calls. | ||
class Telemeter | ||
include Singleton | ||
DEFAULT_INSTALLATION_GUID = "00000000-0000-0000-0000-000000000000" | ||
|
||
class << self | ||
extend Forwardable | ||
def_delegators :instance, :timed_capture, :capture, :commit, :timed_action_capture, :timed_run_capture | ||
|
@@ -93,15 +95,25 @@ def commit | |
end | ||
|
||
def make_event_payload(name, data) | ||
properties = { | ||
# We will submit this payload in a future run, so capture the time of actual execution: | ||
run_timestamp: run_timestamp, | ||
# This lets us filter out testing/dev actions, which may not | ||
# follow customer usage patterns: | ||
telemetry_mode: ChefCLI::Config.telemetry.dev ? "dev" : "prod", | ||
host_platform: host_platform, | ||
{ | ||
event: name, | ||
properties: { | ||
installation_id: installation_id, | ||
run_timestamp: run_timestamp, | ||
host_platform: host_platform, | ||
event_data: data | ||
} | ||
} | ||
{ event: name, properties: properties.merge(data) } | ||
end | ||
|
||
def installation_id | ||
@installation_id ||= | ||
begin | ||
File.read(ChefCLI::Config.telemetry_installation_identifier_file).chomp | ||
rescue | ||
ChefCLI::Log.info "could not read #{ChefCLI::Config.telemetry_installation_identifier_file} - using default id" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this sort of user output something that should be defined in the i18n data? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, just a log entry. The user need not know or care about this issue. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OOOOOH, yea. LOG. Right. |
||
DEFAULT_INSTALLATION_GUID | ||
end | ||
end | ||
|
||
# For testing. | ||
|
@@ -125,7 +137,8 @@ def host_platform | |
end | ||
|
||
def convert_events_to_session | ||
YAML.dump({ "entries" => @events_to_send }) | ||
YAML.dump({ "version" => ChefCLI::VERSION, | ||
"entries" => @events_to_send }) | ||
end | ||
|
||
def write_session(session) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👌