stateEntries
The state entries in this metric report, populated when state reporting is enabled.
Declaration
let stateEntries: [MetricReport.StateEntry]Mentioned in
Discussion
stateEntries is only populated when the MetricManager was initialized with init(enabledStateReportingDomains:). Each MetricReport.StateEntry contains metric values aggregated while the app was in a specific state, scoped to a specific MetricManager.ReportedState.
Only a subset of metrics appear in state entries, including hang time, hitch time, app termination counts, signpost intervals, location activity time, and app runtime metrics. CPU time, memory, network, disk I/O, GPU, app launch, and disk space metrics appear only in intervalEntries.
Use byStateReportingDomain on the collection to group entries by domain:
let byDomain = report.stateEntries.byStateReportingDomain
if let sessionEntries = byDomain[StateReportingDomain(rawValue: "com.example.app.session")] {
for entry in sessionEntries {
print(entry.state.label, entry.values)
}
}