diff --git a/exporter/awsemfexporter/grouped_metric.go b/exporter/awsemfexporter/grouped_metric.go index dd3426cdc2e9..350c912aa0e1 100644 --- a/exporter/awsemfexporter/grouped_metric.go +++ b/exporter/awsemfexporter/grouped_metric.go @@ -194,6 +194,11 @@ func translateUnit(metric pmetric.Metric, descriptor map[string]MetricDescriptor } } switch unit { + case "1": + unit = "" + case "ns": + // CloudWatch doesn't support Nanoseconds + unit = "" case "ms": unit = "Milliseconds" case "s": @@ -202,7 +207,7 @@ func translateUnit(metric pmetric.Metric, descriptor map[string]MetricDescriptor unit = "Microseconds" case "By": unit = "Bytes" - case "Bi": + case "bit": unit = "Bits" } return unit diff --git a/exporter/awsemfexporter/grouped_metric_test.go b/exporter/awsemfexporter/grouped_metric_test.go index ac8d1f02b5a0..7f470a955505 100644 --- a/exporter/awsemfexporter/grouped_metric_test.go +++ b/exporter/awsemfexporter/grouped_metric_test.go @@ -485,10 +485,12 @@ func TestTranslateUnit(t *testing.T) { translateUnitCases := map[string]string{ "Count": "Count", "ms": "Milliseconds", + "ns": "", + "1": "", "s": "Seconds", "us": "Microseconds", "By": "Bytes", - "Bi": "Bits", + "bit": "Bits", } for input, output := range translateUnitCases { t.Run(input, func(_ *testing.T) {