Page MenuHomePhabricator

MediaWiki: Define new metric type - Histogram
Closed, ResolvedPublic

Description

Task to implement proposal found in T344751#9247383

The handful of timing metrics we have (and actively make use of) vary a lot in their range. I'm not sure a single set can be of much use. The size and range of timing measures vary a lot throughout the platform, from job measures in the range between whole seconds and hours, to WANCache callbacks that are measures between 0.1 and 100 milliseconds.

To handle cases where a custom range of histogram buckets are needed, there should be a metric type that generates histograms based on a hardcoded set of buckets.

This task is complete when MediaWiki StatsLib can produce histograms in a set of counters following guidance provided by the Prometheus team.

Event Timeline

lmata subscribed.

Scheduling this into the future unless there's a need to address this now. Please advise otherwise.

Change #1063064 had a related patch set uploaded (by Cwhite; author: Cwhite):

[mediawiki/core@master] Stats: add special bucket attribute to CounterMetric

https://gerrit.wikimedia.org/r/1063064

Change #1063065 had a related patch set uploaded (by Cwhite; author: Cwhite):

[mediawiki/core@master] Stats: implement HistogramMetric

https://gerrit.wikimedia.org/r/1063065

colewhite changed the task status from Open to In Progress.Aug 16 2024, 5:07 PM
colewhite claimed this task.
colewhite triaged this task as Medium priority.

Adding this as a blocker for T382003: (mw.track) Migrate timing.growthExperiments.* to statslib as we have one metric there that is tracking bytes and used to use timing with Graphite.

Change #1115973 had a related patch set uploaded (by Cwhite; author: Cwhite):

[mediawiki/extensions/WikibaseQualityConstraints@master] update isSubclassOf_entities_total to Histogram type

https://gerrit.wikimedia.org/r/1115973

Adding this as a blocker for T382003: (mw.track) Migrate timing.growthExperiments.* to statslib as we have one metric there that is tracking bytes and used to use timing with Graphite.

Parsoid also has a number of bytes-bases metrics (wikitext size, html size, etc). We use a "fake timing" method for these right now, but it would be nice to be able to shift these to a more appropriate type.

Is this task stalled? Parsoid is having trouble migrating its byte-count metrics to prometheus so this is a blocker for us at this time. I note that @Michael's blocker seems to have been solved by adding bucket support to the JavaScript side in mw.track, but we really need PHP-side support.

colewhite changed the task status from In Progress to Stalled.Apr 15 2025, 7:49 PM

Is this task stalled? Parsoid is having trouble migrating its byte-count metrics to prometheus so this is a blocker for us at this time. I note that @Michael's blocker seems to have been solved by adding bucket support to the JavaScript side in mw.track, but we really need PHP-side support.

Yes, still waiting on code review for the linked patches.

Change #1063064 merged by jenkins-bot:

[mediawiki/core@master] Stats: add special bucket attribute to MetricTrait

https://gerrit.wikimedia.org/r/1063064

Change #1137332 had a related patch set uploaded (by Cwhite; author: Cwhite):

[mediawiki/core@master] stats: limit number of definable buckets for Histograms

https://gerrit.wikimedia.org/r/1137332

Change #1063065 merged by jenkins-bot:

[mediawiki/core@master] Stats: implement HistogramMetric

https://gerrit.wikimedia.org/r/1063065

Change #1137332 merged by jenkins-bot:

[mediawiki/core@master] stats: limit number of definable buckets for Histograms

https://gerrit.wikimedia.org/r/1137332

The feature has landed. Thanks, all!

Change #1138915 had a related patch set uploaded (by C. Scott Ananian; author: C. Scott Ananian):

[mediawiki/core@master] HistogramMetric: Allow specifying buckets with a single mean value

https://gerrit.wikimedia.org/r/1138915

Change #1138915 merged by jenkins-bot:

[mediawiki/core@master] Stats: Allow specifying histogram buckets via a mean value and skip

https://gerrit.wikimedia.org/r/1138915

Change #1192296 had a related patch set uploaded (by Krinkle; author: Krinkle):

[mediawiki/core@master] Stats: Encourage start() or observeNanoseconds()

https://gerrit.wikimedia.org/r/1192296