From 3628565e0b373ad83ac095a458eac3cd68430410 Mon Sep 17 00:00:00 2001 From: zhihonl <61301537+zhihonl@users.noreply.github.com> Date: Fri, 3 Nov 2023 16:30:08 -0400 Subject: [PATCH] Fix empty measurement field causing agent crash (#945) --- translator/translate/otel/receiver/adapter/translators.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/translator/translate/otel/receiver/adapter/translators.go b/translator/translate/otel/receiver/adapter/translators.go index 7c2b350310..a60b9fc7d9 100644 --- a/translator/translate/otel/receiver/adapter/translators.go +++ b/translator/translate/otel/receiver/adapter/translators.go @@ -152,6 +152,9 @@ func fromInputs(conf *confmap.Conf, validInputs map[string]bool, baseKey string) if skipInputSet.Contains(inputName) { // logs agent is separate from otel agent continue + } else if measurement := common.GetArray[any](conf, common.ConfigKey(cfgKey, common.MeasurementKey)); measurement != nil && len(measurement) == 0 { + log.Printf("W! Agent will not emit any metrics for %s due to empty measurement field ", inputName) + continue } else if multipleInputSet.Contains(inputName) { translators.Merge(fromMultipleInput(conf, inputName, "")) } else {