| <link rel="stylesheet" href="../style.css" /> |
| |
| [TOC] |
| # fuchsia.legacymetrics |
| |
| <div class="fidl-version-div"><span class="fidl-attribute fidl-version">Added: 7</span></div> |
| |
| ## **PROTOCOLS** |
| |
| ## MetricsRecorder {#MetricsRecorder} |
| *Defined in [fuchsia.legacymetrics/metrics_recorder.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.legacymetrics/metrics_recorder.fidl;l=12)* |
| <p>Accepts metrics events and uploads them to UMA servers for analysis. Metrics |
| events are batched and uploaded at a regular interval. If this service is |
| unable to upload events, it will try persisting them for later re-upload. |
| For similar behavior, see Chromium's MetricsService: |
| https://chromium.googlesource.com/chromium/src.git/+/HEAD/components/metrics/metrics_service.cc</p> |
| |
| ### OnCloseSoon {#MetricsRecorder.OnCloseSoon} |
| |
| <p>Indicates that this service will close all connections soon. Upon |
| receiving this event, each client should call Record() once for any |
| available metrics and close its connection to this sevice. Otherwise, |
| this service will close all incoming connections after a predefined |
| timeout starting from the moment it broadcasts this event.</p> |
| |
| |
| #### Response {#MetricsRecorder.OnCloseSoon_Response} |
| |
| <EMPTY> |
| |
| ### Record {#MetricsRecorder.Record} |
| |
| <p>Processes and enqueues a batch of events for upload. Returns after the |
| provided metrics are successfully processed by the service. Clients |
| should wait for a completion callback before sending subsequent Record() |
| requests.</p> |
| |
| #### Request {#MetricsRecorder.Record_Request} |
| |
| <table> |
| <tr><th>Name</th><th>Type</th></tr> |
| <tr> |
| <td><code>events</code></td> |
| <td> |
| <code>vector<<a class='link' href='#Event'>Event</a>></code> |
| </td> |
| </tr> |
| </table> |
| |
| |
| #### Response {#MetricsRecorder.Record_Response} |
| |
| <EMPTY> |
| |
| |
| ## **STRUCTS** |
| |
| ### HistogramBucket {#HistogramBucket data-text="HistogramBucket"} |
| *Defined in [fuchsia.legacymetrics/event.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.legacymetrics/event.fidl;l=39)* |
| |
| <table> |
| <tr><th>Field</th><th>Type</th><th>Description</th><th>Default</th></tr> |
| <tr id="HistogramBucket.min"> |
| <td><code>min</code></td> |
| <td> |
| <code>int64</code> |
| </td> |
| <td></td> |
| <td>No default</td> |
| </tr> |
| <tr id="HistogramBucket.max"> |
| <td><code>max</code></td> |
| <td> |
| <code>int64</code> |
| </td> |
| <td></td> |
| <td>No default</td> |
| </tr> |
| <tr id="HistogramBucket.count"> |
| <td><code>count</code></td> |
| <td> |
| <code>int64</code> |
| </td> |
| <td></td> |
| <td>No default</td> |
| </tr> |
| </table> |
| |
| |
| |
| ## **TABLES** |
| |
| ### Histogram {#Histogram data-text="Histogram"} |
| |
| |
| *Defined in [fuchsia.legacymetrics/event.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.legacymetrics/event.fidl;l=25)* |
| |
| <table> |
| <tr><th>Ordinal</th><th>Field</th><th>Type</th><th>Description</th></tr> |
| <tr id="Histogram.name"> |
| <td><h3 id="Histogram.name" class="add-link hide-from-toc">1</h3></td> |
| <td><code>name</code></td> |
| <td> |
| <code>string</code> |
| </td> |
| <td><p>Required histogram identifier. See these guidelines for more info: |
| https://chromium.googlesource.com/chromium/src.git/+/HEAD/tools/metrics/histograms/README.md#naming-your-histogram</p> |
| </td> |
| </tr> |
| <tr id="Histogram.buckets"> |
| <td><h3 id="Histogram.buckets" class="add-link hide-from-toc">2</h3></td> |
| <td><code>buckets</code></td> |
| <td> |
| <code>vector<<a class='link' href='#HistogramBucket'>HistogramBucket</a>></code> |
| </td> |
| <td></td> |
| </tr> |
| <tr id="Histogram.sum"> |
| <td><h3 id="Histogram.sum" class="add-link hide-from-toc">3</h3></td> |
| <td><code>sum</code></td> |
| <td> |
| <code>int64</code> |
| </td> |
| <td></td> |
| </tr> |
| </table> |
| |
| ### ImplementationDefinedEvent {#ImplementationDefinedEvent data-text="ImplementationDefinedEvent"} |
| |
| |
| *Defined in [fuchsia.legacymetrics/event.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.legacymetrics/event.fidl;l=50)* |
| <p>A custom event defined by the MetricsRecorder service. Refer to your |
| MetricsRecorder implementation for more details on the payload structure.</p> |
| |
| <table> |
| <tr><th>Ordinal</th><th>Field</th><th>Type</th><th>Description</th></tr> |
| <tr id="ImplementationDefinedEvent.data"> |
| <td><h3 id="ImplementationDefinedEvent.data" class="add-link hide-from-toc">1</h3></td> |
| <td><code>data</code></td> |
| <td> |
| <code>vector<uint8></code> |
| </td> |
| <td><p>Custom binary payload whose structure is defined by the MetricsRecorder |
| implementation. For example, it can represent a custom event protocol |
| buffer serialized to its wire format.</p> |
| </td> |
| </tr> |
| <tr id="ImplementationDefinedEvent.name"> |
| <td><h3 id="ImplementationDefinedEvent.name" class="add-link hide-from-toc">2</h3></td> |
| <td><code>name</code></td> |
| <td> |
| <code>string</code> |
| </td> |
| <td><p>Event identifier required if it's not already included in binary <code>data</code>. |
| This field takes precedence over any equivalent name included in binary |
| <code>data</code>, if both are provided.</p> |
| </td> |
| </tr> |
| </table> |
| |
| ### UserActionEvent {#UserActionEvent data-text="UserActionEvent"} |
| |
| |
| *Defined in [fuchsia.legacymetrics/event.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.legacymetrics/event.fidl;l=17)* |
| <p>Event that occurs in response to a user action. See |
| https://chromium.googlesource.com/chromium/src.git/+/HEAD/tools/metrics/actions/README.md</p> |
| |
| <table> |
| <tr><th>Ordinal</th><th>Field</th><th>Type</th><th>Description</th></tr> |
| <tr id="UserActionEvent.name"> |
| <td><h3 id="UserActionEvent.name" class="add-link hide-from-toc">1</h3></td> |
| <td><code>name</code></td> |
| <td> |
| <code>string</code> |
| </td> |
| <td></td> |
| </tr> |
| <tr id="UserActionEvent.time"> |
| <td><h3 id="UserActionEvent.time" class="add-link hide-from-toc">2</h3></td> |
| <td><code>time</code></td> |
| <td> |
| <code><a class='link' href='../zx/'>zx</a>/<a class='link' href='../zx/#time'>time</a></code> |
| </td> |
| <td><p>Required timestamp of the event occurrence. See TimeTicks in |
| https://cs.chromium.org/chromium/src/base/time/time.h</p> |
| </td> |
| </tr> |
| </table> |
| |
| |
| ## **UNIONS** |
| |
| ### Event [strict](/fuchsia-src/reference/fidl/language/language.md#strict-vs-flexible){:.fidl-attribute} {#Event data-text="Event"} |
| *Defined in [fuchsia.legacymetrics/event.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.legacymetrics/event.fidl;l=9)* |
| <p>A single metric event to be recorded and sent to the UMA backend.</p> |
| <table> |
| <tr><th>Ordinal</th><th>Variant</th><th>Type</th><th>Description</th></tr> |
| <tr id="Event.user_action_event"> |
| <td><h3 id="Event.user_action_event" class="add-link hide-from-toc">1</h3></td> |
| <td><code>user_action_event</code></td> |
| <td> |
| <code><a class='link' href='#UserActionEvent'>UserActionEvent</a></code> |
| </td> |
| <td></td> |
| </tr> |
| <tr id="Event.histogram"> |
| <td><h3 id="Event.histogram" class="add-link hide-from-toc">2</h3></td> |
| <td><code>histogram</code></td> |
| <td> |
| <code><a class='link' href='#Histogram'>Histogram</a></code> |
| </td> |
| <td></td> |
| </tr> |
| <tr id="Event.impl_defined_event"> |
| <td><h3 id="Event.impl_defined_event" class="add-link hide-from-toc">3</h3></td> |
| <td><code>impl_defined_event</code></td> |
| <td> |
| <code><a class='link' href='#ImplementationDefinedEvent'>ImplementationDefinedEvent</a></code> |
| </td> |
| <td></td> |
| </tr> |
| </table> |
| |
| |
| |