Skip to content

Commit

Permalink
Merge pull request #17154 from Homebrew/cleanup_test_bot_analytics
Browse files Browse the repository at this point in the history
utils/analytics: cleanup test-bot analytics.
  • Loading branch information
MikeMcQuaid authored Apr 26, 2024
2 parents ee4499f + 414e221 commit af0f115
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions Library/Homebrew/utils/analytics.rb
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,23 @@ def report_test_bot_test(step_command_short, passed)
os: HOMEBREW_SYSTEM,
}

command_and_package, options =
step_command_short.split
.partition { |arg| !arg.start_with?("-") }

# Strip out any flag values to reduce cardinality and preserve privacy.
command = step_command_short.split
.map { |arg| arg.sub(/=.*/, "=") }
.join(" ")
# Sort options to ensure consistent ordering and improve readability.
options = options.join(" ")
.split
.join(" ")
.split(/(-+)/)
.map { |a| a.sub(/[ =].+/, " ") }
.join(" ")
.strip
.split
.sort

command = (command_and_package + options).join(" ")

# Fields can have high cardinality.
fields = { command: }
Expand Down

0 comments on commit af0f115

Please sign in to comment.