user avatar
Populate alloc stats API with device stats
Mahmood Ali authored
This change makes few compromises:

* Looks up the devices associated with tasks at look up time.  Given
that `nomad alloc status` is called rarely generally (compared to stats
telemetry and general job reporting), it seems fine.  However, the
lookup overhead grows bounded by number of `tasks x total-host-devices`,
which can be significant.

* `client.Client` performs the task devices->statistics lookup.  It
passes self to alloc/task runners so they can look up the device statistics
allocated to them.
  * Currently alloc/task runners are responsible for constructing the
entire RPC response for stats
  * The alternatives for making task runners device statistics aware
don't seem appealing (e.g. having task runners contain reference to hostStats)

* On the alloc aggregation resource usage, I did a naive merging of task device statistics.
  * Personally, I question the value of such aggregation, compared to
costs of struct duplication and bloating the response - but opted to be
consistent in the API.
  * With naive concatination, device instances from a single device group used by separate tasks in the alloc, would be aggregated in two separate device group statistics.
58cbafe9
Name Last commit Last update
..
contexts sync
acl.go Self token lookup
acl_test.go Self token lookup
agent.go spelling: unmarshal
agent_test.go non-Existent -> nonexistent
allocations.go Show preemption output in plan CLI
allocations_test.go Add DesiredTransition.ShouldMigrate to api pkg
api.go spelling: configurations
api_test.go Enhance API pkg to utilize Server's Client Tunnel
compose_test.go Parsing and API layer for spread stanza
constraint.go Remove weight and hard/soft fields from constraint
constraint_test.go Parallel
deployments.go code review fixes
evaluations.go Rename DelayCeiling to MaxDelay
evaluations_test.go non-Existent -> nonexistent
fs.go api: never return EOF from Logs error chan
fs_test.go framer: fix early exit/truncation in framer
jobs.go more minor review feedback
jobs_test.go Parsing and API layer for spread stanza
jobs_testing.go Remove `structs` import from `api`
namespace.go sync
namespace_test.go sync
nodes.go device stats summary in `node status`
nodes_test.go device stats summary in `node status`
operator.go change path to v1/scheduler/configuration
operator_autopilot.go
operator_autopilot_test.go
operator_test.go
quota.go
quota_test.go
raw.go
regions.go
regions_test.go
resources.go
search.go
search_test.go
sentinel.go
sentinel_test.go
status.go
status_test.go
system.go
system_test.go
tasks.go
tasks_test.go
util_test.go