@@ -22,6 +22,7 @@ import (
2222 "fmt"
2323 jsoniter "github.com/json-iterator/go"
2424 "github.com/netobserv/flowlogs2metrics/pkg/config"
25+ "github.com/netobserv/flowlogs2metrics/pkg/health"
2526 "github.com/netobserv/flowlogs2metrics/pkg/pipeline"
2627 "github.com/netobserv/flowlogs2metrics/pkg/pipeline/utils"
2728 log "github.com/sirupsen/logrus"
@@ -128,6 +129,7 @@ func initFlags() {
128129 rootCmd .PersistentFlags ().StringVar (& cfgFile , "config" , "" , fmt .Sprintf ("config file (default is $HOME/%s)" , defaultLogFileName ))
129130 rootCmd .PersistentFlags ().StringVar (& logLevel , "log-level" , "error" , "Log level: debug, info, warning, error" )
130131 rootCmd .PersistentFlags ().StringVar (& config .Opt .PipeLine .Ingest .Type , "pipeline.ingest.type" , "" , "Ingest type: file, collector,file_loop (required)" )
132+ rootCmd .PersistentFlags ().StringVar (& config .Opt .Health .Port , "health.port" , "8080" , "Health server port" )
131133 rootCmd .PersistentFlags ().StringVar (& config .Opt .PipeLine .Ingest .File .Filename , "pipeline.ingest.file.filename" , "" , "Ingest filename (file)" )
132134 rootCmd .PersistentFlags ().StringVar (& config .Opt .PipeLine .Ingest .Collector , "pipeline.ingest.collector" , "" , "Ingest collector API" )
133135 rootCmd .PersistentFlags ().StringVar (& config .Opt .PipeLine .Ingest .Kafka , "pipeline.ingest.kafka" , "" , "Ingest Kafka API" )
@@ -160,23 +162,29 @@ func run() {
160162 mainPipeline * pipeline.Pipeline
161163 )
162164
163- // Starting log message
165+ // Initial log message
164166 fmt .Printf ("%s starting - version [%s]\n \n " , filepath .Base (os .Args [0 ]), Version )
165- // Dump the configuration
167+
168+ // Dump configuration
166169 dumpConfig ()
167170
171+ // Setup (threads) exit manager
168172 utils .SetupElegantExit ()
169173
170- // creating a new pipeline
174+ // Create new flows pipeline
171175 mainPipeline , err = pipeline .NewPipeline ()
172176 if err != nil {
173177 log .Fatalf ("failed to initialize pipeline %s" , err )
174178 os .Exit (1 )
175179 }
176180
181+ // Starts the flows pipeline
177182 mainPipeline .Run ()
178183
179- // give all threads a chance to exit and then exit the process
184+ // Start health report server
185+ health .NewHealthServer (mainPipeline )
186+
187+ // Give all threads a chance to exit and then exit the process
180188 time .Sleep (time .Second )
181189 log .Debugf ("exiting main run" )
182190 os .Exit (0 )
0 commit comments