* Fix evaluation when to recalculate metrics

* Rename "CalculateProcessScoreboard" to "CountProcessState"
This commit is contained in:
Enrico Stahn 2018-02-28 22:22:35 +11:00
parent 7e6f6c32c5
commit a00bd5b50d
No known key found for this signature in database
GPG key ID: 5263621C269A50DE
2 changed files with 5 additions and 5 deletions

View file

@ -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)

View file

@ -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