Skip to content

Commit 2f163bc

Browse files
authored
Prevent panic if didn't find patterns (#122)
1 parent 9077c3f commit 2f163bc

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

tools/sift.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,10 @@ func findErrorPatternLogs(ctx context.Context, args FindErrorPatternLogsParams)
304304

305305
datasourceUID := completedInvestigation.Datasources.LokiDatasource.UID
306306

307+
if errorPatternLogsAnalysis.Result.Details == nil {
308+
// No patterns found, return the analysis without examples
309+
return errorPatternLogsAnalysis, nil
310+
}
307311
for _, pattern := range errorPatternLogsAnalysis.Result.Details["patterns"].([]any) {
308312
patternMap, ok := pattern.(map[string]any)
309313
if !ok {

0 commit comments

Comments
 (0)