Skip to content

Commit

Permalink
fix: CPU Entitlement is zero when stats are missing
Browse files Browse the repository at this point in the history
- In #3641 we exposed CPU Entitlement in process stats and returned null
  when stats are not yet available in Log Cache.
- Change missing process stats to instead have CPU Entitlement of zero
  for consistency with other existing metrics. Recent versions of the cf
  CLI will show zero rather than an empty column for CPU Entitlement.
- CPU Entitlement may still be null when the metric is not available on
  the deployment.

Signed-off-by: Andrew Costa <[email protected]>
  • Loading branch information
acrmp committed Jun 19, 2024
1 parent daffedc commit 725f864
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion docs/v3/source/includes/api_resources/_processes.erb
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@
"state": "STARTING",
"usage": {
"cpu": 0,
"cpu_entitlement": null,
"cpu_entitlement": 0,
"disk": 0,
"log_rate": 0,
"mem": 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def missing_process_stats(formatted_current_time)
{
time: formatted_current_time,
cpu: 0,
cpu_entitlement: nil,
cpu_entitlement: 0,
mem: 0,
disk: 0,
log_rate: 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,12 +241,12 @@ def make_actual_lrp(instance_guid:, index:, state:, error:, since:)
[container_metric_batch]
end

it 'sets all the stats to their nullish value' do
it 'sets all the stats to zero' do
result, = instances_reporter.stats_for_app(process)
expect(result[0][:stats][:usage]).to eq({
time: formatted_current_time,
cpu: 0,
cpu_entitlement: nil,
cpu_entitlement: 0,
mem: 0,
disk: 0,
log_rate: 0
Expand Down Expand Up @@ -378,7 +378,7 @@ def make_actual_lrp(instance_guid:, index:, state:, error:, since:)
expect(result[0][:stats][:usage]).to eq({
time: formatted_current_time,
cpu: 0,
cpu_entitlement: nil,
cpu_entitlement: 0,
mem: 0,
disk: 0,
log_rate: 0
Expand Down

0 comments on commit 725f864

Please sign in to comment.