Class: GraphQL::Tracing::AppsignalTrace::AppsignalMonitor

Inherits:
MonitorTrace::Monitor show all
Includes:
MonitorTrace::Monitor::GraphQLSuffixNames
Defined in:
lib/graphql/tracing/appsignal_trace.rb

Defined Under Namespace

Classes: Event

Constant Summary

Constants included from MonitorTrace::Monitor::GraphQLSuffixNames

MonitorTrace::Monitor::GraphQLSuffixNames::ANALYZE_NAME, MonitorTrace::Monitor::GraphQLSuffixNames::EXECUTE_NAME, MonitorTrace::Monitor::GraphQLSuffixNames::LEX_NAME, MonitorTrace::Monitor::GraphQLSuffixNames::PARSE_NAME, MonitorTrace::Monitor::GraphQLSuffixNames::VALIDATE_NAME

Instance Method Summary collapse

Methods inherited from MonitorTrace::Monitor

#fallback_transaction_name, #initialize, #name_for, #start_event, #transaction_name

Constructor Details

This class inherits a constructor from GraphQL::Tracing::MonitorTrace::Monitor

Instance Method Details

#instrument(keyword, object) ⇒ Object

[View source]

24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/graphql/tracing/appsignal_trace.rb', line 24

def instrument(keyword, object)
  if keyword == :execute
    query = object.queries.first
    set_this_txn_name =  query.context[:set_appsignal_action_name]
    if set_this_txn_name == true || (set_this_txn_name.nil? && @set_transaction_name)
      Appsignal::Transaction.current.set_action(transaction_name(query))
    end
  end
  Appsignal.instrument(name_for(keyword, object)) do
    yield
  end
end