mirror of
				https://github.com/prometheus/node_exporter.git
				synced 2025-08-20 18:33:52 -07:00 
			
		
		
		
	Catch missing schedstat file (#1641)
Suppres error log noise if schedstat file doesn't exist. Signed-off-by: Ben Kochie <superq@gmail.com>
This commit is contained in:
		
							parent
							
								
									0107bc7942
								
							
						
					
					
						commit
						e49a13d0cf
					
				| 
						 | 
				
			
			@ -15,8 +15,10 @@ package collector
 | 
			
		|||
 | 
			
		||||
import (
 | 
			
		||||
	"fmt"
 | 
			
		||||
	"os"
 | 
			
		||||
 | 
			
		||||
	"github.com/go-kit/kit/log"
 | 
			
		||||
	"github.com/go-kit/kit/log/level"
 | 
			
		||||
	"github.com/prometheus/client_golang/prometheus"
 | 
			
		||||
	"github.com/prometheus/procfs"
 | 
			
		||||
)
 | 
			
		||||
| 
						 | 
				
			
			@ -68,6 +70,10 @@ func init() {
 | 
			
		|||
func (c *schedstatCollector) Update(ch chan<- prometheus.Metric) error {
 | 
			
		||||
	stats, err := c.fs.Schedstat()
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		if os.IsNotExist(err) {
 | 
			
		||||
			level.Debug(c.logger).Log("msg", "schedstat file does not exist")
 | 
			
		||||
			return ErrNoData
 | 
			
		||||
		}
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue