utils/analytics: tweaks constants.

This enables easier usage in `brew formula-analytics`.
This commit is contained in:
Mike McQuaid 2023-02-21 17:07:01 +00:00
parent 853b33bcda
commit 792ec7fc85
No known key found for this signature in database
GPG Key ID: 3338A31AFDB1D829

View File

@ -11,15 +11,16 @@ module Utils
# #
# @api private # @api private
module Analytics module Analytics
INFLUX_BUCKET = "analytics"
INFLUX_TOKEN = "9eMkCRwRWS7xjPR_HbF5tBffKmnyRFSup7rq41tHZLOpnBsjVtRFd-y9R_P9OCcB3kr1ftDEzxcxTehcufy1SQ=="
INFLUX_HOST = "https://europe-west1-1.gcp.cloud2.influxdata.com"
INFLUX_ORG = "9a707721bb47fc02"
class << self class << self
extend T::Sig extend T::Sig
include Context include Context
INFLUX_BUCKET = "analytics"
INFLUX_TOKEN = "9eMkCRwRWS7xjPR_HbF5tBffKmnyRFSup7rq41tHZLOpnBsjVtRFd-y9R_P9OCcB3kr1ftDEzxcxTehcufy1SQ=="
INFLUX_HOST = "europe-west1-1.gcp.cloud2.influxdata.com"
sig { params(type: Symbol, metadata: T::Hash[Symbol, T.untyped]).void } sig { params(type: Symbol, metadata: T::Hash[Symbol, T.untyped]).void }
def report_google(type, metadata = {}) def report_google(type, metadata = {})
analytics_ids = ENV.fetch("HOMEBREW_ANALYTICS_IDS", "").split(",") analytics_ids = ENV.fetch("HOMEBREW_ANALYTICS_IDS", "").split(",")
@ -93,7 +94,7 @@ module Utils
"--data-raw", "#{measurement},#{tags} count=1i #{Time.now.to_i}" "--data-raw", "#{measurement},#{tags} count=1i #{Time.now.to_i}"
] ]
url = "https://#{INFLUX_HOST}/api/v2/write?bucket=#{INFLUX_BUCKET}&precision=s" url = "#{INFLUX_HOST}/api/v2/write?bucket=#{INFLUX_BUCKET}&precision=s"
deferred_curl(url, args) deferred_curl(url, args)
end end