Fix double pct replacement in sysstat input (#6001)

This commit is contained in:
Daniel Nelson 2019-06-20 11:52:41 -07:00 committed by GitHub
parent 049d364917
commit 29c3d42e7e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 0 deletions

View File

@ -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_",
)

View File

@ -225,6 +225,10 @@ func TestEscape(t *testing.T) {
"%util",
"pct_util",
},
{
"%%util",
"pct_util",
},
{
"bread/s",
"bread_per_s",