Problem/Motivation
Collectors emit both an unlabeled total AND per-label metrics, causing sum() queries in Prometheus to return incorrect results.
Affected collectors:
- NodeCount / RevisionCount
- UserCount
- CommentCollector
For example:
# HELP drupal_revision_count_total Total revision count.
# TYPE drupal_revision_count_total gauge
drupal_revision_count_total 1
drupal_revision_count_total{bundle="article"} 1
drupal_revision_count_total{bundle="page"} 0
When I do a sum(drupal_revision_count_total) I'll get the count of 1 with no labels, but also the count for the bundle="article".
Proposed resolution
Only emit labeled metrics when labels are configured. This follows Prometheus best practices.
- NodeCount/RevisionCount: emit per-bundle metrics only when bundles configured, otherwise emit unlabeled total
- UserCount: emit only activated/blocked labeled metrics
- CommentCollector: emit only published/not published labeled metrics
Remaining tasks
User interface changes
API changes
Data model changes
Comments
Comment #4
kim.pepperMR ready for review.
Updated IS and title
Comment #6
kim.pepperCommitted to 2.x