When there is no internet connection, go routines will be not closed in the plugin for the new relic.
That affects memory overflow and crashes system.
go func(g *model.Graph) {
log.Debug(fmt.Sprintf("Harvesting data from NewRelic API..."))
nr.fetchMetricsWithGraph(g, log)
isProcessed <- true
}(g)
for {
select {
case <-isProcessed:
nr.pluginHealth = model.HealthNormal
return *g, nil
case <-timeout:
log.Error("Timeout got from NewRelic provider...")
nr.pluginHealth = model.HealthWarning
return *g, nil
}
}