lib/opentelemetry/sdk/internal.rb in opentelemetry-sdk-0.11.1 vs lib/opentelemetry/sdk/internal.rb in opentelemetry-sdk-0.12.0
- old
+ new
@@ -43,10 +43,20 @@
def valid_value?(value)
valid_simple_value?(value) || valid_array_value?(value)
end
def valid_attributes?(attrs)
- attrs.nil? || attrs.all? { |k, v| valid_key?(k) && valid_value?(v) }
+ attrs.nil? || attrs.all? do |k, v|
+ if !valid_key?(k)
+ OpenTelemetry.handle_error(message: "invalid attribute key type #{v.class}")
+ false
+ elsif !valid_value?(v)
+ OpenTelemetry.handle_error(message: "invalid attribute value type #{v.class}")
+ false
+ else
+ true
+ end
+ end
end
end
end
end