utils/analytics: cleanup data.

Based on reviewing InfluxDB buckets.
This commit is contained in:
Mike McQuaid 2023-02-16 13:15:04 +00:00
parent ef8ad10741
commit a83fef7b41
No known key found for this signature in database
GPG Key ID: 3338A31AFDB1D829

View File

@ -78,7 +78,7 @@ module Utils
def report_influx(measurement, package_and_options, on_request, additional_tags = {})
# Append general information to device information
tags = additional_tags.merge(package_and_options: package_and_options, on_request: !on_request.nil?)
.compact_blank
.compact
.map { |k, v| "#{k}=#{v.to_s.sub(" ", "\\ ")}" } # convert to key/value parameters
.join(",")
@ -346,6 +346,10 @@ module Utils
version = "#{version}-dev" if HOMEBREW_VERSION.include?("-")
prefix = Homebrew.default_prefix? ? HOMEBREW_PREFIX.to_s : "custom-prefix"
# Cleanup quotes and patch/patchset versions to reduce cardinality.
os_version = OS_VERSION.tr('"', "")
.gsub(/(\d+\.\d+)(\.\d+)?(-\d)?/, '\1')
{
version: version,
prefix: prefix,
@ -354,7 +358,7 @@ module Utils
developer: Homebrew::EnvConfig.developer?,
arch: HOMEBREW_PHYSICAL_PROCESSOR,
os: HOMEBREW_SYSTEM,
os_name_and_version: OS_VERSION,
os_name_and_version: os_version,
}
end
end