Class: GraphQL::Metrics::TimedResult
- Inherits:
-
Object
- Object
- GraphQL::Metrics::TimedResult
- Defined in:
- lib/graphql/metrics.rb
Instance Attribute Summary collapse
-
#duration ⇒ Object
readonly
NOTE: ‘time_since_offset` is used to produce start times timed phases of execution (validation, field resolution).
-
#result ⇒ Object
readonly
NOTE: ‘time_since_offset` is used to produce start times timed phases of execution (validation, field resolution).
-
#start_time ⇒ Object
readonly
NOTE: ‘time_since_offset` is used to produce start times timed phases of execution (validation, field resolution).
-
#time_since_offset ⇒ Object
readonly
NOTE: ‘time_since_offset` is used to produce start times timed phases of execution (validation, field resolution).
Instance Method Summary collapse
-
#initialize(offset_time = nil) ⇒ TimedResult
constructor
A new instance of TimedResult.
Constructor Details
#initialize(offset_time = nil) ⇒ TimedResult
Returns a new instance of TimedResult.
77 78 79 80 81 82 83 |
# 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 |
Instance Attribute Details
#duration ⇒ Object (readonly)
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
75 76 77 |
# File 'lib/graphql/metrics.rb', line 75 def duration @duration end |
#result ⇒ Object (readonly)
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
75 76 77 |
# File 'lib/graphql/metrics.rb', line 75 def result @result end |
#start_time ⇒ Object (readonly)
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
75 76 77 |
# File 'lib/graphql/metrics.rb', line 75 def start_time @start_time end |
#time_since_offset ⇒ Object (readonly)
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
75 76 77 |
# File 'lib/graphql/metrics.rb', line 75 def time_since_offset @time_since_offset end |