Add line protocol uint64 support (#3946)

This commit is contained in:
Matt
2018-03-28 19:43:25 -04:00
committed by Daniel Nelson
parent 741abbf590
commit 006ccbf05b
12 changed files with 8046 additions and 6754 deletions

View File

@@ -237,6 +237,8 @@ func (s *Serializer) writeMetric(w io.Writer, m telegraf.Metric) error {
func appendFieldValue(buf []byte, value interface{}) ([]byte, error) {
switch v := value.(type) {
case uint64:
return appendUintField(buf, v), nil
case int64:
return appendIntField(buf, v), nil
case float64:
@@ -257,6 +259,10 @@ func appendFieldValue(buf []byte, value interface{}) ([]byte, error) {
return buf, ErrInvalidFieldType
}
func appendUintField(buf []byte, value uint64) []byte {
return append(strconv.AppendUint(buf, value, 10), 'u')
}
func appendIntField(buf []byte, value int64) []byte {
return append(strconv.AppendInt(buf, value, 10), 'i')
}