Class: DetailedTrace
- Inherits:
-
Object
- Object
- DetailedTrace
- Defined in:
- lib/scout_apm/detailed_trace.rb
Overview
{ “version”: 1, “identity”: {
"transaction_id": "req-....",
"revision": "abcdef",
"start_instant": "01-01-01T00:00:00.0000Z",
"stop_instant": "01-01-01T00:00:01.0000Z",
"type": "Web",
"naming": {
"path": "/users",
"code": "UsersController#index",
},
"score": {
"total": 10.5,
"percentile": 4.5,
"age": 2.0,
"memory_delta": 3,
"allocations": 1
}
},
“tags”:
"allocations": 1000
,
“spans”: [
...
]
Constant Summary collapse
- VERSION =
1
Instance Attribute Summary collapse
-
#age_score ⇒ Object
readonly
Returns the value of attribute age_score.
-
#code ⇒ Object
readonly
UsersController#show or similar.
-
#duration ⇒ Object
readonly
Returns the value of attribute duration.
-
#host ⇒ Object
readonly
Returns the value of attribute host.
-
#memory_allocations_score ⇒ Object
readonly
Returns the value of attribute memory_allocations_score.
-
#memory_delta_score ⇒ Object
readonly
Returns the value of attribute memory_delta_score.
-
#path ⇒ Object
readonly
/users/1.
-
#percentile_score ⇒ Object
readonly
Returns the value of attribute percentile_score.
-
#revision ⇒ Object
readonly
Returns the value of attribute revision.
-
#spans ⇒ Object
readonly
Returns the value of attribute spans.
-
#start_instant ⇒ Object
readonly
Returns the value of attribute start_instant.
-
#stop_instant ⇒ Object
readonly
Returns the value of attribute stop_instant.
-
#tags ⇒ Object
readonly
Returns the value of attribute tags.
-
#total_score ⇒ Object
readonly
Returns the value of attribute total_score.
-
#transaction_id ⇒ Object
readonly
Returns the value of attribute transaction_id.
-
#type ⇒ Object
readonly
“Web” or “Job”.
Instance Method Summary collapse
- #as_json ⇒ Object
-
#call ⇒ Object
Scorable interface.
-
#initialize(transaction_id, revision, host, start_instant, stop_instant, type, path, code, spans, tags) ⇒ DetailedTrace
constructor
A new instance of DetailedTrace.
- #name ⇒ Object
- #score ⇒ Object
Constructor Details
#initialize(transaction_id, revision, host, start_instant, stop_instant, type, path, code, spans, tags) ⇒ DetailedTrace
Returns a new instance of DetailedTrace.
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/scout_apm/detailed_trace.rb', line 56 def initialize(transaction_id, revision, host, start_instant, stop_instant, type, path, code, spans, ) @spans = spans @tags = DetailedTraceTags() @transaction_id = transaction_id @revision = revision @host = host @start_instant = start_instant @stop_instant = stop_instant @type = type @path = path @code = code @total_score = 0 @percentile_score = 0 @age_score = 0 @memory_delta_score = 0 @memory_allocations_score = 0 end |
Instance Attribute Details
#age_score ⇒ Object (readonly)
Returns the value of attribute age_score.
50 51 52 |
# File 'lib/scout_apm/detailed_trace.rb', line 50 def age_score @age_score end |
#code ⇒ Object (readonly)
UsersController#show or similar
46 47 48 |
# File 'lib/scout_apm/detailed_trace.rb', line 46 def code @code end |
#duration ⇒ Object (readonly)
Returns the value of attribute duration.
41 42 43 |
# File 'lib/scout_apm/detailed_trace.rb', line 41 def duration @duration end |
#host ⇒ Object (readonly)
Returns the value of attribute host.
43 44 45 |
# File 'lib/scout_apm/detailed_trace.rb', line 43 def host @host end |
#memory_allocations_score ⇒ Object (readonly)
Returns the value of attribute memory_allocations_score.
52 53 54 |
# File 'lib/scout_apm/detailed_trace.rb', line 52 def memory_allocations_score @memory_allocations_score end |
#memory_delta_score ⇒ Object (readonly)
Returns the value of attribute memory_delta_score.
51 52 53 |
# File 'lib/scout_apm/detailed_trace.rb', line 51 def memory_delta_score @memory_delta_score end |
#path ⇒ Object (readonly)
/users/1
45 46 47 |
# File 'lib/scout_apm/detailed_trace.rb', line 45 def path @path end |
#percentile_score ⇒ Object (readonly)
Returns the value of attribute percentile_score.
49 50 51 |
# File 'lib/scout_apm/detailed_trace.rb', line 49 def percentile_score @percentile_score end |
#revision ⇒ Object (readonly)
Returns the value of attribute revision.
38 39 40 |
# File 'lib/scout_apm/detailed_trace.rb', line 38 def revision @revision end |
#spans ⇒ Object (readonly)
Returns the value of attribute spans.
34 35 36 |
# File 'lib/scout_apm/detailed_trace.rb', line 34 def spans @spans end |
#start_instant ⇒ Object (readonly)
Returns the value of attribute start_instant.
39 40 41 |
# File 'lib/scout_apm/detailed_trace.rb', line 39 def start_instant @start_instant end |
#stop_instant ⇒ Object (readonly)
Returns the value of attribute stop_instant.
40 41 42 |
# File 'lib/scout_apm/detailed_trace.rb', line 40 def stop_instant @stop_instant end |
#tags ⇒ Object (readonly)
Returns the value of attribute tags.
35 36 37 |
# File 'lib/scout_apm/detailed_trace.rb', line 35 def @tags end |
#total_score ⇒ Object (readonly)
Returns the value of attribute total_score.
48 49 50 |
# File 'lib/scout_apm/detailed_trace.rb', line 48 def total_score @total_score end |
#transaction_id ⇒ Object (readonly)
Returns the value of attribute transaction_id.
37 38 39 |
# File 'lib/scout_apm/detailed_trace.rb', line 37 def transaction_id @transaction_id end |
#type ⇒ Object (readonly)
“Web” or “Job”
42 43 44 |
# File 'lib/scout_apm/detailed_trace.rb', line 42 def type @type end |
Instance Method Details
#as_json ⇒ Object
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
# File 'lib/scout_apm/detailed_trace.rb', line 78 def as_json(*) { :version => VERSION, :identity => { :transaction_id => transaction_id, :revision => revision, :host => host, :start_instant => start_instant.iso8601(6), :stop_instant => stop_instant.iso8601(6), :type => type, :naming => { :path => path, :code => code, }, :score => { :total => total_score, :percentile => percentile_score, :age => age_score, :memory_delta => memory_delta_score, :allocations => memory_allocations_score, } }, :tags => .as_json, :spans => spans.map{|span| span.as_json}, } end |
#call ⇒ Object
Scorable interface
Needed so we can merge ScoredItemSet instances
109 110 111 |
# File 'lib/scout_apm/detailed_trace.rb', line 109 def call self end |
#name ⇒ Object
113 114 115 |
# File 'lib/scout_apm/detailed_trace.rb', line 113 def name code end |
#score ⇒ Object
117 118 119 |
# File 'lib/scout_apm/detailed_trace.rb', line 117 def score @total_score end |