source_route 0.1.8 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Guardfile +23 -0
- data/README.md +3 -6
- data/Rakefile +1 -1
- data/examples/debug_how_logger_object_init_when_rails_start.rb +23 -0
- data/examples/show_init_files_when_rails_server_start.rb +2 -0
- data/examples/show_task_trace_in_rails.rb +1 -1
- data/lib/source_route/core_ext.rb +1 -7
- data/lib/source_route/formats/html.rb +4 -4
- data/lib/source_route/formats/html_semantic.slim +242 -0
- data/lib/source_route/generate_result.rb +120 -57
- data/lib/source_route/jsonify.rb +2 -1
- data/lib/source_route/tp_result.rb +142 -24
- data/lib/source_route/tp_result_chain.rb +26 -32
- data/lib/source_route/version.rb +1 -1
- data/lib/source_route/wrapper.rb +22 -26
- data/lib/source_route.rb +20 -10
- data/source_route.gemspec +4 -1
- data/test/source_route_test.rb +39 -43
- metadata +52 -8
- data/lib/source_route/formats/html_template.slim +0 -229
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: source_route
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- raykin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-09-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: awesome_print
|
@@ -70,16 +70,16 @@ dependencies:
|
|
70
70
|
name: bundler
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - "
|
73
|
+
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
75
|
+
version: '0'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - "
|
80
|
+
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
82
|
+
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: rake
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -136,6 +136,48 @@ dependencies:
|
|
136
136
|
- - ">="
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: '0'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: guard
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - ">="
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ">="
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0'
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: guard-shell
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - ">="
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '0'
|
160
|
+
type: :development
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - ">="
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: '0'
|
167
|
+
- !ruby/object:Gem::Dependency
|
168
|
+
name: guard-livereload
|
169
|
+
requirement: !ruby/object:Gem::Requirement
|
170
|
+
requirements:
|
171
|
+
- - ">="
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: '0'
|
174
|
+
type: :development
|
175
|
+
prerelease: false
|
176
|
+
version_requirements: !ruby/object:Gem::Requirement
|
177
|
+
requirements:
|
178
|
+
- - ">="
|
179
|
+
- !ruby/object:Gem::Version
|
180
|
+
version: '0'
|
139
181
|
description: Wrapper of TracePoint.
|
140
182
|
email:
|
141
183
|
- raykincoldxiao@gmail.com
|
@@ -146,16 +188,18 @@ files:
|
|
146
188
|
- ".gitignore"
|
147
189
|
- ".hound.yml"
|
148
190
|
- Gemfile
|
191
|
+
- Guardfile
|
149
192
|
- LICENSE.txt
|
150
193
|
- README.md
|
151
194
|
- Rakefile
|
195
|
+
- examples/debug_how_logger_object_init_when_rails_start.rb
|
152
196
|
- examples/show_init_files_when_rails_server_start.rb
|
153
197
|
- examples/show_task_trace_in_rails.rb
|
154
198
|
- examples/study_callback.rb
|
155
199
|
- lib/source_route.rb
|
156
200
|
- lib/source_route/core_ext.rb
|
157
201
|
- lib/source_route/formats/html.rb
|
158
|
-
- lib/source_route/formats/
|
202
|
+
- lib/source_route/formats/html_semantic.slim
|
159
203
|
- lib/source_route/generate_result.rb
|
160
204
|
- lib/source_route/json_overrides/activerecord_associations_association.rb
|
161
205
|
- lib/source_route/jsonify.rb
|
@@ -192,7 +236,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
192
236
|
version: '0'
|
193
237
|
requirements: []
|
194
238
|
rubyforge_project:
|
195
|
-
rubygems_version: 2.
|
239
|
+
rubygems_version: 2.4.8
|
196
240
|
signing_key:
|
197
241
|
specification_version: 4
|
198
242
|
summary: Wrapper of TracePoint.
|
@@ -1,229 +0,0 @@
|
|
1
|
-
doctype html
|
2
|
-
html
|
3
|
-
head
|
4
|
-
title Source Route Result
|
5
|
-
link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css"
|
6
|
-
link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.3/styles/github.min.css"
|
7
|
-
link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css"
|
8
|
-
link rel="stylesheet" href="https://cdn.rawgit.com/Urigo/angular-spinkit/master/build/angular-spinkit.min.css"
|
9
|
-
script src="http://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.3/highlight.min.js"
|
10
|
-
script src="http://cdnjs.cloudflare.com/ajax/libs/lodash.js/2.4.1/lodash.min.js"
|
11
|
-
script src="http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js"
|
12
|
-
|
13
|
-
css:
|
14
|
-
body { font-size: 24px }
|
15
|
-
pre { font-size: 20px }
|
16
|
-
.call-level-0 {}
|
17
|
-
.call-level-1 { margin-left: 50px }
|
18
|
-
.call-level-2 { margin-left: 100px }
|
19
|
-
.call-level-3 { margin-left: 150px }
|
20
|
-
.call-level-4 { margin-left: 200px }
|
21
|
-
.call-level-5 { margin-left: 250px }
|
22
|
-
.call-level-6 { margin-left: 300px }
|
23
|
-
.call-level-7 { margin-left: 300px }
|
24
|
-
.details .well { margin-bottom: 0; color: green }
|
25
|
-
body(ng-app="SourceRoute" ng-controller="MainCtrl" ng-cloak)
|
26
|
-
|
27
|
-
nav.navbar.navbar-default.navbar-static-top
|
28
|
-
.container
|
29
|
-
.container-fluid
|
30
|
-
.navbar-header
|
31
|
-
a.navbar-brand(href="#" ng-click="::resetTraceFilter()") ALL
|
32
|
-
ul.nav.navbar-nav
|
33
|
-
li(ng-repeat="event in tpEvents" ng-class="{active: event == traceFilter.event}")
|
34
|
-
a(href="#" ng-click="traceFilter.event = event" ng-bind="::event")
|
35
|
-
ul.nav.navbar-nav.navbar-right
|
36
|
-
li
|
37
|
-
a(disabled)
|
38
|
-
span Current Trace Count
|
39
|
-
span.badge<(ng-bind="currentCounter()")
|
40
|
-
|
41
|
-
.clearfix
|
42
|
-
|
43
|
-
.container
|
44
|
-
.level-header(ng-if="::traces[0].hasOwnProperty('parent_ids')" style="padding-bottom: 10px")
|
45
|
-
.btn-group>
|
46
|
-
button.btn.btn-default>(ng-click="outlineTrace()")
|
47
|
-
span> OutLine
|
48
|
-
span
|
49
|
-
button.btn.btn-primary(ng-click="expandAllTrace()") Expand ALL
|
50
|
-
|
51
|
-
.trace-flow
|
52
|
-
.row
|
53
|
-
.left-info.col-sm-4(ng-if="false")
|
54
|
-
.btn-group-vertical
|
55
|
-
button.btn.btn-default(ng-repeat="klass in ::definedClasses"
|
56
|
-
ng-click="traceFilter.defined_class = klass" style="height: 60px")
|
57
|
-
span(ng-bind="klass.substring(0, 40)" popover="{{klass}}" popover-trigger="mouseenter" popover-placement="bottom")
|
58
|
-
.traces.center-info.col-sm-12(ng-class="{{traceFilter.event}}")
|
59
|
-
.trace.well(ng-repeat="trace in traces | filter:traceFilter:true | filter:childParentFilterFn"
|
60
|
-
ng-class="callLevelClass(trace)" ng-controller="TpTraceCtrl")
|
61
|
-
|
62
|
-
.header(ng-init="showMoreDetail = false")
|
63
|
-
.btn-group.pull-right
|
64
|
-
button.btn.btn-info.btn-sm(ng-if="::hasChild()" ng-click="toggleChild()")
|
65
|
-
span(ng-hide="trace.childClosed")
|
66
|
-
i.fa.fa-angle-down
|
67
|
-
span(ng-show="trace.childClosed")
|
68
|
-
i.fa.fa-angle-right
|
69
|
-
span Child
|
70
|
-
button.btn.btn-info.btn-sm(ng-show="::containsDetail(trace)" ng-click="showMoreDetail = !showMoreDetail") Details
|
71
|
-
span(ng-bind="::tpSelfList[trace.tp_self]")
|
72
|
-
span
|
73
|
-
| .
|
74
|
-
mark.method-value(ng-bind="trace.method_id")
|
75
|
-
/ workaround for return_value is 'false' and return_value always to be string when existed
|
76
|
-
pulse-spinner(ng-show="togglingChild")
|
77
|
-
div(ng-if="trace.hasOwnProperty('return_value')")
|
78
|
-
span
|
79
|
-
| =>
|
80
|
-
span<(ng-bind="::trimString(trace.return_value, 200)")
|
81
|
-
|
82
|
-
.details(ng-if="showMoreDetail" style="margin-top: 10px")
|
83
|
-
.attrs.well.well-sm(ng-if="containsOtherAttrs(trace)")
|
84
|
-
span Attrs
|
85
|
-
div(hljs source="::combinedAttrs(trace) | json")
|
86
|
-
.local-vars.well.well-sm(ng-if="trace.local_var")
|
87
|
-
span Local Var
|
88
|
-
.local-values(hljs source="::trace.local_var | json")
|
89
|
-
.ins-vars.well.well-sm(ng-if="trace.instance_var")
|
90
|
-
span Instance Var
|
91
|
-
.ins-values(hljs source="::trace.instance_var | json")
|
92
|
-
.return-value(ng-if="trace.hasOwnProperty('return_value')")
|
93
|
-
span Return Value
|
94
|
-
.value(hljs source="::trace.return_value | json")
|
95
|
-
|
96
|
-
.right-info.col-sm-2
|
97
|
-
|
98
|
-
script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.8/angular.min.js"
|
99
|
-
script src="https://cdnjs.cloudflare.com/ajax/libs/angular-ui-bootstrap/0.12.0/ui-bootstrap-tpls.min.js"
|
100
|
-
script src="http://pc035860.github.io/angular-highlightjs/angular-highlightjs.min.js"
|
101
|
-
script src="https://cdn.rawgit.com/Urigo/angular-spinkit/master/build/angular-spinkit.min.js"
|
102
|
-
|
103
|
-
javascript:
|
104
|
-
sourceRoute = angular.module('SourceRoute', ['ui.bootstrap', 'hljs', 'angular-spinkit'])
|
105
|
-
sourceRoute.controller('MainCtrl', function($scope, $filter) {
|
106
|
-
|
107
|
-
$scope.trimString = function(str, length) {
|
108
|
-
return str.length > length ? str.substring(0, length - 3) + '...' : str;
|
109
|
-
}
|
110
|
-
|
111
|
-
$scope.traces = angular.element("#trace-data").data('trace')
|
112
|
-
$scope.tpSelfList = angular.element("#trace-data").data('tp-self-caches')
|
113
|
-
$scope.tpEvents = angular.element("#trace-data").data('tp-events')
|
114
|
-
$scope.childParentFilter = { hide_trace_ids: [] }
|
115
|
-
|
116
|
-
$scope.childParentFilterFn = function(trace) {
|
117
|
-
if (!trace.hasOwnProperty('parent_ids')) {
|
118
|
-
return true;
|
119
|
-
}
|
120
|
-
if (trace.parent_ids.length == 0) {
|
121
|
-
return true;
|
122
|
-
} else {
|
123
|
-
var shared_hide_parents = _.intersection(trace.parent_ids, $scope.childParentFilter.hide_trace_ids);
|
124
|
-
if (shared_hide_parents.length > 0 ) {
|
125
|
-
return false;
|
126
|
-
}
|
127
|
-
}
|
128
|
-
return true;
|
129
|
-
}
|
130
|
-
|
131
|
-
$scope.expandAllTrace = function() {
|
132
|
-
_.each($scope.traces, function(trace) { trace.childClosed = false; });
|
133
|
-
$scope.childParentFilter.hide_trace_ids = [];
|
134
|
-
}
|
135
|
-
|
136
|
-
$scope.outlineTrace = function() {
|
137
|
-
$scope.childParentFilter.hide_trace_ids = [];
|
138
|
-
_.chain($scope.traces).filter({parent_length: 0})
|
139
|
-
.each(function(trace) { trace.childClosed = true; $scope.childParentFilter.hide_trace_ids.push(trace.order_id) })
|
140
|
-
}
|
141
|
-
|
142
|
-
$scope.traceFilter = {event: $scope.tpEvents[0]}
|
143
|
-
if ($scope.tpEvents.length == 1 && angular.isUndefined($scope.traces[0].event)) {
|
144
|
-
_.each($scope.traces, function(trace) {
|
145
|
-
trace.event = $scope.tpEvents[0]
|
146
|
-
})
|
147
|
-
}
|
148
|
-
|
149
|
-
$scope.definedClasses = _.uniq(_.map($scope.traces, 'defined_class'))
|
150
|
-
|
151
|
-
$scope.callLevelClass = function(trace) {
|
152
|
-
if (trace.parent_length > 7) {
|
153
|
-
return 'call-level-7';
|
154
|
-
} else {
|
155
|
-
return 'call-level-' + trace.parent_length;
|
156
|
-
}
|
157
|
-
}
|
158
|
-
|
159
|
-
$scope.resetTraceFilter = function() {
|
160
|
-
$scope.traceFilter = {};
|
161
|
-
}
|
162
|
-
|
163
|
-
$scope.currentCounter = function() {
|
164
|
-
return $filter('filter')($scope.traces, $scope.traceFilter, true).length;
|
165
|
-
}
|
166
|
-
|
167
|
-
$scope.containsOtherAttrs = function(trace) {
|
168
|
-
return trace.hasOwnProperty('path') || trace.hasOwnProperty('lineno') ||
|
169
|
-
trace.hasOwnProperty('defined_class');
|
170
|
-
}
|
171
|
-
|
172
|
-
$scope.containsDetail = function(trace) {
|
173
|
-
return $scope.containsOtherAttrs(trace) || trace.hasOwnProperty('local_var') ||
|
174
|
-
trace.hasOwnProperty('instance_var')
|
175
|
-
}
|
176
|
-
|
177
|
-
$scope.combinedAttrs = function(trace) {
|
178
|
-
var attrs = {}
|
179
|
-
if (trace.hasOwnProperty('lineno') && trace.hasOwnProperty('path')) {
|
180
|
-
attrs.method_defined_on = trace.path + ":" + trace.lineno;
|
181
|
-
} else if (trace.hasOwnProperty('path')) {
|
182
|
-
attrs.method_defined_on = trace.path;
|
183
|
-
}
|
184
|
-
if (trace.hasOwnProperty('defined_class')) {
|
185
|
-
attrs.method_defined_in = trace.defined_class;
|
186
|
-
}
|
187
|
-
return attrs;
|
188
|
-
}
|
189
|
-
|
190
|
-
$scope.outlineTrace();
|
191
|
-
})
|
192
|
-
|
193
|
-
sourceRoute.controller('TpTraceCtrl', function($scope, $timeout) {
|
194
|
-
|
195
|
-
$scope.toggleChild = function() {
|
196
|
-
$scope.togglingChild = true
|
197
|
-
$timeout(function() {
|
198
|
-
if ($scope.trace.childClosed) {
|
199
|
-
$scope.showChild();
|
200
|
-
$scope.togglingChild = false
|
201
|
-
} else {
|
202
|
-
$scope.hideChild();
|
203
|
-
$scope.togglingChild = false
|
204
|
-
}
|
205
|
-
}, 0)
|
206
|
-
}
|
207
|
-
|
208
|
-
$scope.showChild = function() {
|
209
|
-
$scope.trace.childClosed = false;
|
210
|
-
_.pull($scope.childParentFilter.hide_trace_ids, $scope.trace.order_id);
|
211
|
-
}
|
212
|
-
|
213
|
-
$scope.hideChild = function() {
|
214
|
-
$scope.trace.childClosed = true;
|
215
|
-
$scope.childParentFilter.hide_trace_ids.push($scope.trace.order_id);
|
216
|
-
}
|
217
|
-
|
218
|
-
$scope.hasChild = function() {
|
219
|
-
return _.find($scope.traces, function(trace) {
|
220
|
-
return _.contains(trace.parent_ids, $scope.trace.order_id)
|
221
|
-
});
|
222
|
-
}
|
223
|
-
})
|
224
|
-
|
225
|
-
.data-collect
|
226
|
-
/ dont use local_trace_data.to_json, because ActiveSupport override it and can introduce unexpected crash for some data
|
227
|
-
#trace-data(data-trace="#{jsonify_tp_result_chain}"
|
228
|
-
data-tp-events="#{jsonify_events}"
|
229
|
-
data-tp-self-caches="#{jsonify_tp_self_caches}")
|