Module: GraphQL::Tracing::SentryTrace

Includes:
PlatformTrace
Defined in:
lib/graphql/tracing/sentry_trace.rb

Instance Method Summary collapse

Instance Method Details

#execute_query(**data) ⇒ Object



16
17
18
19
20
21
22
23
24
# File 'lib/graphql/tracing/sentry_trace.rb', line 16

def execute_query(**data)
  set_this_txn_name = data[:query].context[:set_sentry_transaction_name]
  if set_this_txn_name == true || (set_this_txn_name.nil? && @set_transaction_name)
    Sentry.configure_scope do |scope|
      scope.set_transaction_name(transaction_name(data[:query]))
    end
  end
  instrument_sentry_execution("graphql.execute", "execute_query", data) { super }
end

#initialize(set_transaction_name: false, **_rest) ⇒ Object

Parameters:

  • set_transaction_name (Boolean) (defaults to: false)

    If true, the GraphQL operation name will be used as the transaction name. This is not advised if you run more than one query per HTTP request, for example, with graphql-client or multiplexing. It can also be specified per-query with context[:set_sentry_transaction_name].



11
12
13
14
# File 'lib/graphql/tracing/sentry_trace.rb', line 11

def initialize(set_transaction_name: false, **_rest)
  @set_transaction_name = set_transaction_name
  super
end

#platform_authorized(platform_key, &block) ⇒ Object



50
51
52
# File 'lib/graphql/tracing/sentry_trace.rb', line 50

def platform_authorized(platform_key, &block)
  instrument_sentry_execution(platform_key, "authorized", &block)
end

#platform_authorized_key(type) ⇒ Object



70
71
72
# File 'lib/graphql/tracing/sentry_trace.rb', line 70

def platform_authorized_key(type)
  "graphql.authorized.#{type.graphql_name}"
end

#platform_authorized_lazy(platform_key, &block) ⇒ Object



54
55
56
# File 'lib/graphql/tracing/sentry_trace.rb', line 54

def platform_authorized_lazy(platform_key, &block)
  instrument_sentry_execution(platform_key, "authorized_lazy", &block)
end

#platform_execute_field(platform_key, &block) ⇒ Object



42
43
44
# File 'lib/graphql/tracing/sentry_trace.rb', line 42

def platform_execute_field(platform_key, &block)
  instrument_sentry_execution(platform_key, "execute_field", &block)
end

#platform_execute_field_lazy(platform_key, &block) ⇒ Object



46
47
48
# File 'lib/graphql/tracing/sentry_trace.rb', line 46

def platform_execute_field_lazy(platform_key, &block)
  instrument_sentry_execution(platform_key, "execute_field_lazy", &block)
end

#platform_field_key(field) ⇒ Object



66
67
68
# File 'lib/graphql/tracing/sentry_trace.rb', line 66

def platform_field_key(field)
  "graphql.field.#{field.path}"
end

#platform_resolve_type(platform_key, &block) ⇒ Object



58
59
60
# File 'lib/graphql/tracing/sentry_trace.rb', line 58

def platform_resolve_type(platform_key, &block)
  instrument_sentry_execution(platform_key, "resolve_type", &block)
end

#platform_resolve_type_key(type) ⇒ Object



74
75
76
# File 'lib/graphql/tracing/sentry_trace.rb', line 74

def platform_resolve_type_key(type)
  "graphql.resolve_type.#{type.graphql_name}"
end

#platform_resolve_type_lazy(platform_key, &block) ⇒ Object



62
63
64
# File 'lib/graphql/tracing/sentry_trace.rb', line 62

def platform_resolve_type_lazy(platform_key, &block)
  instrument_sentry_execution(platform_key, "resolve_type_lazy", &block)
end