You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/RFCs/0011-crashtracker-structured-log-format-V1_X.md
+44-36Lines changed: 44 additions & 36 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "S
4
4
5
5
## Summary
6
6
7
-
This document consolidates and describes the complete evolution of the crashinfo data format from version 1.0 through 1.6. It serves as the authoritative specification for the crashtracker structured log format, replacing RFCs 0005-0009. Future minor version modifications will be included in this revisable document.
7
+
This document consolidates and describes the complete evolution of the crashinfo data format from version 1.0 through 1.8. It serves as the authoritative specification for the crashtracker structured log format, replacing RFCs 0005-0009. Future minor version modifications will be included in this revisable document.
8
8
9
9
## Motivation
10
10
@@ -18,9 +18,9 @@ As a structured format, it avoids the ambiguity of standard semi-structured stac
18
18
Due to the use of native extensions, it is possible for a single stack-trace to include frames from multiple languages (e.g. python may call C code, which calls Rust code, etc).
19
19
Having a single structured format allows us to work across languages.
20
20
21
-
## Current Format (Version 1.7)
21
+
## Current Format (Version 1.8)
22
22
23
-
This section describes the current format (version 1.7), which incorporates all features from versions 1.0 through 1.7. A natural language description of the json format is given here. An example is given in Appendix A, and the schema is given in Appendix B.
23
+
This section describes the current format (version 1.8), which incorporates all features from versions 1.0 through 1.8. A natural language description of the json format is given here. An example is given in Appendix A, and the schema is given in Appendix B.
24
24
25
25
Any field not listed as "Required" is optional. Consumers MUST accept json with elided optional fields.
26
26
@@ -32,56 +32,51 @@ Parsers SHOULD therefore accept unexpected fields, either by ignoring them, or b
32
32
33
33
### Version Compatibility
34
34
35
-
Consumers of the crash data format SHOULD be designed to handle all versions from 1.0 to 1.7. The version is indicated by the `data_schema_version` field. Key compatibility considerations:
35
+
Consumers of the crash data format SHOULD be designed to handle all versions from 1.0 to 1.8. The version is indicated by the `data_schema_version` field. Key compatibility considerations:
36
36
- Version 1.0: Base format
37
37
- Version 1.1+: Stacktraces may include an `incomplete` field
38
38
- Version 1.2+: Root level may include an `experimental` field
39
39
- Version 1.3+: Stackframes may include a `comments` field
40
40
- Version 1.4+: Stackframes may include a `mangled_name` field
41
41
- Version 1.5+: Error objects may include a `thread_name` field
42
42
- Version 1.6+: Root level may include a `ucontext` field for UNIX signal crashes
43
-
- Version 1.7+: `error.threads` is a `Threads` object (with `threads`, `count`, and `incomplete` fields) rather than a bare array
43
+
- Version 1.7: `error.threads` is a `Threads` wrapper object (with nested `threads`, `count`, and `incomplete` fields) rather than a bare array
44
+
- Version 1.8+: `error.threads` is a bare array of thread objects again; the wrapper is removed. Partial collection is indicated by `counters.threads_incomplete`
44
45
45
46
### Fields
46
47
47
48
-`counters`: **[optional]**
48
49
A map of names to integer values.
49
50
At present, this is used by the profiler to track which operations were active at the time of the crash.
51
+
When multi-thread collection is enabled and stops before all eligible threads are visited, collectors MAY set `threads_incomplete` to `1`.
50
52
-`data_schema_version`: **[required]**
51
-
A string containing the semver ID of the crashtracker data schema. Current versions: "1.0", "1.1", "1.2", "1.3", "1.4", "1.5", "1.6", "1.7".
53
+
A string containing the semver ID of the crashtracker data schema. Current versions: "1.0", "1.1", "1.2", "1.3", "1.4", "1.5", "1.6", "1.7", "1.8".
52
54
-`experimental`: **[optional]***[Added in v1.2]*
53
55
Any valid JSON object can be used as the value here.
54
56
Note that the object MUST be valid JSON.
55
57
Consumers of the format SHOULD pass this field along unmodified as the report is processed.
56
58
This field allows developers to collect experimental data without requiring schema changes.
57
59
-`error`: **[required]**
58
-
-`threads`: **[optional]***[Shape changed in v1.7]*
59
-
A `Threads` object describing the non-crashing threads collected at crash time.
60
-
In a multi-threaded program, the collector SHOULD collect the stacktraces of all active threads and report them here, if configured to do so.
61
-
The `Threads` object has the following fields:
62
-
-`threads`: **[optional]**
63
-
An array of `ThreadData` objects, one per collected thread.
64
-
May be absent or empty if no threads were collected.
65
-
Each `ThreadData` object has the following fields:
66
-
-`crashed`: **[required]**
67
-
A boolean which tells if the thread crashed.
68
-
Threads in this array represent non-crashing threads; the crashing thread's stack is in `error.stack`.
69
-
-`name`: **[required]**
70
-
Name of the thread (e.g. `'worker-0'`).
71
-
-`stack`: **[required]**
72
-
The `StackTrace` of the thread.
73
-
See below for more details on how stacktraces are formatted.
74
-
-`state`: **[optional]**
75
-
Platform-specific state of the thread when its state was captured.
76
-
Currently, this is the single-character state letter from `/proc/<pid>/task/<tid>/stat`
77
-
(e.g. `"R"` for running, `"S"` for sleeping, `"D"` for uninterruptible wait).
78
-
-`count`: **[required]**
79
-
The number of threads present in the `threads` array.
80
-
Consumers SHOULD treat this as authoritative; it equals `threads.length` when collection completed normally.
81
-
-`incomplete`: **[required]**
82
-
`true` if thread collection was cut short before all eligible threads were visited
83
-
(e.g. the receiver timeout expired or the `max_threads` cap was reached), `false` otherwise.
84
-
When `true`, consumers SHOULD note that additional threads may exist that are not represented in `threads`.
60
+
-`threads`: **[optional]***[Shape changed in v1.7, simplified in v1.8]*
61
+
An array of thread objects describing non-crashing threads collected at crash time.
62
+
In a multi-threaded program, when `collect_all_threads` is enabled, the collector SHOULD collect the stacktraces of all active background threads and report them here.
63
+
The crashing thread's stack is in `error.stack`, not in this array.
64
+
The field MUST be omitted when multi-thread collection is disabled or when no background thread stacks were collected.
65
+
Each thread object has the following fields:
66
+
-`crashed`: **[required]**
67
+
A boolean which tells if the thread crashed.
68
+
Entries in this array represent non-crashing threads and MUST have `crashed` set to `false`.
69
+
-`name`: **[required]**
70
+
Name of the thread (e.g. `'ct_worker_0'`).
71
+
On Linux, this is typically the `comm` field from `/proc/<pid>/task/<tid>/stat`.
72
+
-`stack`: **[required]**
73
+
The `StackTrace` of the thread.
74
+
See below for more details on how stacktraces are formatted.
75
+
-`state`: **[optional]**
76
+
Platform-specific state of the thread when its state was captured (CPU registers dump for iOS, thread state enum for Android, etc.).
77
+
Currently on Linux this is the single-character state letter from `/proc/<pid>/task/<tid>/stat`
78
+
(e.g. `"R"` for running, `"S"` for sleeping, `"D"` for uninterruptible wait).
79
+
When collection was cut short (receiver timeout or `max_threads` cap), consumers SHOULD check `counters.threads_incomplete`.
85
80
-`is_crash`: **[required]**
86
81
Boolean true if the error was a crash, false otherwise.
87
82
-`kind`: **[required]**
@@ -256,7 +251,7 @@ A stacktrace consists of
256
251
257
252
## Version History
258
253
259
-
This section documents the evolution of the crashtracker structured log format across versions 1.0 through 1.7. The current specification above reflects version 1.7, which includes all features from previous versions.
254
+
This section documents the evolution of the crashtracker structured log format across versions 1.0 through 1.8. The current specification above reflects version 1.8, which includes all features from previous versions.
260
255
261
256
### Version 1.0 (RFC 0005)
262
257
*Initial version*
@@ -333,15 +328,27 @@ This section documents the evolution of the crashtracker structured log format a
333
328
334
329
**Motivation:** Thread collection in the receiver is time-bounded (the overall receiver timeout is shared between stdin reading and ptrace-based collection). When the budget runs out, collection stops early and the resulting thread list is partial. Without an explicit `incomplete` flag there is no way for consumers to distinguish "no other threads existed" from "collection was cut short". The `count` field avoids an extra array-length computation and keeps the shape consistent with other counted collections in the schema.
335
330
331
+
### Version 1.8
332
+
*Flat thread array for downstream compatibility*
333
+
334
+
**Changes from v1.7:**
335
+
-`error.threads` is again a bare array of thread objects (each with `crashed`, `name`, `stack`, and optional `state`), not a `Threads` wrapper
336
+
- The `Threads` wrapper fields (`threads`, `count`, `incomplete`) are removed from `error.threads`
337
+
-`error.threads` is omitted entirely when multi-thread collection is disabled or when no background threads were collected
338
+
- Partial thread collection is reported via `counters.threads_incomplete` set to `1` when collection was cut short
339
+
- Updated `data_schema_version` to "1.8"
340
+
341
+
**Motivation:** The v1.7 nested `Threads` object broke downstream pipelines that expect `error.threads` to be a flat array of thread records. Restoring the array shape while moving completeness metadata to `counters` keeps the report compatible with existing consumers and still allows distinguishing partial collection from "collection disabled or empty".
342
+
336
343
## Appendix A: Example output
337
344
338
345
An example crash report in version 1.0 format is [available here](artifacts/0005-crashtracker-example.json).
339
346
340
-
Note: This example uses version 1.0 format. Version 1.1+ may include additional fields such as `incomplete` in stacktraces, `experimental` at the root level, `comments` in stackframes, `mangled_name` in stackframes, `thread_name` in error objects, `ucontext` at the root level for UNIX signal crashes, and (v1.7+) `error.threads` as a `Threads` object with `threads`, `count`, and `incomplete` fields.
347
+
Note: This example uses version 1.0 format. Version 1.1+ may include additional fields such as `incomplete` in stacktraces, `experimental` at the root level, `comments` in stackframes, `mangled_name` in stackframes, `thread_name` in error objects, `ucontext` at the root level for UNIX signal crashes, (v1.7) `error.threads` as a `Threads`wrapper object, and (v1.8+) `error.threads` as a flat array of thread objects with `counters.threads_incomplete` for partial collection.
341
348
342
349
## Appendix B: Json Schema
343
350
344
-
The current JSON schema (version 1.7) is [available here](artifacts/crashtracker-unified-runtime-stack-schema-v1_7.json).
351
+
The current JSON schema (version 1.8) is [available here](artifacts/crashtracker-unified-runtime-stack-schema-v1_8.json).
0 commit comments