| { |
| // Appmgr and component manager sample total CPU and queuing time for all components (v1 and v2 |
| // respectively) they know about every minute. Component manager does the same for v2 |
| // components. The last two samples are retained to calculate average CPU load over |
| // approximately the last minute. |
| select: { |
| // The total number of nanoseconds any component was scheduled |
| // and running on a CPU in the second to most recent sample. |
| prev_cpu_v2: "INSPECT:<component_manager>:root/cpu_stats/recent_usage:previous_cpu_time", |
| |
| // The total number of nanoseconds any component was queued to |
| // run, but was not actually running in the second to most recent sample. |
| prev_queue_v2: "INSPECT:<component_manager>:root/cpu_stats/recent_usage:previous_queue_time", |
| |
| // The timestamp of the second to most recent sample. |
| prev_time_v2: "INSPECT:<component_manager>:root/cpu_stats/recent_usage:previous_timestamp", |
| |
| // The total number of nanoseconds any component was scheduled |
| // and running on a CPU in the most recent sample. |
| current_cpu_v2: "INSPECT:<component_manager>:root/cpu_stats/recent_usage:recent_cpu_time", |
| |
| // The total number of nanoseconds any component was queued to |
| // run, but was not actually running in the most recent sample. |
| current_queue_v2: "INSPECT:<component_manager>:root/cpu_stats/recent_usage:recent_queue_time", |
| |
| // The timestamp of the most recent sample. |
| current_time_v2: "INSPECT:<component_manager>:root/cpu_stats/recent_usage:recent_timestamp", |
| }, |
| eval: { |
| // The average CPU and queue times during the two most recent samples in |
| // component_manager (typically every minute). This includes only CPU time for |
| // components known to component_manager. The percentage is out |
| // of the total CPU time available on a single processor, so on a 4 |
| // core system the percentage can go up to 400%. |
| cpu_average_v2: "(current_cpu_v2 - prev_cpu_v2) / (current_time_v2 - prev_time_v2)", |
| queue_average_v2: "(current_queue_v2 - prev_queue_v2) / (current_time_v2 - prev_time_v2)", |
| }, |
| act: { |
| v2_component_cpu_usage: { |
| type: "Gauge", |
| value: "cpu_average_v2", |
| format: "percentage", |
| }, |
| v2_component_queue_average: { |
| type: "Gauge", |
| value: "queue_average_v2", |
| format: "percentage", |
| }, |
| }, |
| } |