38 Commits

Author SHA1 Message Date
Mike McQuaid
28c3215dba
analytics: support command and test-bot analytics.
These are used to analyse which commands are used and the
success/failure rate of official taps using `brew test-bot`.
2024-04-25 17:38:04 +01:00
apainintheneck
226239da4c tests: remove unnecessary cache clearing
This PR removes all remaining unnecessary cache clearing in tests
from the codebase since we now clear all cachable classes between
tests making this functionally unnecessary.

Original PR to automatically clear caches:
- https://github.com/Homebrew/brew/pull/16746

I also moved the `Utils::Analytics` module to use cachable so
that we don't have to clear caches specifically in tests anymore.
2024-03-31 18:38:03 -07:00
Mike McQuaid
ea2892f8ee
brew.rb: handle missing args. 2024-03-07 16:20:20 +00:00
Mike McQuaid
9259c345cc
utils/analytics: general cleanup.
We have plans to add analytics for commands and `brew test-bot`

This requires a certain amount of refactoring which I've done here.

There was also a bunch of legacy `*_influx_?` usage from when we used
both InfluxDB and Google Analytics that made sense to clean up and
excessive indirection.
2024-03-07 15:19:04 +00:00
Douglas Eichelberger
26eda5a303
git grep -l '^describe' | xargs gsed -i 's|^describe|RSpec.describe|g' 2024-02-19 13:57:27 +00:00
Mike McQuaid
75dd070395
Remove Google Analytics
We are now entirely migrated to InfluxDB so can remove all GA code.
2023-06-16 10:33:15 +01:00
Douglas Eichelberger
9075cbae62 brew style --fix 2023-04-21 09:58:50 -07:00
Douglas Eichelberger
ac1e6ded9a git grep -l '# typed: false' | xargs gsed -i 's|# typed: false||g' 2023-04-21 09:57:47 -07:00
Mike McQuaid
4d8445e29d
analytics: improve InfluxDB cardinality
- roll InfluxDB token (we need to report to a new bucket to fix implicit schema)
- adjust various parameters
- separate default tags and fields
- send more fields and fewer tags (tags should have low cardinality)
- use `--data-binary` to match InfluxDB documentation
- document second precision for greater InfluxDB performance
- pass through tap name, formula/cask name, options separately
- pass `devcmdrun` as a tag
- avoid sending very high-cardinality `OS_VERSION` values
2023-03-20 15:26:47 +00:00
Mike McQuaid
a743e9277f
workflows/tests: faster, more reliable tests.
- Extract update tests into separate tests.
- Make `brew tests --online` run only once in its own job. This job
  could be made non-required to fight flakiness.
- Split up the various macOS runs into several steps now that we have
  more parallel macOS workers available.
- Cleanup some flaky tests.
2023-02-17 15:26:18 +00:00
Bo Anderson
921b427ff2
test/utils/analytics_spec: fix flaky test 2023-02-17 02:17:03 +00:00
Mike McQuaid
769a8c5001
analytics: report to InfluxDB by default.
Now that this is ready: let's roll it out to everyone in 4.0.0.
2023-02-15 17:27:02 +00:00
Mike McQuaid
c5252817c2
analytics: refactor InfluxDB/Google handling. 2023-02-15 16:34:50 +00:00
Sean Molenaar
50e9247da4
fix: add better keys and fuller values to influxDB analytics 2023-02-15 14:12:05 +01:00
Sean Molenaar
61e5e19bdb
analytics: fix spelling
Co-authored-by: Mike McQuaid <mike@mikemcquaid.com>
Co-authored-by: Eric Knibbe <enk3@outlook.com>
2023-02-06 16:56:25 +01:00
Sean Molenaar
10e3c522f7
analytics: stop sending analytics in tests 2023-02-06 16:28:34 +01:00
Douglas Eichelberger
f365870a42 Resolve utils/analytics_spec violation 2023-01-22 17:26:44 -08:00
Sean Molenaar
59ebdab2b7
analytics: switch to InfluxDB for logging 2023-01-19 18:15:27 +01:00
Rylan Polster
7656c09184
Only check for Rosetta on macOS 2021-12-05 13:03:38 -05:00
Nipunn Koorapati
30c4663066 Fix analytics string to test for CI 2021-12-04 12:29:31 -05:00
Rylan Polster
b58551cd67
Control for CPU type and Rosetta in os_arch_prefix_ci tests 2021-12-03 22:29:10 -05:00
Nipunn Koorapati
e2fc14b0b7 Fix analytics_spec.rb test to pass when run from M1 2021-12-03 20:14:17 -05:00
Misty De Meo
93ea8b6350
Analytics spec: avoid ARM-specific strings 2021-06-15 20:35:21 -07:00
Mike McQuaid
e65e310fd0
Fix brew style 2021-01-29 20:56:59 +00:00
Mike McQuaid
8af4895479
Improve submitted analytics data
- Use default `custom-prefix` label on macOS ARM (as `/usr/local` is
  not the default).
- Add architecture (or Rosetta) to analytics event label.
- Don't send minor versions on Big Sur.
- Remove defunct `HOMEBREW_OSX_VERSION` reference.
2021-01-07 09:28:40 +00:00
Markus Reiter
24ae318a3d Move type annotations into files. 2020-10-10 14:59:39 +02:00
Mike McQuaid
3a9f585ebb
Move more code to utils/analytics. 2019-11-22 09:10:29 +00:00
Mike McQuaid
36dbad3922
Add frozen_string_literal to all files. 2019-04-20 13:27:36 +09:00
Mike McQuaid
234e4aec96
Improve use of default_prefix? in tests. 2019-01-21 14:33:56 +00:00
Mike McQuaid
78eba5b815
Autofix RuboCop RSpec failures 2018-09-20 13:36:42 +01:00
Shaun Jackman
f6093961ef Add Homebrew::DEFAULT_PREFIX for Linux
The default prefix is /usr/local on macOS
and /home/linuxbrew/.linuxbrew on Linux.
2018-09-11 09:57:08 -07:00
Mike McQuaid
5e1806e796 test: rubocop-rspec style auto-corrects.
There’s too many warnings to start enabling `rubocop-rspec` by default
but let’s at least apply the cleanups it does automatically.
2018-03-25 13:30:37 +01:00
Mike McQuaid
83cca40fc9 RuboCop 0.53.0 manual fixes. 2018-03-08 14:10:02 +00:00
mansimarkaur
db28126b4a Used clear_anonymous_os_prefix_ci_cache to remove @anonymous_os_prefix_ci 2017-08-29 16:24:19 +05:30
mansimarkaur
59f3c661a3 Used ENV.delete to remove set ENV vars 2017-08-29 16:24:19 +05:30
mansimarkaur
a4d8d7ba57 Added tests for report_build_error 2017-08-29 16:24:19 +05:30
mansimarkaur
2660f5ae3e Added tests for report and report_event 2017-08-29 16:24:19 +05:30
mansimarkaur
a4d4da64aa Added tests for os_prefix_ci 2017-08-29 16:24:19 +05:30