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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user