Expand description
Defines the metrics system for entropy devices.
§Metrics format
The metrics are flushed in JSON when requested by vmm::logger::metrics::METRICS.write().
§JSON example with metrics:
"entropy": {
"activate_fails": "SharedIncMetric",
"entropy_event_fails": "SharedIncMetric",
"entropy_event_count": "SharedIncMetric",
...
}
}Each entropy field in the example above is a serializable EntropyDeviceMetrics structure
collecting metrics such as activate_fails, entropy_event_fails etc. for the entropy device.
Since entropy doesn’t support multiple devices, there is no per device metrics and
entropy represents the aggregate entropy metrics.
§Design
The main design goals of this system are:
- Have a consistent approach of keeping device related metrics in the individual devices modules.
- To decouple entropy device metrics from logger module by moving EntropyDeviceMetrics out of FirecrackerDeviceMetrics.
- Rely on
serdeto provide the actual serialization for writing the metrics.
The system implements 1 type of metrics:
- Shared Incremental Metrics (SharedIncMetrics) - dedicated for the metrics which need a counter (i.e the number of times an API request failed). These metrics are reset upon flush.
Functions§
- flush_
metrics - Called by METRICS.flush(), this function facilitates serialization of entropy device metrics.