diff --git a/pkg/exporter/sumologicexporter/prometheus_formatter.go b/pkg/exporter/sumologicexporter/prometheus_formatter.go index a711032cbb..c5e4a860a8 100644 --- a/pkg/exporter/sumologicexporter/prometheus_formatter.go +++ b/pkg/exporter/sumologicexporter/prometheus_formatter.go @@ -68,7 +68,7 @@ func (f *prometheusFormatter) tags2String(attr pcommon.Map, labels pcommon.Map) attr.CopyTo(mergedAttributes) labels.Range(func(k string, v pcommon.Value) bool { - mergedAttributes.PutStr(k, v.Str()) + mergedAttributes.PutStr(k, v.AsString()) return true }) length := mergedAttributes.Len() diff --git a/pkg/exporter/sumologicexporter/prometheus_formatter_test.go b/pkg/exporter/sumologicexporter/prometheus_formatter_test.go index 5f34e196bb..86132467f7 100644 --- a/pkg/exporter/sumologicexporter/prometheus_formatter_test.go +++ b/pkg/exporter/sumologicexporter/prometheus_formatter_test.go @@ -57,10 +57,16 @@ func TestTags2String(t *testing.T) { require.NoError(t, err) _, attributes := exampleIntMetric() + attributes.PutInt("int", 200) + + labels := pcommon.NewMap() + labels.PutInt("l_int", 200) + labels.PutStr("l_str", "two") + assert.Equal( t, - prometheusTags(`{test="test_value",test2="second_value"}`), - f.tags2String(attributes, pcommon.NewMap()), + prometheusTags(`{test="test_value",test2="second_value",int="200",l_int="200",l_str="two"}`), + f.tags2String(attributes, labels), ) }