Aggiunge monitoraggio ops: health check, log scanner, dashboard e notifiche.
Introduce incidenti con dedup, job Sidekiq ogni 3 min, scan log cron, /up/deep, dashboard /admin/ops e push ntfy; include Sentry opzionale e fix test suite. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
24
backend/spec/services/ops/log_pattern_matcher_spec.rb
Normal file
24
backend/spec/services/ops/log_pattern_matcher_spec.rb
Normal file
@@ -0,0 +1,24 @@
|
||||
require "rails_helper"
|
||||
|
||||
RSpec.describe Ops::LogPatternMatcher do
|
||||
subject(:matcher) do
|
||||
described_class.new(
|
||||
patterns: [
|
||||
{ name: "http_500", severity: "warning", regex: /Completed 500/i },
|
||||
{ name: "disk_full", severity: "critical", regex: /No space left on device/i }
|
||||
]
|
||||
)
|
||||
end
|
||||
|
||||
it "trova pattern nei log" do
|
||||
log = <<~LOG
|
||||
I, [2026-06-10T19:45:10] Completed 500 Internal Server Error
|
||||
E, [2026-06-10T19:45:11] No space left on device - /recordings
|
||||
LOG
|
||||
|
||||
matches = matcher.scan(log)
|
||||
|
||||
expect(matches.map(&:name)).to contain_exactly("http_500", "disk_full")
|
||||
expect(matches.find { |m| m.name == "disk_full" }.severity).to eq("critical")
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user