Add uint types to GangliaSink and LibgangliaSink

This commit is contained in:
Thomas Roehl 2022-02-22 15:51:08 +01:00
parent 66275ecf74
commit 9cfbe10247
2 changed files with 23 additions and 0 deletions

View File

@ -134,9 +134,21 @@ func (s *GangliaSink) Write(point lp.CCMetric) error {
case int:
argstr = append(argstr,
fmt.Sprintf("--value=%d", value), "--type=int32")
case int32:
argstr = append(argstr,
fmt.Sprintf("--value=%d", value), "--type=int32")
case int64:
argstr = append(argstr,
fmt.Sprintf("--value=%d", value), "--type=int32")
case uint:
argstr = append(argstr,
fmt.Sprintf("--value=%d", value), "--type=uint32")
case uint32:
argstr = append(argstr,
fmt.Sprintf("--value=%d", value), "--type=uint32")
case uint64:
argstr = append(argstr,
fmt.Sprintf("--value=%d", value), "--type=uint32")
case string:
argstr = append(argstr,
fmt.Sprintf("--value=%q", value), "--type=string")
@ -155,3 +167,5 @@ func (s *GangliaSink) Flush() error {
func (s *GangliaSink) Close() {
}
func NewGangliaSink()

View File

@ -212,6 +212,15 @@ func (s *LibgangliaSink) Write(point lp.CCMetric) error {
case int:
c_value = C.CString(fmt.Sprintf("%d", real))
c_type = lookup("int32")
case uint64:
c_value = C.CString(fmt.Sprintf("%d", real))
c_type = lookup("uint32")
case uint32:
c_value = C.CString(fmt.Sprintf("%d", real))
c_type = lookup("uint32")
case uint:
c_value = C.CString(fmt.Sprintf("%d", real))
c_type = lookup("uint32")
case string:
c_value = C.CString(real)
c_type = lookup("string")