Class: DetailedTraceSpan

Inherits:
Object
  • Object
show all
Defined in:
lib/scout_apm/detailed_trace.rb

Overview

{

"type": "Standard",
"identity": {
  "id": "....",
  "parent_id": "....",
  "start_time": "01-01-01T00:00:00.0000Z",
  "stop_time": "01-01-01T00:00:00.0001Z",
  "operation": "SQL/User/find"
},
"tags": {
  "allocations": 1000,
  "db.statement": "SELECT * FROM users where id = 1",
  "db.rows": 1,
  "backtrace": [ {
    "file": "app/controllers/users_controller.rb",
    "line": 10,
    "function": "index"
  } ]
}

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(span_id, parent_id, start_instant, stop_instant, operation, tags) ⇒ DetailedTraceSpan

Returns a new instance of DetailedTraceSpan.



162
163
164
165
166
167
168
169
170
171
172
173
# File 'lib/scout_apm/detailed_trace.rb', line 162

def initialize(span_id, parent_id, start_instant, stop_instant, operation, tags)
  # This will be dynamic when we implement limited spans
  @span_type = "Standard"

  @span_id = span_id
  @parent_id = parent_id

  @start_instant = start_instant
  @stop_instant = stop_instant
  @operation = operation
  @tags = DetailedTraceTags(tags)
end

Instance Attribute Details

#operationObject (readonly)

What is the “name” of this span.

Examples:

SQL/User/find
Controller/Users/index
HTTP/GET/example.com


160
161
162
# File 'lib/scout_apm/detailed_trace.rb', line 160

def operation
  @operation
end

#parent_idObject (readonly)

Returns the value of attribute parent_id.



151
152
153
# File 'lib/scout_apm/detailed_trace.rb', line 151

def parent_id
  @parent_id
end

#span_idObject (readonly)

Returns the value of attribute span_id.



151
152
153
# File 'lib/scout_apm/detailed_trace.rb', line 151

def span_id
  @span_id
end

#span_typeObject (readonly)

Returns the value of attribute span_type.



150
151
152
# File 'lib/scout_apm/detailed_trace.rb', line 150

def span_type
  @span_type
end

#start_instantObject (readonly)

Returns the value of attribute start_instant.



152
153
154
# File 'lib/scout_apm/detailed_trace.rb', line 152

def start_instant
  @start_instant
end

#stop_instantObject (readonly)

Returns the value of attribute stop_instant.



152
153
154
# File 'lib/scout_apm/detailed_trace.rb', line 152

def stop_instant
  @stop_instant
end

#tagsObject (readonly)

Returns the value of attribute tags.



148
149
150
# File 'lib/scout_apm/detailed_trace.rb', line 148

def tags
  @tags
end

Instance Method Details

#as_jsonObject



175
176
177
178
179
180
181
182
183
184
185
186
187
# File 'lib/scout_apm/detailed_trace.rb', line 175

def as_json(*)
  {
    :type => @span_type,
    :identity => {
      :id => span_id,
      :parent_id => parent_id,
      :start_instant => start_instant.iso8601(6),
      :stop_instant => stop_instant.iso8601(6),
      :operation => operation,
    },
    :tags => @tags.as_json,
  }
end