diff --git a/internal/aws/containerinsight/utils.go b/internal/aws/containerinsight/utils.go index d912f49ccd21..2ef9d5565c09 100644 --- a/internal/aws/containerinsight/utils.go +++ b/internal/aws/containerinsight/utils.go @@ -196,11 +196,11 @@ func ConvertToOTLPMetrics(fields map[string]interface{}, tags map[string]string, case int64: intGauge(ilms.AppendEmpty(), key, unit, t, timestamp) case uint: - doubleGauge(ilms.AppendEmpty(), key, unit, float64(t), timestamp) + intGauge(ilms.AppendEmpty(), key, unit, int64(t), timestamp) case uint32: - doubleGauge(ilms.AppendEmpty(), key, unit, float64(t), timestamp) + intGauge(ilms.AppendEmpty(), key, unit, int64(t), timestamp) case uint64: - doubleGauge(ilms.AppendEmpty(), key, unit, float64(t), timestamp) + intGauge(ilms.AppendEmpty(), key, unit, int64(t), timestamp) case float32: doubleGauge(ilms.AppendEmpty(), key, unit, float64(t), timestamp) case float64: diff --git a/internal/aws/containerinsight/utils_test.go b/internal/aws/containerinsight/utils_test.go index 5c9e1340c677..47c8403fa5a6 100644 --- a/internal/aws/containerinsight/utils_test.go +++ b/internal/aws/containerinsight/utils_test.go @@ -115,6 +115,12 @@ func convertToInt64(value interface{}) int64 { return int64(t) case int64: return t + case uint: + return int64(t) + case uint32: + return int64(t) + case uint64: + return int64(t) default: valueType := fmt.Sprintf("%T", value) log.Printf("Detected unexpected type: %v", valueType) @@ -124,12 +130,6 @@ func convertToInt64(value interface{}) int64 { func convertToFloat64(value interface{}) float64 { switch t := value.(type) { - case uint: - return float64(t) - case uint32: - return float64(t) - case uint64: - return float64(t) case float32: return float64(t) case float64: