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:
26
backend/app/services/ops/log_scanner.rb
Normal file
26
backend/app/services/ops/log_scanner.rb
Normal file
@@ -0,0 +1,26 @@
|
||||
module Ops
|
||||
class LogScanner
|
||||
def initialize(matcher: LogPatternMatcher.new)
|
||||
@matcher = matcher
|
||||
end
|
||||
|
||||
def ingest(text)
|
||||
matches = @matcher.scan(text)
|
||||
matches.each { |match| record_match(match) }
|
||||
matches.size
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def record_match(match)
|
||||
Ops::IncidentRecorder.record(
|
||||
kind: "log_pattern",
|
||||
severity: match.severity,
|
||||
title: "Log: #{match.name}",
|
||||
message: match.line.truncate(500),
|
||||
metadata: { "pattern" => match.name, "sample" => match.line },
|
||||
fingerprint: "log_pattern:#{match.name}"
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user