1
0
Fork 0
mirror of https://github.com/Luzifer/bind-log-metrics.git synced 2024-12-22 20:11:16 +00:00

Handle metrics errors, prevent blocking err chan

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2020-01-26 14:54:31 +01:00
parent 0c248599e0
commit 426bd3fb85
Signed by: luzifer
GPG key ID: DC2729FDD34BE99E

View file

@ -63,6 +63,12 @@ func main() {
log.WithError(err).Fatal("Unable to create metrics client") log.WithError(err).Fatal("Unable to create metrics client")
} }
go func() {
for err := range metrics.Errors() {
log.WithError(err).Error("Metrics processing caused an error")
}
}()
var input io.Reader = os.Stdin var input io.Reader = os.Stdin
if len(rconfig.Args()) > 1 { if len(rconfig.Args()) > 1 {
f, err := os.Open(rconfig.Args()[1]) f, err := os.Open(rconfig.Args()[1])