Skip to content

Commit

Permalink
Handle case where the sniffer could fail to start if the metrics port…
Browse files Browse the repository at this point in the history
… was taken by another process on the same node, due to hostNetwork
  • Loading branch information
orishoshan committed Oct 24, 2024
1 parent a646148 commit d7a6a61
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/sniffer/cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,11 @@ func main() {
errgrp.Go(func() error {
logrus.Debug("Started metrics server")
defer errorreporter.AutoNotify()
return metricsServer.Start(fmt.Sprintf(":%d", viper.GetInt(sharedconfig.PrometheusMetricsPortKey)))
err := metricsServer.Start(fmt.Sprintf(":%d", viper.GetInt(sharedconfig.PrometheusMetricsPortKey)))
if err != nil {
logrus.WithError(err).Error("Error when starting metrics server, however not returning an error as this may be due to the same port being used on the host node, and the sniffer runs in hostNetwork mode.")
}
return nil
})
logrus.Debug("Starting health server")
errgrp.Go(func() error {
Expand Down

0 comments on commit d7a6a61

Please sign in to comment.