Exporter for machine metrics
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

18 lines
367 B

package collector
import (
"fmt"
"strconv"
"strings"
)
func splitToInts(str string, sep string) (ints []int, err error) {
for _, part := range strings.Split(str, sep) {
i, err := strconv.Atoi(part)
if err != nil {
return nil, fmt.Errorf("Could not split '%s' because %s is no int: %s", str, part, err)
}
ints = append(ints, i)
}
return ints, nil
}