Bug 1345108 - Reduce resolution for timestamp in crashreporter's crash pings. r?ted draft
authorAlessio Placitelli <alessio.placitelli@gmail.com>
Mon, 03 Apr 2017 17:38:29 +0200
changeset 555063 c7c00cbe2785b3d090632640fb71d91368b66b44
parent 554958 aaa0cd3bd620daf6be29c72625f6e63fd0bc1d46
child 622522 11b2b354a2b7c822ccb465571a421ba879cdafd9
push id52143
push useralessio.placitelli@gmail.com
push dateMon, 03 Apr 2017 15:54:44 +0000
reviewersted
bugs1345108
milestone55.0a1
Bug 1345108 - Reduce resolution for timestamp in crashreporter's crash pings. r?ted MozReview-Commit-ID: 5BA51mWlkqW
toolkit/components/telemetry/docs/data/crash-ping.rst
toolkit/crashreporter/client/ping.cpp
--- a/toolkit/components/telemetry/docs/data/crash-ping.rst
+++ b/toolkit/components/telemetry/docs/data/crash-ping.rst
@@ -65,16 +65,21 @@ Structure:
           TotalVirtualMemory: <size>, // Windows-only, virtual memory in use
           UptimeTS: <duration>, // Seconds since Firefox was started
           User32BeforeBlocklist: 1, // Windows-only, present only if user32.dll was loaded before the DLL blocklist has been initialized
         },
         hasCrashEnvironment: bool
       }
     }
 
+.. note::
+
+  For "crash" pings generated by the crashreporter we are deliberately truncating the ``creationDate``
+  to hours. See bug 1345108 for context.
+
 Process Types
 -------------
 
 The ``processType`` field contains the type of process that crashed. There are
 currently multiple process types defined in ``nsICrashService`` but crash pings
 are sent only for the ones below:
 
 +---------------+---------------------------------------------------+
--- a/toolkit/crashreporter/client/ping.cpp
+++ b/toolkit/crashreporter/client/ping.cpp
@@ -90,22 +90,21 @@ GenerateUUID()
     return "";
   }
 
   return str;
 }
 
 const char kISO8601Date[] = "%F";
 const char kISO8601DateHours[] = "%FT%H:00:00.000Z";
-const char kISO8601FullDate[] = "%FT%T.000Z";
 
 // Return the current date as a string in the specified format, the following
 // constants are provided:
 // - kISO8601Date, the ISO 8601 date format, YYYY-MM-DD
-// - kISO8601FullDate, the ISO 8601 full date format, YYYY-MM-DDTHH:MM:SS.000Z
+// - kISO8601DateHours, the ISO 8601 full date format, YYYY-MM-DDTHH:00:00.000Z
 static string
 CurrentDate(string format)
 {
   time_t now;
   time(&now);
   char buf[64]; // This should be plenty
   strftime(buf, sizeof buf, format.c_str(), gmtime(&now));
   return buf;
@@ -225,17 +224,17 @@ CreateRootNode(StringTable& strings, con
                const string& aClientId, const string& aSessionId,
                const string& aName, const string& aVersion,
                const string& aChannel, const string& aBuildId)
 {
   Json::Value root;
   root["type"] = "crash"; // This is a crash ping
   root["id"] = aUuid;
   root["version"] = kTelemetryVersion;
-  root["creationDate"] = CurrentDate(kISO8601FullDate);
+  root["creationDate"] = CurrentDate(kISO8601DateHours);
   root["clientId"] = aClientId;
 
   // Parse the telemetry environment
   Json::Value environment;
   Json::Reader reader;
   string architecture;
   string xpcomAbi;