Class: GraphQL::Tracing::ScoutTrace::ScoutMonitor

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

Defined Under Namespace

Classes: Event

Constant Summary collapse

INSTRUMENT_OPTS =
{ scope: true }

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



16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/graphql/tracing/scout_trace.rb', line 16

def instrument(keyword, object)
  if keyword == :execute
    query = object.queries.first
    set_this_txn_name = query.context[:set_scout_transaction_name]
    if set_this_txn_name == true || (set_this_txn_name.nil? && @set_transaction_name)
      ScoutApm::Transaction.rename(transaction_name(query))
    end
  end

  ScoutApm::Tracer.instrument("GraphQL", name_for(keyword, object), INSTRUMENT_OPTS) do
    yield
  end
end