cli icon indicating copy to clipboard operation
cli copied to clipboard

Output CPU Entitlement metrics rather than the old CPU metric

Open acrmp opened this issue 11 months ago • 10 comments

What's the user value of this feature request?

Currently the cf CLI displays a CPU metric which is difficult to reason about. See #1194 for background here.

Instead we'd like the cf CLI to show CPU Entitlement usage which is more useful.

Who is the functionality for?

End users of the cf CLI.

How often will this functionality be used by the user?

Frequently. We would expect the CPU Entitlement usage stat to be presented when cf app is run or following cf push (as currently).

Who else is affected by the change?

This is potentially a breaking change dependent on whether this is implemented by replacing the existing CPU column or adding an additional column.

Is your feature request related to a problem? Please describe.

Developers find it difficult to reason about their application use of CPU without knowledge of the underlying platform.

Describe the solution you'd like

Modify the cf CLI to output CPU Entitlement in place of the old CPU metric for environments that expose the CPU Entitlement process stat.

     state     since                  cpu entitlement   memory        disk           logging       details
#0   running   2024-02-10T00:30:38Z   5.0%              47.7M of 1G   129.6M of 1G   0/s of 16K/s
#1   running   2024-02-12T18:17:49Z   5.0%              47.7M of 1G   129.6M of 1G   0/s of 16K/s

For environments that do not expose the CPU Entitlement information the cf CLI would continue to show the existing output.

Describe alternatives you've considered

Adding an additional column towards the end of the column output would be more backwards compatible but potentially confusing:

     state     since                  cpu    memory        disk           logging        cpu entitlement   details
#0   running   2024-02-10T00:30:38Z   0.2%   47.7M of 1G   129.6M of 1G   0/s of 16K/s   5.0%
#1   running   2024-02-12T18:17:49Z   0.1%   47.3M of 1G   129.6M of 1G   0/s of 16K/s   2.5%

Additional context

https://github.com/cloudfoundry/diego-release/issues/897 https://github.com/cloudfoundry/cloud_controller_ng/pull/3641

There was some great work done to emit absolute usage and entitlement metrics earlier but these were not directly consumable via the core cf CLI.

https://github.com/cloudfoundry/cpu-entitlement-plugin

acrmp avatar Mar 15 '24 20:03 acrmp

If we go with the initial proposed option, I think we should consider giving the user a compatibility flag (IE. USE_CPU_USAGE=true) to use cpu usage regardless of whatever capi returns.

Benjamintf1 avatar Mar 18 '24 20:03 Benjamintf1

Created https://github.com/cloudfoundry/cli/pull/2840 to add CPU Entitlement to the cf CLI v8 in a backwards-compatible manner, e.g. add it to the end of the app process table (before details).

ctlong avatar Apr 02 '24 20:04 ctlong

So which cli and server versions do we need to use to see the cpu entitlement metrics ?

lukas-becker0 avatar May 17 '24 13:05 lukas-becker0

So which cli and server versions do we need to use to see the cpu entitlement metrics ?

No version of the cf CLI has been released yet with these changes. The next versions of the cf CLI v8 and v9 (when it is released) will have a cpu entitlement column in the table. Its entry may be empty though if the CAPI that responds doesn't support the metric.

CAPI v1.175.0 is the first to support CPU Entitlement metrics.

ctlong avatar May 22 '24 23:05 ctlong

@ctlong Is there any timeline for the next CLI release? We are eager to get started with the CPU entitlements metric, but without CLI support it's tricky to roll that out...

jossy avatar Jun 03 '24 14:06 jossy

@ctlong Is there any timeline for the next CLI release? We are eager to get started with the CPU entitlements metric, but without CLI support it's tricky to roll that out...

^ @a-b @tcdowney do you have a timeline?

ctlong avatar Jun 03 '24 15:06 ctlong

We're in the final stage of the Cli Bosh release pipeline redesign, which is blocking this release. We expect to release CLI by the end of this week.

a-b avatar Jun 03 '24 16:06 a-b

Awesome, thank you!

jossy avatar Jun 03 '24 18:06 jossy

@a-b Do you have any updates on when the next version will be released? thx!

jossy avatar Jul 01 '24 14:07 jossy

We have most of our infrastructure ready. Very likely this week.

a-b avatar Jul 01 '24 14:07 a-b

@jossy new CLI version was released last week.

gururajsh avatar Jul 15 '24 15:07 gururajsh

Should this issue be closed as delivered then? Or do folks want to wait until v9 is released with the proposed changes?

ctlong avatar Jul 15 '24 22:07 ctlong

@ctlong but v8 also has support for it ?!

At least I can see it now using cli version 8.7.11+b1b4068.2024-07-09

lukas-becker0 avatar Jul 16 '24 06:07 lukas-becker0

Right, this proposal resulted in two PRs:

  1. Add cpu entitlement column to the end of the app table in the v8 cf CLI
  2. Replace cpu column with cpu entitlement column in the next major version (v9) of the cf CLI

Both have been merged, but only (1) has been released. (2) is awaiting a v9 cf CLI release

I propose that this issue is now complete, even though there is no v9 cf CLI release yet.

ctlong avatar Jul 16 '24 18:07 ctlong