Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add normalized CPU values and number of cores #4553

Merged
merged 3 commits into from Jun 26, 2017

Conversation

andrewkroh
Copy link
Member

This include the contents of #4550 (so merge that first and the amount to review will be smaller).

  • Added normalized CPU metrics for core, cpu, and process metricsets that are divided by the number of CPU cores.
  • Refactored helper code used by core, cpu, and load metricsets.
  • Deprecated use of cpu_ticks in favor of per metricset settings.

# if true, exports the CPU usage in ticks, together with the percentage values
#cpu_ticks: false
# Configure the metric types that are included by these metricsets.
cpu.metrics: [percentages] # The other available options are normalized_percentages and ticks.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add "quotes" around percentages? Seems we do this everywhere else with strings.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added the quotes for consistency. 3b23220

"idle": {
"pct": 0.9063,
"ticks": 22204290
"pct": 0,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you run it 2-3 more times, you should also get some values for the pct.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 96a5b91

// Config for the system core metricset.
type Config struct {
Metrics []string `config:"core.metrics"`
CPUTicks *bool `config:"cpu_ticks"` // Deprecated.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we deprecate it in 5.6 and remove it here?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ruflin Any reason to deprecate it in 5.6 instead of 6.0.0?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like deprecated features in the code base. If don't do it now, we have to wait until 7.0 to remove it. Seems like a good time to do it now. Any disadvantage doing it now?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it make sense to add deprecation warnings in 5.6 when there is no replacement for cpu_ticks in 5.6? I thought there should be some period of overlap where the two config options are available to aid in migration.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you mean no replacement in 6.0?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant 5.6. But possibly I misunderstood the original suggestion. You were suggesting adding the deprecation warnings in 5.6 and not having a migration path in 5.6 (e.g. we are telling the user not to use cpu_ticks, but not offering them an alternative in 5.6)?

// Validate validates the cpu config.
func (c Config) Validate() error {
if c.CPUTicks != nil {
logp.Deprecate("6.0.0", "cpu_ticks is deprecated. Add 'ticks' to the cpu.metrics list.")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See previous comment

@tsg
Copy link
Contributor

tsg commented Jun 26, 2017

Merged #4550, can you rebase this one, please? The flaky container failures in Metricbeat/travis should also be fixed after rebase.

Remove the arguments and use a constant to control the maximum number of decimal places.
@andrewkroh andrewkroh force-pushed the bugfix/6-0-cpu-normalization branch 2 times, most recently from e86be9d to 84e718f Compare June 26, 2017 13:51
@andrewkroh
Copy link
Member Author

I rebased the PR to resolve the conflicts, and squashed the commits where I addressed action items because I think it would be best to "Rebase and merge" this PR.

- Added normalized CPU metrics for core, cpu, and process metricsets that are divided by the number of CPU cores.
- Refactored helper code used by core, cpu, and load metricsets.
- Deprecated use of `cpu_ticks` in favor of per metricset settings.
@andrewkroh andrewkroh force-pushed the bugfix/6-0-cpu-normalization branch from 84e718f to 979091f Compare June 26, 2017 14:17
@tsg tsg merged commit d09da0c into elastic:master Jun 26, 2017
@andrewkroh andrewkroh deleted the bugfix/6-0-cpu-normalization branch July 5, 2017 19:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants