From 937ea1c41f82c23395a37543ca18cb6060b3b0b6 Mon Sep 17 00:00:00 2001 From: Elena Tanasoiu Date: Fri, 16 Feb 2024 15:05:38 +0000 Subject: [PATCH] Appease Rubocop --- .../instrumentation/graphql/tracers/graphql_tracer.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/instrumentation/graphql/lib/opentelemetry/instrumentation/graphql/tracers/graphql_tracer.rb b/instrumentation/graphql/lib/opentelemetry/instrumentation/graphql/tracers/graphql_tracer.rb index 45d9c7b5d..827f44e3a 100644 --- a/instrumentation/graphql/lib/opentelemetry/instrumentation/graphql/tracers/graphql_tracer.rb +++ b/instrumentation/graphql/lib/opentelemetry/instrumentation/graphql/tracers/graphql_tracer.rb @@ -124,8 +124,10 @@ def attributes_for(key, data) when 'execute_query' attrs = {} attrs['graphql.document'] = data[:query].query_string if data[:query].query_string + # rubocop:disable Style/SafeNavigation - using safe navigation creates more objects, we want to avoid this attrs['graphql.operation.type'] = data[:query].selected_operation.operation_type if data[:query].selected_operation && data[:query].selected_operation.operation_type - attrs['graphql.operation.name'] = data[:query].selected_operation_name || "anonymous" + # rubocop:enable Style/SafeNavigation + attrs['graphql.operation.name'] = data[:query].selected_operation_name || 'anonymous' attrs.freeze else {}