11package analyzer
22
33import (
4+ "fmt"
45 "log/slog"
56 "maps"
67 "math"
@@ -9,6 +10,7 @@ import (
910 "path/filepath"
1011 "slices"
1112 "sort"
13+ "strings"
1214 "sync"
1315 "time"
1416
@@ -50,9 +52,15 @@ var CMD = &cobra.Command{
5052 }
5153
5254 fileDirectory := configs .Values .Analyzer .LogFilesDirectory
53- files , err := os .ReadDir (fileDirectory )
55+ filesAll , err := os .ReadDir (fileDirectory )
5456 if err != nil {
55- return err
57+ return fmt .Errorf ("could not read logs directory: %w" , err )
58+ }
59+ files := make ([]os.DirEntry , 0 , len (filesAll ))
60+ for _ , file := range filesAll {
61+ if strings .HasSuffix (file .Name (), ".log" ) {
62+ files = append (files , file )
63+ }
5664 }
5765
5866 var (
@@ -102,8 +110,8 @@ var CMD = &cobra.Command{
102110 case <- progressTicker .C :
103111 slog .
104112 With ("count" , len (files )).
105- With ("filesSizeMB " , math .Round (totalFileSizeMB )).
106- Info ("⏳⏳⏳ processing file(s)..." )
113+ With ("totalSizeMB " , math .Round (totalFileSizeMB )).
114+ Info ("⏳⏳⏳ still processing file(s)..." )
107115 case peerRecord , isOpen := <- peerRecordsChan :
108116 if isOpen {
109117 peersReport .AddRecord (peerRecord )
@@ -283,7 +291,8 @@ func analyzeFile(
283291 peerRecordChan chan <- report.PeerRecord ,
284292 clientRecordChan chan <- report.ClientRecord ,
285293 operatorRecordChan chan <- map [uint32 ]report.OperatorRecord ,
286- errorChan chan <- error ) {
294+ errorChan chan <- error ,
295+ ) {
287296 clientAnalyzer , err := client .New (filePath , time .Millisecond * 800 )
288297 if err != nil {
289298 errorChan <- err
@@ -319,19 +328,16 @@ func analyzeFile(
319328 return
320329 }
321330
322- analyzerSvc , err := New (
331+ analyzerSvc := New (
323332 peersAnalyzer ,
324333 consensusAnalyzer ,
325334 operatorAnalyzer ,
326335 clientAnalyzer ,
327336 commitAnalyzer ,
328337 prepareAnalyzer ,
329338 configs .Values .Analyzer .Operators ,
330- configs .Values .Analyzer .Cluster )
331- if err != nil {
332- errorChan <- err
333- return
334- }
339+ configs .Values .Analyzer .Cluster ,
340+ )
335341
336342 result , err := analyzerSvc .Start ()
337343 if err != nil {
0 commit comments