Telemetry log messages improved for clarity of calls (#7104)

Signed-off-by: Nik08 <nikita.mathur@progress.com>
This commit is contained in:
Nikita Mathur 2024-07-25 21:43:08 +05:30 committed by GitHub
parent f34db91219
commit e8ee11853b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 3 deletions

View file

@ -23,6 +23,7 @@ module Inspec
Inspec::Telemetry::RunContextProbe.under_automate? ||
license&.license_type&.downcase == "commercial"
Inspec::Log.debug "Determined telemetry operation is not applicable and hence aborting it."
return Inspec::Telemetry::Null
end
@ -37,7 +38,7 @@ module Inspec
end
def self.license
Inspec::Log.debug "Fetching license context for telemetry"
Inspec::Log.debug "Fetching license context for telemetry check"
@license = ChefLicensing.license_context
end
@ -45,7 +46,6 @@ module Inspec
# These class methods make it convenient to call from anywhere within the InSpec codebase.
######
def self.run_starting(opts)
Inspec::Log.debug "Initiating telemetry for InSpec"
@@config ||= opts[:conf]
instance.run_starting(opts)
rescue StandardError => e
@ -55,7 +55,6 @@ module Inspec
def self.run_ending(opts)
@@config ||= opts[:conf]
instance.run_ending(opts)
Inspec::Log.debug "Finishing telemetry for InSpec"
rescue StandardError => e
Inspec::Log.debug "Encountered error in Telemetry end run call -> #{e.message}"
end

View file

@ -36,6 +36,7 @@ module Inspec
end
def run_starting(_opts = {})
Inspec::Log.debug "Initiating telemetry for InSpec"
@scratch ||= {}
@scratch[:features] ||= []
@scratch[:run_start_time] = Time.now.getutc.iso8601
@ -103,6 +104,7 @@ module Inspec
end
Inspec::Log.debug "Final data for telemetry upload -> #{payload}"
Inspec::Log.debug "Finishing telemetry for InSpec"
# Return payload object for testing
payload
end