Closed
Bug 1306303
Opened 10 years ago
Closed 10 years ago
histogram_tools.Histogram.ranges returns histogram_tools.Histogram.labels.len + 1 buckets
Categories
(Toolkit :: Telemetry, defect)
Toolkit
Telemetry
Tracking
()
RESOLVED
WORKSFORME
People
(Reporter: frank, Unassigned)
References
Details
I'm not sure how to interpret the histogram_tools.Histogram.ranges() result for a categorical histogram. The Histogram.labels() returns the correct labels, but Histogram.ranges() returns a list with len(labels)+1 elements - [0, 1, ..., len(labels)].
It seems to me that the ranges() (and, by extension, Histogram.n_buckets()) should have the same length as labels.
Is the current implementation correct behavior?
Comment 1•10 years ago
|
||
Yup, this is expected. We add one: https://dxr.mozilla.org/mozilla-central/source/toolkit/components/telemetry/histogram_tools.py#403
| Reporter | ||
Comment 2•10 years ago
|
||
So what is the extra bucket for? For example, Histogram("TELEMETRY_TEST_CATEGORICAL", [2, 1, 0]) fails because it is expecting four elements, not three, though there are just three labels in the histogram.
Flags: needinfo?(chutten)
| Reporter | ||
Comment 3•10 years ago
|
||
To be clear, it fails because of a check that the instance ([2,1,0]) is the same length as n_buckets, which is 4 for a 3-label histogram.
| Reporter | ||
Comment 4•10 years ago
|
||
I just realized the bigger question: are n-label histograms going to have instances with n+1 elements? Is that what I'm missing?
| Reporter | ||
Updated•10 years ago
|
Flags: needinfo?(chutten)
Comment 5•10 years ago
|
||
Near as I can tell from https://developer.mozilla.org/en-US/docs/Mozilla/Performance/Adding_a_new_Telemetry_probe, it's to fix a common off-by-one error experienced by developers of enumerated and linear histograms (from which categorical inherited its structure and, apparently, its quirks).
Not sure that we absolutely _require_ it to be so. ni? :gfritzsche since he implemented them (bug 1188888)
Flags: needinfo?(gfritzsche)
Comment 6•10 years ago
|
||
This is intentional, we add an overflow bucket (+1 bucket) to the buckets, just like for the other enumerated & linear histograms.
We could argue about whether we should, but the current behavior is expected.
Feel free to morph this bug if you see an issue with this, otherwise lets close it as "works for me" or so.
Flags: needinfo?(gfritzsche)
Updated•10 years ago
|
Flags: needinfo?(fbertsch)
| Reporter | ||
Comment 7•10 years ago
|
||
Georg - I put this on the backburner as I'm working on some issues with ATMO at the moment. Let's keep it as is. My only question is, when I get a raw ping histogram, will it always have n+1 buckets?
Flags: needinfo?(fbertsch) → needinfo?(gfritzsche)
Comment 8•10 years ago
|
||
Yes, it will.
Status: NEW → RESOLVED
Closed: 10 years ago
Flags: needinfo?(gfritzsche)
Resolution: --- → WORKSFORME
You need to log in
before you can comment on or make changes to this bug.
Description
•