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 (#249)
  • Loading branch information
orishoshan authored Oct 24, 2024
1 parent a646148 commit d201ddd
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 d201ddd

Please sign in to comment.