Skip to content

Commit

Permalink
Fix double pct replacement in sysstat input (influxdata#6001)
Browse files Browse the repository at this point in the history
  • Loading branch information
danielnelson authored and bitcharmer committed Oct 18, 2019
1 parent 30579a4 commit 5e1d708
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions plugins/inputs/sysstat/sysstat.go
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,7 @@ func (s *Sysstat) sadfOptions(activityOption string) []string {
// escape removes % and / chars in field names
func escape(dirty string) string {
var fieldEscaper = strings.NewReplacer(
`%%`, "pct_",
`%`, "pct_",
`/`, "_per_",
)
Expand Down
4 changes: 4 additions & 0 deletions plugins/inputs/sysstat/sysstat_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,10 @@ func TestEscape(t *testing.T) {
"%util",
"pct_util",
},
{
"%%util",
"pct_util",
},
{
"bread/s",
"bread_per_s",
Expand Down

0 comments on commit 5e1d708

Please sign in to comment.