Module: Gitlab::Graphql::Tracers::InstrumentationTracer
- Defined in:
- lib/gitlab/graphql/tracers/instrumentation_tracer.rb
Overview
This tracer writes logs for certain trace events.
Constant Summary collapse
- MUTATION_REGEXP =
/^mutation/- IGNORED_ERRORS =
[ ::Subscriptions::BaseSubscription::UNAUTHORIZED_ERROR_MESSAGE ].freeze
Instance Method Summary collapse
-
#execute_multiplex(multiplex:) ⇒ Object
All queries pass through a multiplex, even if only one query is executed github.com/rmosolgo/graphql-ruby/blob/43e377b5b743a9102381d6ad3adaaed13ff5b6dd/lib/graphql/schema.rb#L1303.
Instance Method Details
#execute_multiplex(multiplex:) ⇒ Object
All queries pass through a multiplex, even if only one query is executed github.com/rmosolgo/graphql-ruby/blob/43e377b5b743a9102381d6ad3adaaed13ff5b6dd/lib/graphql/schema.rb#L1303
Instrumenting the multiplex ensures that all queries have been fully exectued meaning that query.result is present. We need query.result to know if the query was successful or not in metrics and to include the errors in the logs.
21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/gitlab/graphql/tracers/instrumentation_tracer.rb', line 21 def execute_multiplex(multiplex:) start_time = ::Gitlab::Metrics::System.monotonic_time super rescue StandardError => e raise ensure duration_s = ::Gitlab::Metrics::System.monotonic_time - start_time multiplex.queries.each do |query| export_query_info(query: query, duration_s: duration_s, exception: e) end end |