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



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

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].



13
14
15
16
# File 'lib/graphql/tracing/sentry_trace.rb', line 13

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

#platform_authorized(platform_key, &block) ⇒ Object



52
53
54
# File 'lib/graphql/tracing/sentry_trace.rb', line 52

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

#platform_authorized_key(type) ⇒ Object



72
73
74
# File 'lib/graphql/tracing/sentry_trace.rb', line 72

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

#platform_authorized_lazy(platform_key, &block) ⇒ Object



56
57
58
# File 'lib/graphql/tracing/sentry_trace.rb', line 56

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

#platform_execute_field(platform_key, &block) ⇒ Object



44
45
46
# File 'lib/graphql/tracing/sentry_trace.rb', line 44

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

#platform_execute_field_lazy(platform_key, &block) ⇒ Object



48
49
50
# File 'lib/graphql/tracing/sentry_trace.rb', line 48

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

#platform_field_key(field) ⇒ Object



68
69
70
# File 'lib/graphql/tracing/sentry_trace.rb', line 68

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

#platform_resolve_type(platform_key, &block) ⇒ Object



60
61
62
# File 'lib/graphql/tracing/sentry_trace.rb', line 60

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

#platform_resolve_type_key(type) ⇒ Object



76
77
78
# File 'lib/graphql/tracing/sentry_trace.rb', line 76

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

#platform_resolve_type_lazy(platform_key, &block) ⇒ Object



64
65
66
# File 'lib/graphql/tracing/sentry_trace.rb', line 64

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