lib/opentelemetry/instrumentation/graphql/tracers/graphql_trace.rb in opentelemetry-instrumentation-graphql-0.26.2 vs lib/opentelemetry/instrumentation/graphql/tracers/graphql_trace.rb in opentelemetry-instrumentation-graphql-0.26.3

- old
+ new

@@ -34,15 +34,16 @@ end def validate(query:, validate:, &block) tracer.in_span('graphql.validate') do |span| super.tap do |response| - errors = response[:errors]&.compact&.map(&:to_h)&.to_json - unless errors.nil? + errors = response[:errors]&.compact&.map(&:to_h) || [] + + unless errors.empty? span.add_event( 'graphql.validation.error', attributes: { - 'message' => errors + 'exception.message' => errors.to_json } ) end end end