From 9cfbe10247f1512cf961f92b3ab02c7630222225 Mon Sep 17 00:00:00 2001 From: Thomas Roehl Date: Tue, 22 Feb 2022 15:51:08 +0100 Subject: [PATCH] Add uint types to GangliaSink and LibgangliaSink --- sinks/gangliaSink.go | 14 ++++++++++++++ sinks/libgangliaSink.go | 9 +++++++++ 2 files changed, 23 insertions(+) diff --git a/sinks/gangliaSink.go b/sinks/gangliaSink.go index fa95f43..ae53dd8 100644 --- a/sinks/gangliaSink.go +++ b/sinks/gangliaSink.go @@ -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() diff --git a/sinks/libgangliaSink.go b/sinks/libgangliaSink.go index 051bd03..7136e42 100644 --- a/sinks/libgangliaSink.go +++ b/sinks/libgangliaSink.go @@ -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")