log when exporter works again

This commit is contained in:
David 2022-02-07 22:03:08 -05:00
parent 6131333a93
commit 385894d3c6

View File

@ -66,9 +66,11 @@ func errLog(err error) {
opsZPosition.Set(0)
opsBed.Set(0)
opsNozzle.Set(0)
if errCount > 5 {
if errCount == 5 {
log.Printf("suppressing further error logging")
return
} else if errCount > 5 {
return
}
log.Printf("error retrieving telemetry: %v", err)
}
@ -98,6 +100,9 @@ func recordMetrics(ctx context.Context, config Config) {
errLog(err)
break
}
if errCount != 0 {
log.Printf("connection established")
}
errCount = 0
opsFlowFactor.Set(float64(t.FlowFactor))
opsPrintSpeed.Set(float64(t.PrintingSpeed))