mirror of
				https://github.com/prometheus/node_exporter.git
				synced 2025-08-20 18:33:52 -07:00 
			
		
		
		
	Merge pull request #1983 from prometheus/superq/ENOTSUP
Handle errors from disabled PSI subsystem
This commit is contained in:
		
						commit
						dd99513e37
					
				| 
						 | 
					@ -5,6 +5,8 @@
 | 
				
			||||||
* [ENHANCEMENT]
 | 
					* [ENHANCEMENT]
 | 
				
			||||||
* [BUGFIX]
 | 
					* [BUGFIX]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					* [BUGFIX] Handle errors from disabled PSI subsystem #1983
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## 1.1.1 / 2021-02-12
 | 
					## 1.1.1 / 2021-02-12
 | 
				
			||||||
 | 
					
 | 
				
			||||||
* [BUGFIX] Fix ineffassign issue #1957
 | 
					* [BUGFIX] Fix ineffassign issue #1957
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -19,6 +19,7 @@ import (
 | 
				
			||||||
	"errors"
 | 
						"errors"
 | 
				
			||||||
	"fmt"
 | 
						"fmt"
 | 
				
			||||||
	"os"
 | 
						"os"
 | 
				
			||||||
 | 
						"syscall"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	"github.com/go-kit/kit/log"
 | 
						"github.com/go-kit/kit/log"
 | 
				
			||||||
	"github.com/go-kit/kit/log/level"
 | 
						"github.com/go-kit/kit/log/level"
 | 
				
			||||||
| 
						 | 
					@ -94,6 +95,10 @@ func (c *pressureStatsCollector) Update(ch chan<- prometheus.Metric) error {
 | 
				
			||||||
				level.Debug(c.logger).Log("msg", "pressure information is unavailable, you need a Linux kernel >= 4.20 and/or CONFIG_PSI enabled for your kernel")
 | 
									level.Debug(c.logger).Log("msg", "pressure information is unavailable, you need a Linux kernel >= 4.20 and/or CONFIG_PSI enabled for your kernel")
 | 
				
			||||||
				return ErrNoData
 | 
									return ErrNoData
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
								if errors.Is(err, syscall.ENOTSUP) {
 | 
				
			||||||
 | 
									level.Debug(c.logger).Log("msg", "pressure information is disabled, add psi=1 kernel command line to enable it")
 | 
				
			||||||
 | 
									return ErrNoData
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
			return fmt.Errorf("failed to retrieve pressure stats: %w", err)
 | 
								return fmt.Errorf("failed to retrieve pressure stats: %w", err)
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		switch res {
 | 
							switch res {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue