lib/graphql/tracing/platform_tracing.rb in graphql-1.13.4 vs lib/graphql/tracing/platform_tracing.rb in graphql-1.13.5

- old
+ new

@@ -102,20 +102,25 @@ schema_defn.tracer(tracer) end private - # Get the transaction name based on the operation type and name + # Get the transaction name based on the operation type and name if possible, or fall back to a user provided + # one. Useful for anonymous queries. def transaction_name(query) selected_op = query.selected_operation - if selected_op + txn_name = if selected_op op_type = selected_op.operation_type - op_name = selected_op.name || "anonymous" + op_name = selected_op.name || fallback_transaction_name(query.context) || "anonymous" + "#{op_type}.#{op_name}" else - op_type = "query" - op_name = "anonymous" + "query.anonymous" end - "GraphQL/#{op_type}.#{op_name}" + "GraphQL/#{txn_name}" + end + + def fallback_transaction_name(context) + context[:tracing_fallback_transaction_name] end attr_reader :options # Different kind of schema objects have different kinds of keys: