Bug 1155272 - Add Telemetry probes for time to send a ping. r=vladan

This commit is contained in:
jkang8 2015-05-19 18:19:14 -04:00
parent 307a087c72
commit dac0c30d95
2 changed files with 30 additions and 0 deletions

View File

@ -4388,6 +4388,14 @@
"n_values": 30,
"description": "Number of telemetry pings evicted at startup"
},
"TELEMETRY_COMPRESS": {
"expires_in_version": "never",
"kind": "exponential",
"high": "3000",
"n_buckets": 10,
"extended_statistics_ok": true,
"description": "Time taken to compress telemetry object (ms)"
},
"TELEMETRY_PING": {
"expires_in_version": "never",
"kind": "exponential",
@ -4396,6 +4404,22 @@
"extended_statistics_ok": true,
"description": "Time taken to submit telemetry info (ms)"
},
"TELEMETRY_SEND" : {
"expires_in_version": "never",
"kind": "exponential",
"high": "3000",
"n_buckets": 10,
"extended_statistics_ok": true,
"description": "Time to send the compressed string to the Telemetry servers and get a reply back (ms)"
},
"TELEMETRY_STRINGIFY" : {
"expires_in_version": "never",
"kind": "exponential",
"high": "3000",
"n_buckets": 10,
"extended_statistics_ok": true,
"description": "Time to stringify telemetry object (ms)"
},
"TELEMETRY_SUCCESS": {
"expires_in_version": "never",
"kind": "boolean",

View File

@ -790,6 +790,7 @@ let Impl = {
onPingRequestFinished: function(success, startTime, ping, isPersisted) {
this._log.trace("onPingRequestFinished - success: " + success + ", persisted: " + isPersisted);
Telemetry.getHistogramById("TELEMETRY_SEND").add(new Date() - startTime);
let hping = Telemetry.getHistogramById("TELEMETRY_PING");
let hsuccess = Telemetry.getHistogramById("TELEMETRY_SUCCESS");
@ -923,11 +924,16 @@ let Impl = {
let converter = Cc["@mozilla.org/intl/scriptableunicodeconverter"]
.createInstance(Ci.nsIScriptableUnicodeConverter);
converter.charset = "UTF-8";
startTime = new Date();
let utf8Payload = converter.ConvertFromUnicode(JSON.stringify(networkPayload));
utf8Payload += converter.Finish();
Telemetry.getHistogramById("TELEMETRY_STRINGIFY").add(new Date() - startTime);
let payloadStream = Cc["@mozilla.org/io/string-input-stream;1"]
.createInstance(Ci.nsIStringInputStream);
startTime = new Date();
payloadStream.data = this.gzipCompressString(utf8Payload);
Telemetry.getHistogramById("TELEMETRY_COMPRESS").add(new Date() - startTime);
startTime = new Date();
request.send(payloadStream);
return deferred.promise;