Analysing stored GT reports
Reports are recorded so that a problem can be understood after it happened. Analysing them means three steps: find the reports you need (by type, day or image, from their metadata only), read them back into report objects, and then query those objects like any other objects. How to record and store reports is on GT reports available for data collection; how the infrastructure works is on Report infrastructure for collecting data in GT.
Inspect the store to browse its folder (#selector
). Every folder with a meta.json is one stored report; GtStoredReportFiles
#selector
reads its metadata and shows it (#selector
), lists its files (#selector
), and its
Read
action reads the report back (#selector
). A folder without meta.json is an interrupted write and is not found below.
reportsStore := GtReportsLocalStore default.
storedReports := (reportsStore rootFolder allChildrenMatching: GtReportMetadata fileName) collect: [:each | GtStoredReportFiles folder: each parent].
Object What it is Useful messages GtStoredReportFiles
one stored report folder, with its metadata already read #selector
, #selector
, #selector
, #selector
GtReportMetadata
the content of meta.json #selector
, #selector
, #selector
, #selector
, #selector
, #selector
, #selector
GtReportFileDescription
one data file listed in the metadata #selector
, #selector
the report the object that was recorded, read back from its files (e.g. GtMessageTallyReport
) its own accessors and views, and #selector
Selecting and grouping on the metadata only reads meta.json files, so it is cheap. #selector
reads the data files: select first, then read. A space tally takes about a minute to read.
The examples use storedReports from above. Each starts from a question.
storedReports groupedBy: [:each | each metadata reportType].
Which reports of each type are there? From the metadata only (#selector
).
(storedReports groupedBy: [:each | each metadata reportType]) collect: [:eachGroup | (eachGroup sumNumbers: [:each | each metadata files sumNumbers: [:eachFile | eachFile numberOfBytes]]) humanReadableIsqByteSize].
How much space does each report type take? From the file sizes in the metadata (#selector
), without reading any report.
storedReports detectMax: [:each | each metadata storedAt].
Which report was stored last? (#selector
, in UTC)
(((storedReports select: [:each | each metadata reportType = 'message-tally']) collect: [:each | each report]) select: [:each | each textualContent includesSubstring: 'BlSpace>>#processEvents']) sorted: [:a :b | a numberOfSamples >= b numberOfSamples].
Which Message Tallies saw a given method, the busiest first? A slowdown that comes back shows up in several tallies (#selector
, #selector
).
((storedReports select: [:each | each metadata reportType = 'processes']) collect: [:each | each report]) collect: [:eachReport | eachReport -> (eachReport processReports select: [:each | each name includesSubstring: 'Morphic'])].
Where was a given process in each processes report? For example the Morphic UI process (#selector
, GtProcessReport
), with its stack (#selector
).
((storedReports select: [:each | each metadata reportType = 'garbage-collects']) collect: [:each | each report]) collect: [:each | each -> each recordedEventsDuration].
How much time did the recorded full garbage collections take in each report? (#selector
)
latestSpaceTally := ((storedReports select: [:each | each metadata reportType = 'space-tally']) detectMax: [:each | each metadata storedAt]) report.
(latestSpaceTally spaceTally results asArray sorted: [:a :b | a spaceForInstances >= b spaceForInstances]) first: 20.
Which classes take the most memory in the latest space tally? Reads one space tally, which takes about a minute (#selector
, GtSpaceTallyItem
#selector
).
(storedReports groupedBy: [:each | each metadata reportUid]) select: [:eachGroup | eachGroup size > 1].
Was a report stored more than once? Copies share the report uid (#selector
); keep one of each group to analyse every report once.