Autotuner: use structured logging instead of Sentry (#2011)

Move thousands of info-level Sentry events to logs. Query Loki rather
than downsampling events: `event.action = "run.ruby-script",
script.name = "autotuner"`
This commit is contained in:
Jeremy Daer
2025-12-08 10:01:28 -08:00
committed by GitHub
parent bc073a7e79
commit b88182c3ad
+8 -6
View File
@@ -3,12 +3,14 @@
Autotuner.enabled = true
# This callback is called whenever a suggestion is provided by this gem.
# You can output this report to your logging pipeline, stdout, a file,
# or somewhere else!
Autotuner.reporter = proc do |report|
# Log to structured logging for query/analysis in Loki. This is called
# once per autotuner heuristic.
Autotuner.reporter = proc do |heuristic_report|
report = heuristic_report.to_s
Rails.logger.info "GCAUTOTUNE: #{report}"
if Fizzy.saas?
Sentry.capture_message "Autotuner suggestion", level: :info, extra: { report: report.to_s }
end
RailsStructuredLogging.instrument_script "autotuner" do
Rails.logger.info report.to_s
end if defined? RailsStructuredLogging
end