6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# File 'lib/has_helpers/sentry/graphql_trace.rb', line 6
def set_graphql_trace!(controller_name:, operation_name:, query:, user_id:)
return if operation_name.nil? || operation_name.to_s.strip.empty?
transaction_name = "#{controller_name}/#{operation_name}"
return unless defined?(::Sentry) &&
::Sentry.respond_to?(:configure_scope) &&
::Sentry.respond_to?(:set_tags)
::Sentry.configure_scope do |scope|
scope.set_transaction_name(transaction_name)
if user_id
scope.set_user(
id: user_id
)
end
end
::Sentry.set_tags(
graphql_operation_name: operation_name,
graphql_operation_type: graphql_operation_type(query)
)
end
|