instana 1.4.2 → 1.4.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/instana/frameworks/instrumentation/action_controller.rb +41 -2
- data/lib/instana/tracing/span.rb +9 -0
- data/lib/instana/version.rb +1 -1
- data/test/frameworks/rails/actionview3_test.rb +147 -1
- data/test/frameworks/rails/actionview4_test.rb +147 -1
- data/test/frameworks/rails/actionview5_test.rb +147 -1
- data/test/servers/rails_3205.rb +43 -1
- data/test/tracing/opentracing_test.rb +27 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f2d72e4ebe2d8f5b7c78ea47e40e04a37ba063e4
|
4
|
+
data.tar.gz: 97b8eb1c78242d4c94d48370a4916c90c0217012
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9d1176fc22477cacbaa80940fb73f422183c938c1228b9134e2b3d3cd36452db779318a5b06ec8ae891afaeabdca8052191aac623c97ddc158c6ae90e655917a
|
7
|
+
data.tar.gz: f2523904ba96880a37254e8fcea1ae64d91fa51bb46baebcbccf7831612118232d7ecdd1b91d847717b9864dce8cfaf670121ca4b19b675df8241c06bc0a5484
|
@@ -24,6 +24,34 @@ module Instana
|
|
24
24
|
::Instana.logger.debug "#{__method__}:#{File.basename(__FILE__)}:#{__LINE__}: #{e.message}"
|
25
25
|
return false
|
26
26
|
end
|
27
|
+
|
28
|
+
# Render can be called with many options across the various supported
|
29
|
+
# versions of Rails. This method attempts to make sense and provide
|
30
|
+
# insight into what is happening (rendering a layout, file, nothing,
|
31
|
+
# plaintext etc.)
|
32
|
+
def get_render_topic(opts)
|
33
|
+
if opts.key?(:layout)
|
34
|
+
case opts[:layout]
|
35
|
+
when FalseClass
|
36
|
+
name = "Without layout"
|
37
|
+
when String
|
38
|
+
name = opts[:layout]
|
39
|
+
when Proc
|
40
|
+
name = "Proc"
|
41
|
+
else
|
42
|
+
name = "Default"
|
43
|
+
end
|
44
|
+
end
|
45
|
+
name ||= opts[:template]
|
46
|
+
name ||= opts[:file]
|
47
|
+
name = "Nothing" if opts[:nothing]
|
48
|
+
name = "Plaintext" if opts[:plain]
|
49
|
+
name = "JSON" if opts[:json]
|
50
|
+
name = "XML" if opts[:xml]
|
51
|
+
name = "Raw" if opts[:body]
|
52
|
+
name = "Javascript" if opts[:js]
|
53
|
+
name
|
54
|
+
end
|
27
55
|
end
|
28
56
|
|
29
57
|
# Used in ActionPack versions 5 and beyond, this module provides
|
@@ -54,7 +82,14 @@ module Instana
|
|
54
82
|
# for versions 5+.
|
55
83
|
#
|
56
84
|
def render(*args, &blk)
|
57
|
-
|
85
|
+
# Figure out what's being rendered
|
86
|
+
if args.length > 0 && args[0].is_a?(Hash)
|
87
|
+
name = get_render_topic(args[0])
|
88
|
+
end
|
89
|
+
name ||= "Default"
|
90
|
+
|
91
|
+
::Instana.tracer.log_entry(:actionview, :actionview => { :name => name })
|
92
|
+
|
58
93
|
super(*args, &blk)
|
59
94
|
rescue Exception => e
|
60
95
|
::Instana.tracer.log_error(e) unless has_rails_handler?
|
@@ -99,7 +134,11 @@ module Instana
|
|
99
134
|
# for versions 3 and 4.
|
100
135
|
#
|
101
136
|
def render_with_instana(*args, &blk)
|
102
|
-
|
137
|
+
if args.length > 0 && args[0].is_a?(Hash)
|
138
|
+
name = get_render_topic(args[0])
|
139
|
+
end
|
140
|
+
name ||= "Default"
|
141
|
+
::Instana.tracer.log_entry(:actionview, :actionview => { :name => name })
|
103
142
|
render_without_instana(*args, &blk)
|
104
143
|
rescue Exception => e
|
105
144
|
::Instana.tracer.log_error(e) unless has_rails_handler?
|
data/lib/instana/tracing/span.rb
CHANGED
@@ -271,6 +271,15 @@ module Instana
|
|
271
271
|
if custom?
|
272
272
|
@data[:data][:sdk][:custom] ||= {}
|
273
273
|
@data[:data][:sdk][:custom][key] = value
|
274
|
+
|
275
|
+
if key.to_sym == :'span.kind'
|
276
|
+
case value.to_sym
|
277
|
+
when :server || :consumer
|
278
|
+
@data[:data][:sdk][:type] = :entry
|
279
|
+
when :client || :producer
|
280
|
+
@data[:data][:sdk][:type] = :exit
|
281
|
+
end
|
282
|
+
end
|
274
283
|
else
|
275
284
|
if !@data[:data].key?(key)
|
276
285
|
@data[:data][key] = value
|
data/lib/instana/version.rb
CHANGED
@@ -27,6 +27,153 @@ class ActionViewTest < Minitest::Test
|
|
27
27
|
assert_equal :actionview, third_span.name
|
28
28
|
end
|
29
29
|
|
30
|
+
def test_render_nothing
|
31
|
+
clear_all!
|
32
|
+
|
33
|
+
Net::HTTP.get(URI.parse('http://localhost:3205/test/render_nothing'))
|
34
|
+
|
35
|
+
traces = Instana.processor.queued_traces
|
36
|
+
assert_equal 1, traces.count
|
37
|
+
trace = traces.first
|
38
|
+
|
39
|
+
assert_equal 3, trace.spans.count
|
40
|
+
spans = trace.spans.to_a
|
41
|
+
first_span = spans[0]
|
42
|
+
second_span = spans[1]
|
43
|
+
third_span = spans[2]
|
44
|
+
|
45
|
+
assert_equal :rack, first_span.name
|
46
|
+
assert_equal :actioncontroller, second_span.name
|
47
|
+
assert_equal "Nothing", third_span[:data][:actionview][:name]
|
48
|
+
assert_equal :actionview, third_span.name
|
49
|
+
end
|
50
|
+
|
51
|
+
def test_render_file
|
52
|
+
clear_all!
|
53
|
+
|
54
|
+
Net::HTTP.get(URI.parse('http://localhost:3205/test/render_file'))
|
55
|
+
|
56
|
+
traces = Instana.processor.queued_traces
|
57
|
+
assert_equal 1, traces.count
|
58
|
+
trace = traces.first
|
59
|
+
|
60
|
+
assert_equal 3, trace.spans.count
|
61
|
+
spans = trace.spans.to_a
|
62
|
+
first_span = spans[0]
|
63
|
+
second_span = spans[1]
|
64
|
+
third_span = spans[2]
|
65
|
+
|
66
|
+
assert_equal :rack, first_span.name
|
67
|
+
assert_equal :actioncontroller, second_span.name
|
68
|
+
assert_equal "/etc/issue", third_span[:data][:actionview][:name]
|
69
|
+
assert_equal :actionview, third_span.name
|
70
|
+
end
|
71
|
+
|
72
|
+
def test_render_json
|
73
|
+
clear_all!
|
74
|
+
|
75
|
+
Net::HTTP.get(URI.parse('http://localhost:3205/test/render_json'))
|
76
|
+
|
77
|
+
traces = Instana.processor.queued_traces
|
78
|
+
assert_equal 1, traces.count
|
79
|
+
trace = traces.first
|
80
|
+
|
81
|
+
assert_equal 3, trace.spans.count
|
82
|
+
spans = trace.spans.to_a
|
83
|
+
first_span = spans[0]
|
84
|
+
second_span = spans[1]
|
85
|
+
third_span = spans[2]
|
86
|
+
|
87
|
+
assert_equal :rack, first_span.name
|
88
|
+
assert_equal :actioncontroller, second_span.name
|
89
|
+
assert_equal "JSON", third_span[:data][:actionview][:name]
|
90
|
+
assert_equal :actionview, third_span.name
|
91
|
+
end
|
92
|
+
|
93
|
+
def test_render_xml
|
94
|
+
clear_all!
|
95
|
+
|
96
|
+
Net::HTTP.get(URI.parse('http://localhost:3205/test/render_xml'))
|
97
|
+
|
98
|
+
traces = Instana.processor.queued_traces
|
99
|
+
assert_equal 1, traces.count
|
100
|
+
trace = traces.first
|
101
|
+
|
102
|
+
assert_equal 3, trace.spans.count
|
103
|
+
spans = trace.spans.to_a
|
104
|
+
first_span = spans[0]
|
105
|
+
second_span = spans[1]
|
106
|
+
third_span = spans[2]
|
107
|
+
|
108
|
+
assert_equal :rack, first_span.name
|
109
|
+
assert_equal :actioncontroller, second_span.name
|
110
|
+
assert_equal "XML", third_span[:data][:actionview][:name]
|
111
|
+
assert_equal :actionview, third_span.name
|
112
|
+
end
|
113
|
+
|
114
|
+
def test_render_body
|
115
|
+
clear_all!
|
116
|
+
|
117
|
+
Net::HTTP.get(URI.parse('http://localhost:3205/test/render_rawbody'))
|
118
|
+
|
119
|
+
traces = Instana.processor.queued_traces
|
120
|
+
assert_equal 1, traces.count
|
121
|
+
trace = traces.first
|
122
|
+
|
123
|
+
assert_equal 3, trace.spans.count
|
124
|
+
spans = trace.spans.to_a
|
125
|
+
first_span = spans[0]
|
126
|
+
second_span = spans[1]
|
127
|
+
third_span = spans[2]
|
128
|
+
|
129
|
+
assert_equal :rack, first_span.name
|
130
|
+
assert_equal :actioncontroller, second_span.name
|
131
|
+
assert_equal "Raw", third_span[:data][:actionview][:name]
|
132
|
+
assert_equal :actionview, third_span.name
|
133
|
+
end
|
134
|
+
|
135
|
+
def test_render_js
|
136
|
+
clear_all!
|
137
|
+
|
138
|
+
Net::HTTP.get(URI.parse('http://localhost:3205/test/render_js'))
|
139
|
+
|
140
|
+
traces = Instana.processor.queued_traces
|
141
|
+
assert_equal 1, traces.count
|
142
|
+
trace = traces.first
|
143
|
+
|
144
|
+
assert_equal 3, trace.spans.count
|
145
|
+
spans = trace.spans.to_a
|
146
|
+
first_span = spans[0]
|
147
|
+
second_span = spans[1]
|
148
|
+
third_span = spans[2]
|
149
|
+
|
150
|
+
assert_equal :rack, first_span.name
|
151
|
+
assert_equal :actioncontroller, second_span.name
|
152
|
+
assert_equal "Javascript", third_span[:data][:actionview][:name]
|
153
|
+
assert_equal :actionview, third_span.name
|
154
|
+
end
|
155
|
+
|
156
|
+
def test_render_alternate_layout
|
157
|
+
clear_all!
|
158
|
+
|
159
|
+
Net::HTTP.get(URI.parse('http://localhost:3205/test/render_alternate_layout'))
|
160
|
+
|
161
|
+
traces = Instana.processor.queued_traces
|
162
|
+
assert_equal 1, traces.count
|
163
|
+
trace = traces.first
|
164
|
+
|
165
|
+
assert_equal 3, trace.spans.count
|
166
|
+
spans = trace.spans.to_a
|
167
|
+
first_span = spans[0]
|
168
|
+
second_span = spans[1]
|
169
|
+
third_span = spans[2]
|
170
|
+
|
171
|
+
assert_equal :rack, first_span.name
|
172
|
+
assert_equal :actioncontroller, second_span.name
|
173
|
+
assert_equal "layouts/mobile", third_span[:data][:actionview][:name]
|
174
|
+
assert_equal :actionview, third_span.name
|
175
|
+
end
|
176
|
+
|
30
177
|
def test_render_partial
|
31
178
|
clear_all!
|
32
179
|
|
@@ -106,4 +253,3 @@ class ActionViewTest < Minitest::Test
|
|
106
253
|
assert_equal 'blocks/block', fifth_span[:data][:render][:name]
|
107
254
|
end
|
108
255
|
end
|
109
|
-
|
@@ -27,6 +27,153 @@ class ActionViewTest < Minitest::Test
|
|
27
27
|
assert_equal :actionview, third_span.name
|
28
28
|
end
|
29
29
|
|
30
|
+
def test_render_nothing
|
31
|
+
clear_all!
|
32
|
+
|
33
|
+
Net::HTTP.get(URI.parse('http://localhost:3205/test/render_nothing'))
|
34
|
+
|
35
|
+
traces = Instana.processor.queued_traces
|
36
|
+
assert_equal 1, traces.count
|
37
|
+
trace = traces.first
|
38
|
+
|
39
|
+
assert_equal 3, trace.spans.count
|
40
|
+
spans = trace.spans.to_a
|
41
|
+
first_span = spans[0]
|
42
|
+
second_span = spans[1]
|
43
|
+
third_span = spans[2]
|
44
|
+
|
45
|
+
assert_equal :rack, first_span.name
|
46
|
+
assert_equal :actioncontroller, second_span.name
|
47
|
+
assert_equal "Nothing", third_span[:data][:actionview][:name]
|
48
|
+
assert_equal :actionview, third_span.name
|
49
|
+
end
|
50
|
+
|
51
|
+
def test_render_file
|
52
|
+
clear_all!
|
53
|
+
|
54
|
+
Net::HTTP.get(URI.parse('http://localhost:3205/test/render_file'))
|
55
|
+
|
56
|
+
traces = Instana.processor.queued_traces
|
57
|
+
assert_equal 1, traces.count
|
58
|
+
trace = traces.first
|
59
|
+
|
60
|
+
assert_equal 3, trace.spans.count
|
61
|
+
spans = trace.spans.to_a
|
62
|
+
first_span = spans[0]
|
63
|
+
second_span = spans[1]
|
64
|
+
third_span = spans[2]
|
65
|
+
|
66
|
+
assert_equal :rack, first_span.name
|
67
|
+
assert_equal :actioncontroller, second_span.name
|
68
|
+
assert_equal "/etc/issue", third_span[:data][:actionview][:name]
|
69
|
+
assert_equal :actionview, third_span.name
|
70
|
+
end
|
71
|
+
|
72
|
+
def test_render_json
|
73
|
+
clear_all!
|
74
|
+
|
75
|
+
Net::HTTP.get(URI.parse('http://localhost:3205/test/render_json'))
|
76
|
+
|
77
|
+
traces = Instana.processor.queued_traces
|
78
|
+
assert_equal 1, traces.count
|
79
|
+
trace = traces.first
|
80
|
+
|
81
|
+
assert_equal 3, trace.spans.count
|
82
|
+
spans = trace.spans.to_a
|
83
|
+
first_span = spans[0]
|
84
|
+
second_span = spans[1]
|
85
|
+
third_span = spans[2]
|
86
|
+
|
87
|
+
assert_equal :rack, first_span.name
|
88
|
+
assert_equal :actioncontroller, second_span.name
|
89
|
+
assert_equal "JSON", third_span[:data][:actionview][:name]
|
90
|
+
assert_equal :actionview, third_span.name
|
91
|
+
end
|
92
|
+
|
93
|
+
def test_render_xml
|
94
|
+
clear_all!
|
95
|
+
|
96
|
+
Net::HTTP.get(URI.parse('http://localhost:3205/test/render_xml'))
|
97
|
+
|
98
|
+
traces = Instana.processor.queued_traces
|
99
|
+
assert_equal 1, traces.count
|
100
|
+
trace = traces.first
|
101
|
+
|
102
|
+
assert_equal 3, trace.spans.count
|
103
|
+
spans = trace.spans.to_a
|
104
|
+
first_span = spans[0]
|
105
|
+
second_span = spans[1]
|
106
|
+
third_span = spans[2]
|
107
|
+
|
108
|
+
assert_equal :rack, first_span.name
|
109
|
+
assert_equal :actioncontroller, second_span.name
|
110
|
+
assert_equal "XML", third_span[:data][:actionview][:name]
|
111
|
+
assert_equal :actionview, third_span.name
|
112
|
+
end
|
113
|
+
|
114
|
+
def test_render_body
|
115
|
+
clear_all!
|
116
|
+
|
117
|
+
Net::HTTP.get(URI.parse('http://localhost:3205/test/render_rawbody'))
|
118
|
+
|
119
|
+
traces = Instana.processor.queued_traces
|
120
|
+
assert_equal 1, traces.count
|
121
|
+
trace = traces.first
|
122
|
+
|
123
|
+
assert_equal 3, trace.spans.count
|
124
|
+
spans = trace.spans.to_a
|
125
|
+
first_span = spans[0]
|
126
|
+
second_span = spans[1]
|
127
|
+
third_span = spans[2]
|
128
|
+
|
129
|
+
assert_equal :rack, first_span.name
|
130
|
+
assert_equal :actioncontroller, second_span.name
|
131
|
+
assert_equal "Raw", third_span[:data][:actionview][:name]
|
132
|
+
assert_equal :actionview, third_span.name
|
133
|
+
end
|
134
|
+
|
135
|
+
def test_render_js
|
136
|
+
clear_all!
|
137
|
+
|
138
|
+
Net::HTTP.get(URI.parse('http://localhost:3205/test/render_js'))
|
139
|
+
|
140
|
+
traces = Instana.processor.queued_traces
|
141
|
+
assert_equal 1, traces.count
|
142
|
+
trace = traces.first
|
143
|
+
|
144
|
+
assert_equal 3, trace.spans.count
|
145
|
+
spans = trace.spans.to_a
|
146
|
+
first_span = spans[0]
|
147
|
+
second_span = spans[1]
|
148
|
+
third_span = spans[2]
|
149
|
+
|
150
|
+
assert_equal :rack, first_span.name
|
151
|
+
assert_equal :actioncontroller, second_span.name
|
152
|
+
assert_equal "Javascript", third_span[:data][:actionview][:name]
|
153
|
+
assert_equal :actionview, third_span.name
|
154
|
+
end
|
155
|
+
|
156
|
+
def test_render_alternate_layout
|
157
|
+
clear_all!
|
158
|
+
|
159
|
+
Net::HTTP.get(URI.parse('http://localhost:3205/test/render_alternate_layout'))
|
160
|
+
|
161
|
+
traces = Instana.processor.queued_traces
|
162
|
+
assert_equal 1, traces.count
|
163
|
+
trace = traces.first
|
164
|
+
|
165
|
+
assert_equal 3, trace.spans.count
|
166
|
+
spans = trace.spans.to_a
|
167
|
+
first_span = spans[0]
|
168
|
+
second_span = spans[1]
|
169
|
+
third_span = spans[2]
|
170
|
+
|
171
|
+
assert_equal :rack, first_span.name
|
172
|
+
assert_equal :actioncontroller, second_span.name
|
173
|
+
assert_equal "layouts/mobile", third_span[:data][:actionview][:name]
|
174
|
+
assert_equal :actionview, third_span.name
|
175
|
+
end
|
176
|
+
|
30
177
|
def test_render_partial
|
31
178
|
clear_all!
|
32
179
|
|
@@ -105,4 +252,3 @@ class ActionViewTest < Minitest::Test
|
|
105
252
|
assert_equal 'blocks/block', fifth_span[:data][:render][:name]
|
106
253
|
end
|
107
254
|
end
|
108
|
-
|
@@ -27,6 +27,153 @@ class ActionViewTest < Minitest::Test
|
|
27
27
|
assert_equal :actionview, third_span.name
|
28
28
|
end
|
29
29
|
|
30
|
+
def test_render_nothing
|
31
|
+
clear_all!
|
32
|
+
|
33
|
+
Net::HTTP.get(URI.parse('http://localhost:3205/test/render_nothing'))
|
34
|
+
|
35
|
+
traces = Instana.processor.queued_traces
|
36
|
+
assert_equal 1, traces.count
|
37
|
+
trace = traces.first
|
38
|
+
|
39
|
+
assert_equal 3, trace.spans.count
|
40
|
+
spans = trace.spans.to_a
|
41
|
+
first_span = spans[0]
|
42
|
+
second_span = spans[1]
|
43
|
+
third_span = spans[2]
|
44
|
+
|
45
|
+
assert_equal :rack, first_span.name
|
46
|
+
assert_equal :actioncontroller, second_span.name
|
47
|
+
assert_equal "Nothing", third_span[:data][:actionview][:name]
|
48
|
+
assert_equal :actionview, third_span.name
|
49
|
+
end
|
50
|
+
|
51
|
+
def test_render_file
|
52
|
+
clear_all!
|
53
|
+
|
54
|
+
Net::HTTP.get(URI.parse('http://localhost:3205/test/render_file'))
|
55
|
+
|
56
|
+
traces = Instana.processor.queued_traces
|
57
|
+
assert_equal 1, traces.count
|
58
|
+
trace = traces.first
|
59
|
+
|
60
|
+
assert_equal 3, trace.spans.count
|
61
|
+
spans = trace.spans.to_a
|
62
|
+
first_span = spans[0]
|
63
|
+
second_span = spans[1]
|
64
|
+
third_span = spans[2]
|
65
|
+
|
66
|
+
assert_equal :rack, first_span.name
|
67
|
+
assert_equal :actioncontroller, second_span.name
|
68
|
+
assert_equal "/etc/issue", third_span[:data][:actionview][:name]
|
69
|
+
assert_equal :actionview, third_span.name
|
70
|
+
end
|
71
|
+
|
72
|
+
def test_render_json
|
73
|
+
clear_all!
|
74
|
+
|
75
|
+
Net::HTTP.get(URI.parse('http://localhost:3205/test/render_json'))
|
76
|
+
|
77
|
+
traces = Instana.processor.queued_traces
|
78
|
+
assert_equal 1, traces.count
|
79
|
+
trace = traces.first
|
80
|
+
|
81
|
+
assert_equal 3, trace.spans.count
|
82
|
+
spans = trace.spans.to_a
|
83
|
+
first_span = spans[0]
|
84
|
+
second_span = spans[1]
|
85
|
+
third_span = spans[2]
|
86
|
+
|
87
|
+
assert_equal :rack, first_span.name
|
88
|
+
assert_equal :actioncontroller, second_span.name
|
89
|
+
assert_equal "JSON", third_span[:data][:actionview][:name]
|
90
|
+
assert_equal :actionview, third_span.name
|
91
|
+
end
|
92
|
+
|
93
|
+
def test_render_xml
|
94
|
+
clear_all!
|
95
|
+
|
96
|
+
Net::HTTP.get(URI.parse('http://localhost:3205/test/render_xml'))
|
97
|
+
|
98
|
+
traces = Instana.processor.queued_traces
|
99
|
+
assert_equal 1, traces.count
|
100
|
+
trace = traces.first
|
101
|
+
|
102
|
+
assert_equal 3, trace.spans.count
|
103
|
+
spans = trace.spans.to_a
|
104
|
+
first_span = spans[0]
|
105
|
+
second_span = spans[1]
|
106
|
+
third_span = spans[2]
|
107
|
+
|
108
|
+
assert_equal :rack, first_span.name
|
109
|
+
assert_equal :actioncontroller, second_span.name
|
110
|
+
assert_equal "XML", third_span[:data][:actionview][:name]
|
111
|
+
assert_equal :actionview, third_span.name
|
112
|
+
end
|
113
|
+
|
114
|
+
def test_render_body
|
115
|
+
clear_all!
|
116
|
+
|
117
|
+
Net::HTTP.get(URI.parse('http://localhost:3205/test/render_rawbody'))
|
118
|
+
|
119
|
+
traces = Instana.processor.queued_traces
|
120
|
+
assert_equal 1, traces.count
|
121
|
+
trace = traces.first
|
122
|
+
|
123
|
+
assert_equal 3, trace.spans.count
|
124
|
+
spans = trace.spans.to_a
|
125
|
+
first_span = spans[0]
|
126
|
+
second_span = spans[1]
|
127
|
+
third_span = spans[2]
|
128
|
+
|
129
|
+
assert_equal :rack, first_span.name
|
130
|
+
assert_equal :actioncontroller, second_span.name
|
131
|
+
assert_equal "Raw", third_span[:data][:actionview][:name]
|
132
|
+
assert_equal :actionview, third_span.name
|
133
|
+
end
|
134
|
+
|
135
|
+
def test_render_js
|
136
|
+
clear_all!
|
137
|
+
|
138
|
+
Net::HTTP.get(URI.parse('http://localhost:3205/test/render_js'))
|
139
|
+
|
140
|
+
traces = Instana.processor.queued_traces
|
141
|
+
assert_equal 1, traces.count
|
142
|
+
trace = traces.first
|
143
|
+
|
144
|
+
assert_equal 3, trace.spans.count
|
145
|
+
spans = trace.spans.to_a
|
146
|
+
first_span = spans[0]
|
147
|
+
second_span = spans[1]
|
148
|
+
third_span = spans[2]
|
149
|
+
|
150
|
+
assert_equal :rack, first_span.name
|
151
|
+
assert_equal :actioncontroller, second_span.name
|
152
|
+
assert_equal "Javascript", third_span[:data][:actionview][:name]
|
153
|
+
assert_equal :actionview, third_span.name
|
154
|
+
end
|
155
|
+
|
156
|
+
def test_render_alternate_layout
|
157
|
+
clear_all!
|
158
|
+
|
159
|
+
Net::HTTP.get(URI.parse('http://localhost:3205/test/render_alternate_layout'))
|
160
|
+
|
161
|
+
traces = Instana.processor.queued_traces
|
162
|
+
assert_equal 1, traces.count
|
163
|
+
trace = traces.first
|
164
|
+
|
165
|
+
assert_equal 3, trace.spans.count
|
166
|
+
spans = trace.spans.to_a
|
167
|
+
first_span = spans[0]
|
168
|
+
second_span = spans[1]
|
169
|
+
third_span = spans[2]
|
170
|
+
|
171
|
+
assert_equal :rack, first_span.name
|
172
|
+
assert_equal :actioncontroller, second_span.name
|
173
|
+
assert_equal "layouts/mobile", third_span[:data][:actionview][:name]
|
174
|
+
assert_equal :actionview, third_span.name
|
175
|
+
end
|
176
|
+
|
30
177
|
def test_render_partial
|
31
178
|
clear_all!
|
32
179
|
|
@@ -113,4 +260,3 @@ class ActionViewTest < Minitest::Test
|
|
113
260
|
assert_equal 'blocks/block', fifth_span[:data][:render][:name]
|
114
261
|
end
|
115
262
|
end
|
116
|
-
|
data/test/servers/rails_3205.rb
CHANGED
@@ -27,8 +27,15 @@ class RailsTestApp < Rails::Application
|
|
27
27
|
get "/test/error" => "test#error"
|
28
28
|
get "/test/render_view" => "test#render_view"
|
29
29
|
get "/test/render_partial" => "test#render_partial"
|
30
|
-
get "/test/render_partial_that_errors" => "test#render_partial_that_errors"
|
31
30
|
get "/test/render_collection" => "test#render_collection"
|
31
|
+
get "/test/render_file" => "test#render_file"
|
32
|
+
get "/test/render_nothing" => "test#render_nothing"
|
33
|
+
get "/test/render_json" => "test#render_json"
|
34
|
+
get "/test/render_xml" => "test#render_xml"
|
35
|
+
get "/test/render_rawbody" => "test#render_rawbody"
|
36
|
+
get "/test/render_js" => "test#render_js"
|
37
|
+
get "/test/render_alternate_layout" => "test#render_alternate_layout"
|
38
|
+
get "/test/render_partial_that_errors" => "test#render_partial_that_errors"
|
32
39
|
|
33
40
|
get "/api/world" => "socket#world"
|
34
41
|
get "/api/error" => "socket#error"
|
@@ -91,6 +98,41 @@ class TestController < ActionController::Base
|
|
91
98
|
@blocks = Block.all
|
92
99
|
end
|
93
100
|
|
101
|
+
def render_file
|
102
|
+
@message = "Hello Instana!"
|
103
|
+
render :file => '/etc/issue'
|
104
|
+
end
|
105
|
+
|
106
|
+
def render_alternate_layout
|
107
|
+
@message = "Hello Instana!"
|
108
|
+
render :layout => 'layouts/mobile'
|
109
|
+
end
|
110
|
+
|
111
|
+
def render_nothing
|
112
|
+
@message = "Hello Instana!"
|
113
|
+
render :nothing => true
|
114
|
+
end
|
115
|
+
|
116
|
+
def render_json
|
117
|
+
@message = "Hello Instana!"
|
118
|
+
render :json => @message
|
119
|
+
end
|
120
|
+
|
121
|
+
def render_xml
|
122
|
+
@message = "Hello Instana!"
|
123
|
+
render :xml => @message
|
124
|
+
end
|
125
|
+
|
126
|
+
def render_rawbody
|
127
|
+
@message = "Hello Instana!"
|
128
|
+
render :body => 'raw body output'
|
129
|
+
end
|
130
|
+
|
131
|
+
def render_js
|
132
|
+
@message = "Hello Instana!"
|
133
|
+
render :js => @message
|
134
|
+
end
|
135
|
+
|
94
136
|
def error
|
95
137
|
raise Exception.new("Warning: This is a simulated Error")
|
96
138
|
end
|
@@ -160,6 +160,33 @@ class OpenTracerTest < Minitest::Test
|
|
160
160
|
span.finish
|
161
161
|
end
|
162
162
|
|
163
|
+
def test_span_kind_translation
|
164
|
+
clear_all!
|
165
|
+
span = OpenTracing.start_span('my_app_entry')
|
166
|
+
|
167
|
+
assert span.is_a?(::Instana::Span)
|
168
|
+
assert_equal :my_app_entry, OpenTracing.current_trace.current_span.name
|
169
|
+
|
170
|
+
span.set_tag(:'span.kind', :server)
|
171
|
+
assert_equal :entry, span[:data][:sdk][:type]
|
172
|
+
|
173
|
+
span.set_tag(:'span.kind', :consumer)
|
174
|
+
assert_equal :entry, span[:data][:sdk][:type]
|
175
|
+
|
176
|
+
span.set_tag(:'span.kind', :client)
|
177
|
+
assert_equal :exit, span[:data][:sdk][:type]
|
178
|
+
|
179
|
+
span.set_tag(:'span.kind', :producer)
|
180
|
+
assert_equal :exit, span[:data][:sdk][:type]
|
181
|
+
|
182
|
+
span[:data][:sdk].delete(:type)
|
183
|
+
span.set_tag(:'span.kind', :blah)
|
184
|
+
assert_equal false, span[:data][:sdk].key?(:type)
|
185
|
+
assert_equal :blah, span[:data][:sdk][:custom][:'span.kind']
|
186
|
+
|
187
|
+
span.finish
|
188
|
+
end
|
189
|
+
|
163
190
|
def test_start_span_with_baggage
|
164
191
|
clear_all!
|
165
192
|
span = OpenTracing.start_span('my_app_entry')
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: instana
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Giacomo Lombardo
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-05-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|