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 laundry to mem input plugin on FreeBSD #7736

Merged
merged 4 commits into from
Jun 25, 2020
Merged

Conversation

danielnelson
Copy link
Contributor

closes: #7726

Required for all PRs:

  • Signed CLA.
  • Associated README.md updated.
  • Has appropriate unit tests.

@danielnelson danielnelson added the feat Improvement on an existing feature such as adding a new setting/mode to an existing plugin label Jun 24, 2020
@danielnelson danielnelson added this to the 1.15.0 milestone Jun 24, 2020
@danielnelson danielnelson requested a review from reimda June 24, 2020 21:24
@@ -61,6 +62,11 @@ func (s *MemStats) Gather(acc telegraf.Accumulator) error {
"write_back": vm.Writeback,
"write_back_tmp": vm.WritebackTmp,
}

if runtime.GOOS == "freebsd" {
fields["laundry"] = vm.Laundry
Copy link
Contributor

@reimda reimda Jun 24, 2020

Choose a reason for hiding this comment

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

Need to add this to README.md, maybe with a note that it's specific to freebsd

Copy link
Contributor

Choose a reason for hiding this comment

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

We already support active, inactive, and wired which are only valid on OS X and BSD. They're not handled conditionally at runtime. Maybe this doesn't need to be either.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Active/inactive are set on Linux, despite the comment in gopsutil. We really shouldn't be adding fields that aren't set, so I went through the stats again in more detail. One situation I'm not handling yet is the non-cgo version of Darwin.

@danielnelson danielnelson requested a review from reimda June 24, 2020 23:34
@danielnelson
Copy link
Contributor Author

Now that we are returning different fields depending on the platform, we are running into the issue where we need the test to be different depending on the host running the tests. To get around this I added a field to the struct that can be overridden in the tests to change the platform.

@danielnelson danielnelson merged commit 810bb6d into master Jun 25, 2020
@danielnelson danielnelson deleted the freebsd-mem-laundry branch June 25, 2020 17:50
rhajek pushed a commit to bonitoo-io/telegraf that referenced this pull request Jul 13, 2020
Additionally only report fields that may be set on the platform.
idohalevi pushed a commit to idohalevi/telegraf that referenced this pull request Sep 29, 2020
Additionally only report fields that may be set on the platform.
arstercz pushed a commit to arstercz/telegraf that referenced this pull request Mar 5, 2023
Additionally only report fields that may be set on the platform.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat Improvement on an existing feature such as adding a new setting/mode to an existing plugin
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add FreeBSD laundry memory usage
2 participants