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 intel_pmu plugin #760

Merged
merged 7 commits into from Mar 16, 2018
Merged

Add intel_pmu plugin #760

merged 7 commits into from Mar 16, 2018

Conversation

pllopis
Copy link
Contributor

@pllopis pllopis commented Mar 9, 2018

This PR adds support for the intel_pmu plugin.

It supports the parameters that are documented here: https://collectd.org/documentation/manpages/collectd.conf.5.shtml#plugin_intel_pmu

The implementation uses the standard pattern as seen in other plugins using modern puppet types (also seen in other plugins).

I'd be glad to get any feedback on this. Thank you!

@juniorsysadmin juniorsysadmin added enhancement New feature or request needs-tests labels Mar 10, 2018
@juniorsysadmin
Copy link
Member

juniorsysadmin commented Mar 10, 2018

Seems okay. Just needs some docs in the README and some tests. Are you able to add them?

@pllopis
Copy link
Contributor Author

pllopis commented Mar 11, 2018

Thank you for the feedback! Just pushed some tests and docs to my branch (I believe this is still up to date so I did not rebase with master)

# https://collectd.org/documentation/manpages/collectd.conf.5.shtml#plugin_intel_pmu
class collectd::plugin::intel_pmu (
Enum['present', 'absent'] $ensure = 'present',
Optional[Boolean] $report_hardware_cache_events = undef,
Copy link
Member

Choose a reason for hiding this comment

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

What are the defaults from collected? Is it possible to default to True or False, instead of undef? This would be cleaner.

Copy link
Contributor Author

@pllopis pllopis Mar 12, 2018

Choose a reason for hiding this comment

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

According to the documentation, there are no defaults, therefore the defaults are an implementation detail, which is why I did not set any defaults. However, by inspecting the source, as of the latest version the default is that no events are selected at all.

Therefore I suggest to leave the boolean variables as false by default, to make this clear, and to force the behaviour of not selecting any PMU events by default.

Regarding parameters event_list and hardware_events, I believe it would be best to leave them undefined by default. According to the docs these are used together, and to define hardware_events one should also use event_list. Therefore I think it is more coherent to have them both undefined by default rather than to have event_list undefined but hardware_events as an empty list. I think that if hardware_events will not be used, it should not be defined and it should not end up in the resulting intel_pmu.conf.

One improvement that could be made to the current logic is to check that if hardware_events is defined, event_list should also be defined. I can submit a new commit with this.

Optional[Boolean] $report_kernel_pmu_events = undef,
Optional[Boolean] $report_software_events = undef,
Optional[String] $event_list = undef,
Optional[Array[String]] $hardware_events = undef,
Copy link
Member

Choose a reason for hiding this comment

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

Can the default be an empty array?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

See my comment above.

intel_pmu: require event_list to be defined if hardware_events is used
@pllopis
Copy link
Contributor Author

pllopis commented Mar 12, 2018

The latest commits set the boolean parameters to false by default and require event_list to be defined if hardware_events is used, as I described above. Also added a test for this case where it should fail.

@bastelfreak
Copy link
Member

Thanks for the work @pllopis !

@bastelfreak bastelfreak merged commit 3e740c9 into voxpupuli:master Mar 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants