mirror of
https://github.com/openobserve/openobserve.git
synced 2026-11-04 00:08:55 +00:00
fix: add safety check to metrics cleanup to prevent accidental deletion
Add validation to ensure patterns array is not empty before attempting to clean up metrics streams. This prevents accidental deletion of all metrics streams if the method is called without proper patterns. Safety improvement for cleanupMetricsStreams() method. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.5
parent
0a8d1e4312
commit
626e7bd9fa
@@ -1039,6 +1039,12 @@ class APICleanup {
|
||||
protectedStreams
|
||||
});
|
||||
|
||||
// Safety check: If no patterns provided, don't delete anything
|
||||
if (patterns.length === 0) {
|
||||
testLogger.info('No patterns provided for metrics cleanup - skipping');
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
// Fetch all metrics streams
|
||||
const streams = await this.fetchMetricsStreams();
|
||||
|
||||
Reference in New Issue
Block a user