Closed Bug 748907 Opened 14 years ago Closed 14 years ago

don't send no-data histograms

Categories

(Toolkit :: Telemetry, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla15

People

(Reporter: froydnj, Assigned: froydnj)

Details

Attachments

(1 file, 2 obsolete files)

Due to the way our persistent telemetry implementation works, we can have histograms instantiated that don't have any data in them. We then send those histograms in (and possibly persist them, so we're doomed forevermore!). This wastes space and time in many places. We should fix this to only reflect/send histograms with actual data in them.
Attached patch patch (obsolete) — — Splinter Review
Simple patch to do this. Doing it at the JS level is easier than doing it at the C++ level and naturally handles normal pings and persisted pings. I don't have good tests for this. The added bits in test_TelemetryPing.js are half-hearted (and associated changes for sending addon histograms), as addon histograms don't get created until they have data anyway. At least all the histograms that the tests are checking for *do* get sent, so we have some degree of confidence this won't totally bork our telemetry data.
Attachment #621045 - Flags: review?(taras.mozilla)
Comment on attachment 621045 [details] [diff] [review] patch I think the right way to do this is on the C++ side. That would work automatically for about:telemetry, etc
Attachment #621045 - Flags: review?(taras.mozilla) → review-
Attached patch patch (obsolete) — — Splinter Review
Ended up being simpler on the C++ side. Efficiency? What's that?
Attachment #621045 - Attachment is obsolete: true
Attachment #622080 - Flags: review?(taras.mozilla)
Comment on attachment 622080 [details] [diff] [review] patch HasInterestingData -> IsEmpty() + for (size_t n = h->bucket_count(), i = 0; i < n; ++i) { + if (ss.counts(i) != 0) { + return true; + } + } Pretty sure you can do .sum() || ss.counts(0) != 0 to skip the loop + // We don't check HasInterestingData here. We discard no-data + // histograms on read-in, instead. It's easier to write out the + // number of histograms required that way. (The pickle interface + // doesn't make it easy to go back and overwrite previous data.) + <-- should put a todo here or just remember to remove this comment when we serialize things properly This needs a test, doing a gethistogrambyid to initiate a histogram and then .histogramSnapshots to check that it's not present should be sufficient
Attachment #622080 - Flags: review?(taras.mozilla) → review-
(In reply to Taras Glek (:taras) from comment #4) > HasInterestingData -> IsEmpty() *shrug* > + for (size_t n = h->bucket_count(), i = 0; i < n; ++i) { > + if (ss.counts(i) != 0) { > + return true; > + } > + } > > Pretty sure you can do .sum() || ss.counts(0) != 0 to skip the loop That's a good point. See? Hard to tell about efficiency concerns. > + // We don't check HasInterestingData here. We discard no-data > + // histograms on read-in, instead. It's easier to write out the > + // number of histograms required that way. (The pickle interface > + // doesn't make it easy to go back and overwrite previous data.) > + <-- should put a todo here or just remember to remove this comment when we > serialize things properly When we serialize things properly (wherever the persistent-data-in-JS bug is), all this code is going away. > This needs a test, doing a gethistogrambyid to initiate a histogram and then > .histogramSnapshots to check that it's not present should be sufficient Ah, yes. Tests.
Attached patch patch — — Splinter Review
Updated, with tests. Removed the comment about addon histograms, because we can hit that check even if the addon's histogram has been created, of course.
Attachment #622080 - Attachment is obsolete: true
Attachment #622387 - Flags: review?(taras.mozilla)
Comment on attachment 622387 [details] [diff] [review] patch > > > + for (size_t n = h->bucket_count(), i = 0; i < n; ++i) { > > + if (ss.counts(i) != 0) { > > + return true; > > + } > > + } > > > > Pretty sure you can do .sum() || ss.counts(0) != 0 to skip the loop > > That's a good point. See? Hard to tell about efficiency concerns. I think it's a pretty easy call when you end up with less code that does less + // We don't check HasInterestingData here. We discard no-data ^--- fixme
Attachment #622387 - Flags: review?(taras.mozilla) → review+
Assignee: nobody → nfroyd
Status: NEW → ASSIGNED
Target Milestone: --- → mozilla15
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: