class GraphQL::Metrics::TimedResult

Attributes

duration[R]

NOTE: `time_since_offset` is used to produce start times timed phases of execution (validation, field resolution). These start times are relative to the executed operation's start time, which is captured at the outset of document parsing.

The times produced are intentionally similar to: github.com/apollographql/apollo-tracing#response-format

Taking a field resolver start offset example:

< start offset > |——————|———-|———> OS (t=0) FS (t=1) FE (t=2)

OS = Operation start time FS = Field resolver start time FE = Field resolver end time

result[R]

NOTE: `time_since_offset` is used to produce start times timed phases of execution (validation, field resolution). These start times are relative to the executed operation's start time, which is captured at the outset of document parsing.

The times produced are intentionally similar to: github.com/apollographql/apollo-tracing#response-format

Taking a field resolver start offset example:

< start offset > |——————|———-|———> OS (t=0) FS (t=1) FE (t=2)

OS = Operation start time FS = Field resolver start time FE = Field resolver end time

start_time[R]

NOTE: `time_since_offset` is used to produce start times timed phases of execution (validation, field resolution). These start times are relative to the executed operation's start time, which is captured at the outset of document parsing.

The times produced are intentionally similar to: github.com/apollographql/apollo-tracing#response-format

Taking a field resolver start offset example:

< start offset > |——————|———-|———> OS (t=0) FS (t=1) FE (t=2)

OS = Operation start time FS = Field resolver start time FE = Field resolver end time

time_since_offset[R]

NOTE: `time_since_offset` is used to produce start times timed phases of execution (validation, field resolution). These start times are relative to the executed operation's start time, which is captured at the outset of document parsing.

The times produced are intentionally similar to: github.com/apollographql/apollo-tracing#response-format

Taking a field resolver start offset example:

< start offset > |——————|———-|———> OS (t=0) FS (t=1) FE (t=2)

OS = Operation start time FS = Field resolver start time FE = Field resolver end time

Public Class Methods

new(offset_time = nil) { || ... } click to toggle source
# File lib/graphql/metrics.rb, line 77
def initialize(offset_time = nil)
  @offset_time = offset_time
  @start_time = GraphQL::Metrics.current_time_monotonic
  @result = yield
  @duration = GraphQL::Metrics.current_time_monotonic - @start_time
  @time_since_offset = @start_time - @offset_time if @offset_time
end