From d9f48d397daa94c163e6f795b32bea31456744e0 Mon Sep 17 00:00:00 2001 From: fractalwrench Date: Mon, 19 Oct 2020 16:16:36 +0100 Subject: [PATCH] feat: increase breadcrumb time precision to milliseconds --- CHANGELOG.md | 7 +++++++ .../src/main/java/com/bugsnag/android/DateUtils.java | 2 +- .../src/test/resources/breadcrumb_serialization_0.json | 2 +- .../src/test/resources/breadcrumb_serialization_1.json | 2 +- .../test/resources/breadcrumb_state_serialization_0.json | 2 +- .../src/test/resources/device_data_serialization_1.json | 2 +- .../src/test/resources/event_redaction.json | 4 ++-- .../src/test/resources/event_serialization_0.json | 2 +- .../src/test/resources/event_serialization_1.json | 2 +- .../src/test/resources/event_serialization_2.json | 2 +- .../src/test/resources/event_serialization_3.json | 2 +- .../src/test/resources/event_serialization_4.json | 4 ++-- .../src/test/resources/event_serialization_5.json | 2 +- .../src/test/resources/event_serialization_6.json | 4 ++-- bugsnag-android-core/src/test/resources/json_stream.json | 2 +- .../src/test/resources/session_serialization_0.json | 2 +- .../java/com/bugsnag/android/BreadcrumbSerializerTest.java | 2 +- .../java/com/bugsnag/android/DeviceSerializerTest.java | 2 +- 18 files changed, 27 insertions(+), 20 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4af81958dd..eef6f5a2bf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## TBD + +### Bug fixes + +* Increase breadcrumb time precision to milliseconds + [#954](https://github.com/bugsnag/bugsnag-android/pull/954) + ## 5.2.2 (2020-10-19) ### Bug fixes diff --git a/bugsnag-android-core/src/main/java/com/bugsnag/android/DateUtils.java b/bugsnag-android-core/src/main/java/com/bugsnag/android/DateUtils.java index ff6cdab163..406e16d19b 100644 --- a/bugsnag-android-core/src/main/java/com/bugsnag/android/DateUtils.java +++ b/bugsnag-android-core/src/main/java/com/bugsnag/android/DateUtils.java @@ -16,7 +16,7 @@ class DateUtils { @Override protected DateFormat initialValue() { TimeZone tz = TimeZone.getTimeZone("UTC"); - DateFormat iso8601 = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'", Locale.US); + DateFormat iso8601 = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", Locale.US); iso8601.setTimeZone(tz); return iso8601; } diff --git a/bugsnag-android-core/src/test/resources/breadcrumb_serialization_0.json b/bugsnag-android-core/src/test/resources/breadcrumb_serialization_0.json index 4539593035..54e639e08f 100644 --- a/bugsnag-android-core/src/test/resources/breadcrumb_serialization_0.json +++ b/bugsnag-android-core/src/test/resources/breadcrumb_serialization_0.json @@ -1,5 +1,5 @@ { - "timestamp": "1970-01-01T00:00:00Z", + "timestamp": "1970-01-01T00:00:00.000Z", "name": "helloworld", "type": "manual", "metaData": {} diff --git a/bugsnag-android-core/src/test/resources/breadcrumb_serialization_1.json b/bugsnag-android-core/src/test/resources/breadcrumb_serialization_1.json index b5af851693..6df6abe4ed 100644 --- a/bugsnag-android-core/src/test/resources/breadcrumb_serialization_1.json +++ b/bugsnag-android-core/src/test/resources/breadcrumb_serialization_1.json @@ -1,5 +1,5 @@ { - "timestamp": "1970-01-01T00:00:00Z", + "timestamp": "1970-01-01T00:00:00.000Z", "name": "metadata", "type": "process", "metaData": { diff --git a/bugsnag-android-core/src/test/resources/breadcrumb_state_serialization_0.json b/bugsnag-android-core/src/test/resources/breadcrumb_state_serialization_0.json index f5c28396c6..6151953caa 100644 --- a/bugsnag-android-core/src/test/resources/breadcrumb_state_serialization_0.json +++ b/bugsnag-android-core/src/test/resources/breadcrumb_state_serialization_0.json @@ -1,6 +1,6 @@ [ { - "timestamp": "1970-01-01T00:00:00Z", + "timestamp": "1970-01-01T00:00:00.000Z", "name": "helloworld", "type": "manual", "metaData": { diff --git a/bugsnag-android-core/src/test/resources/device_data_serialization_1.json b/bugsnag-android-core/src/test/resources/device_data_serialization_1.json index 58b6d874f9..d179e37ffa 100644 --- a/bugsnag-android-core/src/test/resources/device_data_serialization_1.json +++ b/bugsnag-android-core/src/test/resources/device_data_serialization_1.json @@ -17,5 +17,5 @@ "freeDisk": 120935100007, "freeMemory": 2234092234234, "orientation": "landscape", - "time": "1970-01-01T00:00:00Z" + "time": "1970-01-01T00:00:00.000Z" } \ No newline at end of file diff --git a/bugsnag-android-core/src/test/resources/event_redaction.json b/bugsnag-android-core/src/test/resources/event_redaction.json index 15ac42f05c..320549ad51 100644 --- a/bugsnag-android-core/src/test/resources/event_redaction.json +++ b/bugsnag-android-core/src/test/resources/event_redaction.json @@ -35,11 +35,11 @@ "freeDisk": 22234423124, "freeMemory": 92340255592, "orientation": "portrait", - "time": "1970-01-01T00:00:00Z" + "time": "1970-01-01T00:00:00.000Z" }, "breadcrumbs": [ { - "timestamp": "1970-01-01T00:00:00Z", + "timestamp": "1970-01-01T00:00:00.000Z", "name": "Whoops", "type": "log", "metaData": { diff --git a/bugsnag-android-core/src/test/resources/event_serialization_0.json b/bugsnag-android-core/src/test/resources/event_serialization_0.json index 91d6009c74..8a6e345dca 100644 --- a/bugsnag-android-core/src/test/resources/event_serialization_0.json +++ b/bugsnag-android-core/src/test/resources/event_serialization_0.json @@ -25,7 +25,7 @@ "freeDisk": 22234423124, "freeMemory": 92340255592, "orientation": "portrait", - "time": "1970-01-01T00:00:00Z" + "time": "1970-01-01T00:00:00.000Z" }, "breadcrumbs": [], "threads": [] diff --git a/bugsnag-android-core/src/test/resources/event_serialization_1.json b/bugsnag-android-core/src/test/resources/event_serialization_1.json index d3788bcbe4..92daa508d2 100644 --- a/bugsnag-android-core/src/test/resources/event_serialization_1.json +++ b/bugsnag-android-core/src/test/resources/event_serialization_1.json @@ -26,7 +26,7 @@ "freeDisk": 22234423124, "freeMemory": 92340255592, "orientation": "portrait", - "time": "1970-01-01T00:00:00Z" + "time": "1970-01-01T00:00:00.000Z" }, "breadcrumbs": [], "threads": [] diff --git a/bugsnag-android-core/src/test/resources/event_serialization_2.json b/bugsnag-android-core/src/test/resources/event_serialization_2.json index 9f17700a17..308f21abc3 100644 --- a/bugsnag-android-core/src/test/resources/event_serialization_2.json +++ b/bugsnag-android-core/src/test/resources/event_serialization_2.json @@ -25,7 +25,7 @@ "freeDisk": 22234423124, "freeMemory": 92340255592, "orientation": "portrait", - "time": "1970-01-01T00:00:00Z" + "time": "1970-01-01T00:00:00.000Z" }, "breadcrumbs": [], "groupingHash": "herpderp", diff --git a/bugsnag-android-core/src/test/resources/event_serialization_3.json b/bugsnag-android-core/src/test/resources/event_serialization_3.json index 9d83e87d76..1163b23339 100644 --- a/bugsnag-android-core/src/test/resources/event_serialization_3.json +++ b/bugsnag-android-core/src/test/resources/event_serialization_3.json @@ -25,7 +25,7 @@ "freeDisk": 22234423124, "freeMemory": 92340255592, "orientation": "portrait", - "time": "1970-01-01T00:00:00Z" + "time": "1970-01-01T00:00:00.000Z" }, "breadcrumbs": [], "threads": [] diff --git a/bugsnag-android-core/src/test/resources/event_serialization_4.json b/bugsnag-android-core/src/test/resources/event_serialization_4.json index 96cc0187ae..275b880b64 100644 --- a/bugsnag-android-core/src/test/resources/event_serialization_4.json +++ b/bugsnag-android-core/src/test/resources/event_serialization_4.json @@ -25,13 +25,13 @@ "freeDisk": 22234423124, "freeMemory": 92340255592, "orientation": "portrait", - "time": "1970-01-01T00:00:00Z" + "time": "1970-01-01T00:00:00.000Z" }, "breadcrumbs": [], "threads": [], "session": { "id": "123", - "startedAt": "1970-01-01T00:00:00Z", + "startedAt": "1970-01-01T00:00:00.000Z", "events": { "handled": 0, "unhandled": 0 diff --git a/bugsnag-android-core/src/test/resources/event_serialization_5.json b/bugsnag-android-core/src/test/resources/event_serialization_5.json index c2e9b82170..cbc8d73f3b 100644 --- a/bugsnag-android-core/src/test/resources/event_serialization_5.json +++ b/bugsnag-android-core/src/test/resources/event_serialization_5.json @@ -25,7 +25,7 @@ "freeDisk": 22234423124, "freeMemory": 92340255592, "orientation": "portrait", - "time": "1970-01-01T00:00:00Z" + "time": "1970-01-01T00:00:00.000Z" }, "breadcrumbs": [], "threads": [ diff --git a/bugsnag-android-core/src/test/resources/event_serialization_6.json b/bugsnag-android-core/src/test/resources/event_serialization_6.json index 42a75129c5..f27c4bcc62 100644 --- a/bugsnag-android-core/src/test/resources/event_serialization_6.json +++ b/bugsnag-android-core/src/test/resources/event_serialization_6.json @@ -44,11 +44,11 @@ "freeDisk": 22234423124, "freeMemory": 92340255592, "orientation": "portrait", - "time": "1970-01-01T00:00:00Z" + "time": "1970-01-01T00:00:00.000Z" }, "breadcrumbs": [ { - "timestamp": "1970-01-01T00:00:00Z", + "timestamp": "1970-01-01T00:00:00.000Z", "name": "helloworld", "type": "manual", "metaData": {} diff --git a/bugsnag-android-core/src/test/resources/json_stream.json b/bugsnag-android-core/src/test/resources/json_stream.json index 702d808d3b..367a7aa4a1 100644 --- a/bugsnag-android-core/src/test/resources/json_stream.json +++ b/bugsnag-android-core/src/test/resources/json_stream.json @@ -5,7 +5,7 @@ "long": 123, "float": 123.45, "streamable": { - "timestamp": "1970-01-01T00:00:00Z", + "timestamp": "1970-01-01T00:00:00.000Z", "name": "whoops", "type": "log", "metaData": {} diff --git a/bugsnag-android-core/src/test/resources/session_serialization_0.json b/bugsnag-android-core/src/test/resources/session_serialization_0.json index 222365da53..d2bf114531 100644 --- a/bugsnag-android-core/src/test/resources/session_serialization_0.json +++ b/bugsnag-android-core/src/test/resources/session_serialization_0.json @@ -23,7 +23,7 @@ "sessions": [ { "id": "123", - "startedAt": "1970-01-01T00:00:00Z", + "startedAt": "1970-01-01T00:00:00.000Z", "user": {} } ] diff --git a/bugsnag-plugin-react-native/src/test/java/com/bugsnag/android/BreadcrumbSerializerTest.java b/bugsnag-plugin-react-native/src/test/java/com/bugsnag/android/BreadcrumbSerializerTest.java index 3af45b38e0..10d8f99d4e 100644 --- a/bugsnag-plugin-react-native/src/test/java/com/bugsnag/android/BreadcrumbSerializerTest.java +++ b/bugsnag-plugin-react-native/src/test/java/com/bugsnag/android/BreadcrumbSerializerTest.java @@ -36,7 +36,7 @@ public void setup() { public void serialize() { Map map = new HashMap<>(); new BreadcrumbSerializer().serialize(map, crumb); - assertEquals("1970-01-01T00:00:00Z", map.get("timestamp")); + assertEquals("1970-01-01T00:00:00.000Z", map.get("timestamp")); assertEquals("Whoops", map.get("message")); assertEquals("state", map.get("type")); assertEquals(metadata, map.get("metadata")); diff --git a/bugsnag-plugin-react-native/src/test/java/com/bugsnag/android/DeviceSerializerTest.java b/bugsnag-plugin-react-native/src/test/java/com/bugsnag/android/DeviceSerializerTest.java index 26c88dca69..602a5e4626 100644 --- a/bugsnag-plugin-react-native/src/test/java/com/bugsnag/android/DeviceSerializerTest.java +++ b/bugsnag-plugin-react-native/src/test/java/com/bugsnag/android/DeviceSerializerTest.java @@ -70,7 +70,7 @@ public void serialize() { assertEquals(20923423434L, map.get("freeDisk")); assertEquals(23409662345L, map.get("freeMemory")); assertEquals("portrait", map.get("orientation")); - assertEquals("1970-01-01T00:00:00Z", map.get("time")); + assertEquals("1970-01-01T00:00:00.000Z", map.get("time")); Map runtimeVersions = new HashMap<>(); runtimeVersions.put("androidApiLevel", 27);