From 792c3cf05a5210e80a86b39eba97384011d8e967 Mon Sep 17 00:00:00 2001 From: Florian Lehner Date: Mon, 11 Nov 2024 09:48:42 +0100 Subject: [PATCH] fixup: add OTel requirement level Signed-off-by: Florian Lehner --- reporter/otlp_reporter.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/reporter/otlp_reporter.go b/reporter/otlp_reporter.go index d742202c..2f4030c9 100644 --- a/reporter/otlp_reporter.go +++ b/reporter/otlp_reporter.go @@ -86,8 +86,10 @@ type traceEvents struct { // attrKeyValue is a helper to populate Profile.attribute_table. type attrKeyValue[T string | int64] struct { - key string - value T + key string + // Set to true for OTel SemConv attributes with RequirementL: Required + required bool + value T } // OTLPReporter receives and transforms information to be OTLP/profiles compliant. @@ -753,7 +755,7 @@ func addProfileAttributes[T string | int64](profile *profiles.Profile, switch val := any(attr.value).(type) { case string: - if val == "" { + if !attr.required && val == "" { return } attributeCompositeKey = attr.key + "_" + val