Support floats in statsd percentiles (#5572)
This commit is contained in:
@@ -48,6 +48,10 @@ type Size struct {
|
||||
Size int64
|
||||
}
|
||||
|
||||
type Number struct {
|
||||
Value float64
|
||||
}
|
||||
|
||||
// SetVersion sets the telegraf agent version
|
||||
func SetVersion(v string) error {
|
||||
if version != "" {
|
||||
@@ -124,6 +128,16 @@ func (s *Size) UnmarshalTOML(b []byte) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (n *Number) UnmarshalTOML(b []byte) error {
|
||||
value, err := strconv.ParseFloat(string(b), 64)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
n.Value = value
|
||||
return nil
|
||||
}
|
||||
|
||||
// ReadLines reads contents from a file and splits them by new lines.
|
||||
// A convenience wrapper to ReadLinesOffsetN(filename, 0, -1).
|
||||
func ReadLines(filename string) ([]string, error) {
|
||||
|
||||
Reference in New Issue
Block a user