Module: NewRelic::Security::Instrumentation::GraphQL::Query::Executor

Included in:
Prepend
Defined in:
lib/newrelic_security/instrumentation-security/graphql/chain.rb,
lib/newrelic_security/instrumentation-security/graphql/prepend.rb,
lib/newrelic_security/instrumentation-security/graphql/instrumentation.rb

Defined Under Namespace

Modules: Chain, Prepend

Constant Summary collapse

GRAPHQL_QUERY =
'GRAPHQL_QUERY'.freeze
GRAPHQL_VARIABLE =
'GRAPHQL_VARIABLE'.freeze
STAR_DOT_QUERY =
'*.query'.freeze
STAR_DOT_VARIABLES =
'*.variables'.freeze

Instance Method Summary collapse

Instance Method Details

#execute_on_enterObject



13
14
15
16
17
18
19
20
21
22
# File 'lib/newrelic_security/instrumentation-security/graphql/instrumentation.rb', line 13

def execute_on_enter
  NewRelic::Security::Agent.logger.debug "OnEnter : #{self.class}.#{__method__}"
  ctxt = NewRelic::Security::Agent::Control::HTTPContext.get_context
  ctxt.custom_data_type[STAR_DOT_QUERY] = GRAPHQL_QUERY if query.query_string
  ctxt.custom_data_type[STAR_DOT_VARIABLES] = GRAPHQL_VARIABLE if query.instance_variable_get(:@provided_variables)
rescue => exception
  NewRelic::Security::Agent.logger.error "Exception in hook in #{self.class}.#{__method__}, #{exception.inspect}, #{exception.backtrace}"
ensure
  yield
end