Skip to content

Commit 1251a67

Browse files
committed
Support GraphQL::Query::Partial in graphql instrumentation
1 parent 9e8fe43 commit 1251a67

File tree

1 file changed

+6
-2
lines changed
  • instrumentation/graphql/lib/opentelemetry/instrumentation/graphql/tracers

1 file changed

+6
-2
lines changed

instrumentation/graphql/lib/opentelemetry/instrumentation/graphql/tracers/graphql_trace.rb

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,12 @@ def analyze_query(query:, &block)
9999
def execute_query(query:, &block)
100100
attributes = {}
101101
attributes['graphql.operation.name'] = query.selected_operation_name if query.selected_operation_name
102-
attributes['graphql.operation.type'] = query.selected_operation.operation_type
103-
attributes['graphql.document'] = query.query_string
102+
if query.is_a?(::GraphQL::Query::Partial)
103+
attributes['graphql.partial.path'] = query.path.to_s
104+
else
105+
attributes['graphql.operation.type'] = query.selected_operation.operation_type
106+
attributes['graphql.document'] = query.query_string
107+
end
104108

105109
tracer.in_span('graphql.execute_query', attributes: attributes) do
106110
super

0 commit comments

Comments
 (0)