How can I collect statics on my resource usage?
This report is part of the batch report that’s shipped with your CloudBees CD (CloudBees Flow) installation and is ready to use. It aggregates data on resource usage from job step history, and generates a visual summary of usage. You can find the batch report procedure under project “Electric Cloud” -> procedure “runReports”.
If you are interested in additional data not included in the resource summary report, you can also use job steps history to collect your own. You can construct findObjects API queries to return sets of job steps that suit your interest, and parse through the results for specific data points.
We have two examples available on GitHub for you to try out and use as reference.
get last used Uses the findObjects API to search for the last job step to run on each resource, and writes the results to a csv file.
get resource stats Finds all job steps that ran during a specific time period, and aggregates resource usage and wait time stats into a hash, then writes the results to a csv file.
Since both this and the built-in report rely on the findObjects API to gather information, they have the same limitations. Jobs that have been cleaned up or deleted will not show up in these summaries. The API return also has a limit of 1000 objects, so on heavily used systems you will need to split your query into shorter timeframes.