Skip to content

Commit

Permalink
fix(agent): add port logs.
Browse files Browse the repository at this point in the history
  • Loading branch information
Luiz Pegoraro committed Nov 27, 2023
1 parent 531b830 commit 0d0e404
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion agent/backend/pktvisor/pktvisor.go
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,16 @@ func (p *pktvisorBackend) Configure(logger *zap.Logger, repo policies.PolicyRepo
case "Host":
p.otelReceiverHost = v.(string)
case "Port":
p.otelReceiverPort = v.(int)
if v.(int) == 0 {
var err error
p.otelReceiverPort, err = p.getFreePort()
if err != nil {
p.logger.Error("pktvisor otlp startup error", zap.Error(err))
return err
}
} else {
p.otelReceiverPort = v.(int)
}
}
}
p.logger.Info("configured otel receiver host", zap.String("host", p.otelReceiverHost), zap.Int("port", p.otelReceiverPort))
Expand Down

0 comments on commit 0d0e404

Please sign in to comment.