mirror of
https://github.com/gravitl/netmaker.git
synced 2025-11-10 00:30:37 +08:00
fix metric exporter mq connection issue (#2925)
This commit is contained in:
parent
33846a5124
commit
86fac41868
1 changed files with 4 additions and 1 deletions
|
|
@ -195,7 +195,10 @@ func PushMetricsToExporter(metrics models.Metrics) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.New("failed to marshal metrics: " + err.Error())
|
return errors.New("failed to marshal metrics: " + err.Error())
|
||||||
}
|
}
|
||||||
if token := mqclient.Publish("metrics_exporter", 2, true, data); !token.WaitTimeout(MQ_TIMEOUT*time.Second) || token.Error() != nil {
|
if mqclient == nil || !mqclient.IsConnectionOpen() {
|
||||||
|
return errors.New("cannot publish ... mqclient not connected")
|
||||||
|
}
|
||||||
|
if token := mqclient.Publish("metrics_exporter", 0, true, data); !token.WaitTimeout(MQ_TIMEOUT*time.Second) || token.Error() != nil {
|
||||||
var err error
|
var err error
|
||||||
if token.Error() == nil {
|
if token.Error() == nil {
|
||||||
err = errors.New("connection timeout")
|
err = errors.New("connection timeout")
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue