| OLD | NEW |
| 1 <!-- Copyright 2016 The Chromium Authors. All rights reserved. | 1 <!-- Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 Use of this source code is governed by a BSD-style license that can be | 2 Use of this source code is governed by a BSD-style license that can be |
| 3 found in the LICENSE file. | 3 found in the LICENSE file. |
| 4 --> | 4 --> |
| 5 | 5 |
| 6 # HistogramSet JSON Format | 6 # HistogramSet JSON Format |
| 7 | 7 |
| 8 This document assumes familiarity with the concepts introduced in | 8 This document assumes familiarity with the concepts introduced in |
| 9 [how-to-write-metrics](/docs/how-to-write-metrics.md). | 9 [how-to-write-metrics](/docs/how-to-write-metrics.md). |
| 10 | 10 |
| 11 HistogramSet JSON contains an unordered array of dictionaries, where each | 11 HistogramSet JSON contains an unordered array of dictionaries, where each |
| 12 dictionary represents either a Histogram or a Diagnostic. | 12 dictionary represents either a Histogram or a Diagnostic. |
| 13 | 13 |
| 14 ```javascript | 14 ```javascript |
| 15 [ | 15 [ |
| 16 { | 16 { |
| 17 "name": "my amazing metric", | 17 "name": "my amazing metric", |
| 18 "guid": "123e4567-e89b-12d3-a456-426655440000", | 18 "guid": "123e4567-e89b-12d3-a456-426655440000", |
| 19 "unit": "ms", | 19 "unit": "ms", |
| 20 "binBoundaries": [0, [0, 100, 10]], | 20 "binBoundaries": [0, [0, 100, 10]], |
| 21 "shortName": "my metric", | 21 "shortName": "my metric", |
| 22 "description": "this is my awesome amazing metric", | 22 "description": "this is my awesome amazing metric", |
| 23 "diagnostics": { | 23 "diagnostics": { |
| 24 "telemetry": "923e4567-e89b-12d3-a456-426655440000", | 24 "stories": "923e4567-e89b-12d3-a456-426655440000", |
| 25 }, | 25 }, |
| 26 "sampleValues": [0, 1, 42, -999999999.99999, null], | 26 "sampleValues": [0, 1, 42, -999999999.99999, null], |
| 27 "maxNumSampleValues": 1000, | 27 "maxNumSampleValues": 1000, |
| 28 "numNans": 1, | 28 "numNans": 1, |
| 29 "nanDiagnostics": [ | 29 "nanDiagnostics": [ |
| 30 { | 30 { |
| 31 "events": { | 31 "events": { |
| 32 "type": "RelatedEventSet", | 32 "type": "RelatedEventSet", |
| 33 "events": [ | 33 "events": [ |
| 34 { | 34 { |
| 35 "stableId": "a.b.c", "title": "Title", "start": 0, "duration": 1 | 35 "stableId": "a.b.c", "title": "Title", "start": 0, "duration": 1 |
| 36 } | 36 } |
| 37 ] | 37 ] |
| 38 } | 38 } |
| 39 } | 39 } |
| 40 ], | 40 ], |
| 41 "running": [5, 42, 0, -1, -999, -900, 100], | 41 "running": [5, 42, 0, -1, -999, -900, 100], |
| 42 "allBins": { | 42 "allBins": { |
| 43 "0": [1], | 43 "0": [1], |
| 44 "1": [1], | 44 "1": [1], |
| 45 }, | 45 }, |
| 46 "summaryOptions": { | 46 "summaryOptions": { |
| 47 "nans": true, | 47 "nans": true, |
| 48 "percentile": [0.5, 0.95, 0.99], | 48 "percentile": [0.5, 0.95, 0.99], |
| 49 }, | 49 }, |
| 50 }, | 50 }, |
| 51 { | 51 { |
| 52 "guid": "923e4567-e89b-12d3-a456-426655440000", | 52 "guid": "923e4567-e89b-12d3-a456-426655440000", |
| 53 "type": "TelemetryInfo", | 53 "type": "GenericSet", |
| 54 "benchmarkName": "memory", | 54 "values": ["browse:news:cnn"], |
| 55 "benchmarkStartMs": 1234567890, | |
| 56 "label": "abc", | |
| 57 "storyDisplayName": "my story", | |
| 58 "storyGroupingKeys": {"state": "pre"}, | |
| 59 "storysetRepeatCounter": 0, | |
| 60 }, | 55 }, |
| 61 ] | 56 ] |
| 62 ``` | 57 ``` |
| 63 | 58 |
| 64 ## Histograms | 59 ## Histograms |
| 65 | 60 |
| 66 ### Required fields | 61 ### Required fields |
| 67 | 62 |
| 68 * `name`: any string | 63 * `name`: any string |
| 69 * `guid`: string UUID, allows Histograms to reference other Histograms via | 64 * `guid`: string UUID, allows Histograms to reference other Histograms via |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 DiagnosticMap is a dictionary mapping strings to Diagnostic dictionaries. | 119 DiagnosticMap is a dictionary mapping strings to Diagnostic dictionaries. |
| 125 | 120 |
| 126 ## Diagnostics | 121 ## Diagnostics |
| 127 | 122 |
| 128 The only field that is required for all Diagnostics, `type`, must be one of | 123 The only field that is required for all Diagnostics, `type`, must be one of |
| 129 * `GenericSet` | 124 * `GenericSet` |
| 130 * `RelatedEventSet` | 125 * `RelatedEventSet` |
| 131 * `Breakdown` | 126 * `Breakdown` |
| 132 * `RelatedHistogramMap` | 127 * `RelatedHistogramMap` |
| 133 * `RelatedHistogramBreakdown` | 128 * `RelatedHistogramBreakdown` |
| 134 * `TelemetryInfo` | |
| 135 * `Scalar` | 129 * `Scalar` |
| 136 | 130 |
| 137 If a Diagnostic is in the root array of the JSON, then it is shared, so it may b
e | 131 If a Diagnostic is in the root array of the JSON, then it is shared, so it may b
e |
| 138 referenced by multiple Histograms. Shared Diagnostics must contain a string | 132 referenced by multiple Histograms. Shared Diagnostics must contain a string |
| 139 field `guid` containing a UUID. | 133 field `guid` containing a UUID. |
| 140 | 134 |
| 141 If a Diagnostic is contained in a Histogram, then it must not have a `guid` | 135 If a Diagnostic is contained in a Histogram, then it must not have a `guid` |
| 142 field. | 136 field. |
| 143 | 137 |
| 144 The other fields of Diagnostic dictionaries depend on `type`. | 138 The other fields of Diagnostic dictionaries depend on `type`. |
| 145 | 139 |
| 146 ### TelemetryInfo | |
| 147 | |
| 148 This tracks telemetry parameters when the Histogram was produced to allow users | |
| 149 to compare or merge results across similar telemetry story runs. | |
| 150 | |
| 151 * `benchmarkName`: string | |
| 152 * `benchmarkStartMs`: number of ms since unix epoch | |
| 153 * `label`: string | |
| 154 * `legacyTIRLabel`: string | |
| 155 * `storyDisplayName`: string | |
| 156 * `storyGroupingKeys`: dictionary mapping from strings to strings | |
| 157 * `storysetRepeatCounter`: number | |
| 158 | |
| 159 ### GenericSet | 140 ### GenericSet |
| 160 | 141 |
| 161 This allows metrics to store arbitrary untyped data in Histograms. | 142 This allows metrics to store arbitrary untyped data in Histograms. |
| 162 | 143 |
| 163 * `values`: array of any JSON data. | 144 * `values`: array of any JSON data. |
| 164 | 145 |
| 165 ### Scalar | 146 ### Scalar |
| 166 | 147 |
| 167 Metrics should not use Scalar diagnostics since they cannot be safely merged. | 148 Metrics should not use Scalar diagnostics since they cannot be safely merged. |
| 168 | 149 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 | 181 |
| 201 * `events`: array of dictionaries containing `stableId`, `title`, `start`, | 182 * `events`: array of dictionaries containing `stableId`, `title`, `start`, |
| 202 `duration` fields of Events | 183 `duration` fields of Events |
| 203 | 184 |
| 204 ### DateRange | 185 ### DateRange |
| 205 | 186 |
| 206 This is a Range of Dates. | 187 This is a Range of Dates. |
| 207 | 188 |
| 208 * `min`: Unix timestamp in ms | 189 * `min`: Unix timestamp in ms |
| 209 * `max`: optional Unix timestamp in ms | 190 * `max`: optional Unix timestamp in ms |
| OLD | NEW |