Description
Template administrators may define metrics/insights for the agent to display in the dashboard using Agent Metadata. The most common use case is resource utilization for CPU, disk, and memory. Currently, these values show point-in-time data to inform developers on consumption, but this is relatively limiting. Accurately diagnosing when workspace is over or under-utilizing resources, developers need to see historic data.
Eventually, a dedicated "workspace insights" or "agent insights" page for each workspace in the dashboard would be a great place to review resource consumption and developer activity over time. In the short-term, we should begin collecting the point-in-time data for display.
With this data collected historically, we should add an on-hover popup that shows graph of the value of some* metrics over time. This will allow developers to determine whether the resources allocated to their workspace have been sufficient. This graph should only show the metric's value since last workspace start.
*While all agent metadata should be dynamic, not all will need time-series analysis. We should add an opt-out flag to the agent terraform resource so this graph may be ignored for non-resource metadata:
resource "coder_agent" "dev" {
os = "linux"
metadata {
display_name = "CPU Usage"
key = "cpu_usage"
script = "coder stat cpu"
interval = 10
....
hide_history = true # (Default false)
}