module GraphQL::Metrics

Constants

ANALYSIS_DURATION
ANALYSIS_START_TIME_OFFSET
ANALYZER_INSTANCE_KEY
CONTEXT_NAMESPACE

The context namespace for all values stored by this gem.

INLINE_FIELD_TIMINGS
LAZY_FIELD_TIMINGS
LEXING_DURATION
LEXING_START_TIME_OFFSET
MULTIPLEX_START_TIME

Context keys to store timings for query phases of execution, field resolver timings.

MULTIPLEX_START_TIME_MONOTONIC
PARSING_DURATION
PARSING_START_TIME_OFFSET
QUERY_START_TIME
QUERY_START_TIME_MONOTONIC
SKIP_FIELD_AND_ARGUMENT_METRICS

Skips just field and argument logging, when query metrics logging is still desirable

SKIP_GRAPHQL_METRICS_ANALYSIS

Skip metrics capture altogher, by setting `skip_graphql_metrics_analysis: true` in query context.

TIMINGS_CAPTURE_ENABLED

Timings related constants.

VALIDATION_DURATION
VALIDATION_START_TIME_OFFSET
VERSION

Public Class Methods

current_time() click to toggle source
# File lib/graphql/metrics.rb, line 45
def self.current_time
  Process.clock_gettime(Process::CLOCK_REALTIME)
end
current_time_monotonic() click to toggle source
# File lib/graphql/metrics.rb, line 49
def self.current_time_monotonic
  Process.clock_gettime(Process::CLOCK_MONOTONIC)
end
time(*args) { || ... } click to toggle source
# File lib/graphql/metrics.rb, line 53
def self.time(*args)
  TimedResult.new(*args) { yield }
end
timings_capture_enabled?(context) click to toggle source
# File lib/graphql/metrics.rb, line 40
def self.timings_capture_enabled?(context)
  return false unless context
  !!context.namespace(CONTEXT_NAMESPACE)[TIMINGS_CAPTURE_ENABLED]
end