forked from influxdata/telegraf
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix memory_swap Metric and Add Config Option in procstat (#159)
- Loading branch information
Showing
7 changed files
with
116 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
//go:build linux || darwin | ||
|
||
package procstat | ||
|
||
// pulled this from this commit https://github.com/influxdata/telegraf/pull/13779 | ||
func collectMemmap(proc Process, prefix string, fields map[string]any) { | ||
memMapStats, err := proc.MemoryMaps(true) | ||
if err == nil && len(*memMapStats) == 1 { | ||
memMap := (*memMapStats)[0] | ||
fields[prefix+"memory_size"] = memMap.Size | ||
fields[prefix+"memory_pss"] = memMap.Pss | ||
fields[prefix+"memory_shared_clean"] = memMap.SharedClean | ||
fields[prefix+"memory_shared_dirty"] = memMap.SharedDirty | ||
fields[prefix+"memory_private_clean"] = memMap.PrivateClean | ||
fields[prefix+"memory_private_dirty"] = memMap.PrivateDirty | ||
fields[prefix+"memory_referenced"] = memMap.Referenced | ||
fields[prefix+"memory_anonymous"] = memMap.Anonymous | ||
fields[prefix+"memory_swap"] = memMap.Swap | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
//go:build windows | ||
|
||
package procstat | ||
|
||
func collectMemmap(Process, string, map[string]any) {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters