* Fix evaluation when to recalculate metrics
* Rename "CalculateProcessScoreboard" to "CountProcessState"
This commit is contained in:
parent
7e6f6c32c5
commit
a00bd5b50d
2 changed files with 5 additions and 5 deletions
|
@ -57,7 +57,7 @@ to quickly create a Cobra application.`,
|
|||
|
||||
if fixProcessCount {
|
||||
log.Info("Idle/Active/Total Processes will be calculated by php-fpm_exporter.")
|
||||
exporter.CalculateProcessScoreboard = true
|
||||
exporter.CountProcessState = true
|
||||
}
|
||||
|
||||
prometheus.MustRegister(exporter)
|
||||
|
|
|
@ -30,7 +30,7 @@ type Exporter struct {
|
|||
mutex sync.Mutex
|
||||
PoolManager PoolManager
|
||||
|
||||
CalculateProcessScoreboard bool
|
||||
CountProcessState bool
|
||||
|
||||
up *prometheus.Desc
|
||||
scrapeFailues *prometheus.Desc
|
||||
|
@ -56,7 +56,7 @@ func NewExporter(pm PoolManager) *Exporter {
|
|||
return &Exporter{
|
||||
PoolManager: pm,
|
||||
|
||||
CalculateProcessScoreboard: false,
|
||||
CountProcessState: false,
|
||||
|
||||
up: prometheus.NewDesc(
|
||||
prometheus.BuildFQName(namespace, "", "up"),
|
||||
|
@ -179,11 +179,11 @@ func (e *Exporter) Collect(ch chan<- prometheus.Metric) {
|
|||
}
|
||||
|
||||
active, idle, total := CountProcessState(pool.Processes)
|
||||
if !e.CalculateProcessScoreboard && (active != pool.ActiveProcesses || idle != pool.IdleProcesses) {
|
||||
if !e.CountProcessState && (active != pool.ActiveProcesses || idle != pool.IdleProcesses) {
|
||||
log.Error("Inconsistent active and idle processes reported. Set `--fix-process-count` to have this calculated by php-fpm_exporter instead.")
|
||||
}
|
||||
|
||||
if e.CalculateProcessScoreboard {
|
||||
if !e.CountProcessState {
|
||||
active = pool.ActiveProcesses
|
||||
idle = pool.IdleProcesses
|
||||
total = pool.TotalProcesses
|
||||
|
|
Loading…
Reference in a new issue