Fix method visibility in BackupMonitor for health check endpoints
- Move get_recent_backups, get_failed_backups, and get_container_backup_history methods to public section - Remove duplicate methods that were incorrectly placed in private section - Health check server endpoints now fully functional 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
6688145ff2
commit
0babc03430
1 changed files with 23 additions and 23 deletions
|
@ -122,6 +122,29 @@ class Baktainer::BackupMonitor
|
||||||
@logger.info("Cleared all performance alerts")
|
@logger.info("Cleared all performance alerts")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Get recent backups for health check endpoints
|
||||||
|
def get_recent_backups(limit = 50)
|
||||||
|
@mutex.synchronize do
|
||||||
|
@backup_history.last(limit).reverse
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# Get failed backups for health check endpoints
|
||||||
|
def get_failed_backups(limit = 20)
|
||||||
|
@mutex.synchronize do
|
||||||
|
failed = @backup_history.select { |b| b[:status] == 'failed' }
|
||||||
|
failed.last(limit).reverse
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# Get backup history for a specific container
|
||||||
|
def get_container_backup_history(container_name, limit = 20)
|
||||||
|
@mutex.synchronize do
|
||||||
|
container_backups = @backup_history.select { |b| b[:container_name] == container_name }
|
||||||
|
container_backups.last(limit).reverse
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def export_metrics(format = :json)
|
def export_metrics(format = :json)
|
||||||
case format
|
case format
|
||||||
when :json
|
when :json
|
||||||
|
@ -230,27 +253,4 @@ class Baktainer::BackupMonitor
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Get recent backups for health check endpoints
|
|
||||||
def get_recent_backups(limit = 50)
|
|
||||||
@mutex.synchronize do
|
|
||||||
@backup_history.last(limit).reverse
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
# Get failed backups for health check endpoints
|
|
||||||
def get_failed_backups(limit = 20)
|
|
||||||
@mutex.synchronize do
|
|
||||||
failed = @backup_history.select { |b| b[:status] == 'failed' }
|
|
||||||
failed.last(limit).reverse
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
# Get backup history for a specific container
|
|
||||||
def get_container_backup_history(container_name, limit = 20)
|
|
||||||
@mutex.synchronize do
|
|
||||||
container_backups = @backup_history.select { |b| b[:container_name] == container_name }
|
|
||||||
container_backups.last(limit).reverse
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
Loading…
Add table
Reference in a new issue