Closed Bug 763524 Opened 13 years ago Closed 13 years ago

give each saved ping its own file under a telemetry holding directory

Categories

(Toolkit :: Telemetry, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla17

People

(Reporter: froydnj, Assigned: froydnj)

References

Details

Attachments

(3 files, 1 obsolete file)

No description provided.
Blocks: 748520
Bug 753238 is adding some ASCII encoding stuff that would be mighty useful here, so waiting until that goes in.
Depends on: 753238
No longer depends on: 748517
Attachment #640591 - Flags: review?(taras.mozilla)
Attachment #640592 - Flags: review?(taras.mozilla)
I freely note here that we do lose the saved old-format ping in the sense that we no longer send it or read it in. I don't think it's worth keeping old code around and this is a small one-time loss of data, so I wasn't terribly concerned about it. But if you're concerned, let me know and I'll adjust.
Attachment #640595 - Flags: review?(taras.mozilla)
Blocks: 772552
(In reply to Nathan Froyd (:froydnj) from comment #4) > Created attachment 640595 [details] [diff] [review] > part 3 - save pings to unique files > > I freely note here that we do lose the saved old-format ping in the sense > that we no longer send it or read it in. I don't think it's worth keeping > old code around and this is a small one-time loss of data, so I wasn't > terribly concerned about it. But if you're concerned, let me know and I'll > adjust. I'm not concerned. We should delete it, and do nothing else.
Comment on attachment 640591 [details] [diff] [review] part 1 - pass entire ping to doPing I like easy patches like this
Attachment #640591 - Flags: review?(taras.mozilla) → review+
Comment on attachment 640592 [details] part 2 - separate finishRequest out into its own function + if (file.exists()) { + file.remove(true); + } Don't use this pattern. Just .remove() directly and deal with exceptions if any. This almost doubles IO overhead with no gain.
Attachment #640592 - Flags: review?(taras.mozilla) → review+
Comment on attachment 640595 [details] [diff] [review] part 3 - save pings to unique files addToPendingPings needs a comment describing what it does. + this._pendingPings.push(data); + this._pingLoadsCompleted++; these also need documenting at declarations site s/ensurePingDirectoryExists/ensurePingDirectory/ + // Note that addToPendingPings relies on the callback(s) here from + // multiple calls to loadHistogram being called all on the same + // thread. Code is less confusing without this comment + file.append(checksum); Use uuid for filename to avoid redundant io. r- because this patch is creating too many files There should only ever be one pending ping to save which would overwrite previously saved ping.
Attachment #640595 - Flags: review?(taras.mozilla) → review-
Attachment #640595 - Attachment is obsolete: true
Attachment #641102 - Flags: review?(taras.mozilla)
Comment on attachment 641102 [details] [diff] [review] part 3 - save pings to unique files + verifyPingChecksum: function verifyPingChecksum(ping) { + if (!ping.checksum) { + return true; + } + + let checksumNow = this.hashString(ping.payload); + return ping.checksum == checksumNow; }, This needs a comment on why sometimes there is no checksum Why would you have multiple pending pings? Is this just in preparation for future work?
Attachment #641102 - Flags: review?(taras.mozilla)
(In reply to Taras Glek (:taras) from comment #10) > Why would you have multiple pending pings? Is this just in preparation for > future work? It is unlikely that we'd have them now (the examples of unreachable metrics servers, either via downtime or lack of network connectivity, won't supply multiple pending pings until another bug is fixed), but an (contrived?) example goes something like: - User starts Firefox; - User shuts down Firefox in < 5 minutes, so the initial idle ping never gets sent; - We therefore save statistics from that session; - Repeat as often as you like; we continue to save pings at shutdown; - User finally runs a session where the initial ping gets sent, and so sends off multiple pings from previous sessions. I thought this was the sort of motivating example for doing this work, since telemetry suggested we have users starting and stopping Firefox in short bursts. The save-ping-to-prearranged-file approach we had would therefore lose data in such a scenario. If you find such a scenario unconvincing, then yes, you can think of it as preparation for future work. But I don't understand why it's a problem now, since pendingPings has been an array to prepare for this sort of an eventuality for a while now.
Comment on attachment 641102 [details] [diff] [review] part 3 - save pings to unique files Thanks for the explanation. Please comment verifyPingChecksum.
Attachment #641102 - Flags: review+
Depends on: 775719
FYI this doesn't work. The directory is created mode 0600, which makes it inaccessible, so it can't write to it. I discovered this because my profile backups are complaining that they can't read it to back it up every night. The directory should be mode 0700.
Blocks: 781152
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: