instana 1.11.6-java → 1.11.8-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +168 -0
- data/lib/instana/instrumentation/rack.rb +18 -3
- data/lib/instana/test.rb +4 -3
- data/lib/instana/tracing/span.rb +9 -0
- data/lib/instana/version.rb +1 -1
- data/test/frameworks/rack_test.rb +100 -60
- data/test/frameworks/sinatra_test.rb +26 -18
- data/test/instrumentation/grpc_test.rb +1 -1
- data/test/tracing/tracer_test.rb +31 -1
- metadata +3 -5
- data/.travis.yml +0 -43
- data/test/tracing/trace_test.rb +0 -67
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: caa415d38722203f24ce37abf43ebb8f81e209d682555b146873ab3c5b60a29d
|
4
|
+
data.tar.gz: 53e22add3047a33b51dba1d483b5bc5b97d05d66c501e0692ce3e4f12bcbae55
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a1d7fda2142403d3195977cbbf3a60d6c1ce39b74a4ff5bd4dd8a2b84b23d2d643887adbdce7d1eb3fd9919460ea93fc682b15e6becf5c981b2fde760d2f9ec1
|
7
|
+
data.tar.gz: 30df9a2a1f2d31889db769244f12a48b167e4d08020aa0170e2e0e7c2088ecdeba590268b8a26017531bbccdd7195b5a6f6faf941661140cfe0e4446f579f549
|
@@ -0,0 +1,168 @@
|
|
1
|
+
version: 2.1
|
2
|
+
|
3
|
+
# More about orbs: https://circleci.com/docs/2.0/using-orbs/
|
4
|
+
orbs:
|
5
|
+
ruby: circleci/ruby@1.1.2
|
6
|
+
|
7
|
+
commands:
|
8
|
+
prelim-deps:
|
9
|
+
steps:
|
10
|
+
- run:
|
11
|
+
name: Preliminary Dependencies
|
12
|
+
command: |
|
13
|
+
gem update --system
|
14
|
+
gem --version
|
15
|
+
gem install bundler
|
16
|
+
bundler --version
|
17
|
+
bundle config set path './vendor/bundle'
|
18
|
+
|
19
|
+
run-tests:
|
20
|
+
steps:
|
21
|
+
- run:
|
22
|
+
name: Run the Tests
|
23
|
+
command: |
|
24
|
+
bundle exec rake test
|
25
|
+
|
26
|
+
save-stan-cache:
|
27
|
+
parameters:
|
28
|
+
gemfile:
|
29
|
+
default: "Gemfile"
|
30
|
+
type: string
|
31
|
+
steps:
|
32
|
+
- save_cache:
|
33
|
+
key: gem-cache-v1-{{ arch }}-{{ .Branch }}-{{ checksum "<<parameters.gemfile>>" }}
|
34
|
+
paths:
|
35
|
+
- vendor/bundle
|
36
|
+
|
37
|
+
restore-stan-cache:
|
38
|
+
parameters:
|
39
|
+
gemfile:
|
40
|
+
default: "Gemfile"
|
41
|
+
type: string
|
42
|
+
steps:
|
43
|
+
- restore_cache:
|
44
|
+
keys:
|
45
|
+
- gem-cache-v1-{{ arch }}-{{ .Branch }}-{{ checksum "<<parameters.gemfile>>" }}
|
46
|
+
- gem-cache-v1-{{ arch }}-{{ .Branch }}
|
47
|
+
- gem-cache-v1
|
48
|
+
|
49
|
+
bundle-install:
|
50
|
+
parameters:
|
51
|
+
gemfile:
|
52
|
+
default: "Gemfile"
|
53
|
+
type: string
|
54
|
+
steps:
|
55
|
+
- restore-stan-cache:
|
56
|
+
gemfile: <<parameters.gemfile>>
|
57
|
+
- run:
|
58
|
+
name: Bundle Installation
|
59
|
+
command: |
|
60
|
+
bundle install
|
61
|
+
- save-stan-cache:
|
62
|
+
gemfile: <<parameters.gemfile>>
|
63
|
+
|
64
|
+
jobs:
|
65
|
+
ruby26:
|
66
|
+
parallelism: 3
|
67
|
+
docker:
|
68
|
+
- image: circleci/ruby:2.6.3-stretch-node
|
69
|
+
executor: ruby/default
|
70
|
+
environment:
|
71
|
+
BUNDLE_JOBS: "3"
|
72
|
+
BUNDLE_RETRY: "3"
|
73
|
+
|
74
|
+
steps:
|
75
|
+
- checkout
|
76
|
+
- prelim-deps
|
77
|
+
- bundle-install
|
78
|
+
- run-tests
|
79
|
+
|
80
|
+
rails50:
|
81
|
+
parallelism: 3
|
82
|
+
docker:
|
83
|
+
- image: circleci/ruby:2.6.3-stretch-node
|
84
|
+
- image: mariadb
|
85
|
+
environment:
|
86
|
+
MYSQL_DATABASE: 'travis_ci_test'
|
87
|
+
MYSQL_USER: 'root'
|
88
|
+
MYSQL_PASSWORD: ''
|
89
|
+
MYSQL_ALLOW_EMPTY_PASSWORD: 'yes'
|
90
|
+
MYSQL_ROOT_PASSWORD: ''
|
91
|
+
MYSQL_ROOT_HOST: '%'
|
92
|
+
executor: ruby/default
|
93
|
+
environment:
|
94
|
+
BUNDLE_JOBS: "3"
|
95
|
+
BUNDLE_RETRY: "3"
|
96
|
+
BUNDLE_GEMFILE: "./gemfiles/rails50.gemfile"
|
97
|
+
|
98
|
+
steps:
|
99
|
+
- checkout
|
100
|
+
- prelim-deps
|
101
|
+
- bundle-install:
|
102
|
+
gemfile: "./gemfiles/rails50.gemfile"
|
103
|
+
- run-tests
|
104
|
+
|
105
|
+
rails60:
|
106
|
+
parallelism: 3
|
107
|
+
docker:
|
108
|
+
- image: circleci/ruby:2.6.3-stretch-node
|
109
|
+
- image: mariadb
|
110
|
+
environment:
|
111
|
+
MYSQL_DATABASE: 'travis_ci_test'
|
112
|
+
MYSQL_USER: 'root'
|
113
|
+
MYSQL_PASSWORD: ''
|
114
|
+
MYSQL_ALLOW_EMPTY_PASSWORD: 'yes'
|
115
|
+
MYSQL_ROOT_PASSWORD: ''
|
116
|
+
MYSQL_ROOT_HOST: '%'
|
117
|
+
executor: ruby/default
|
118
|
+
environment:
|
119
|
+
BUNDLE_JOBS: "3"
|
120
|
+
BUNDLE_RETRY: "3"
|
121
|
+
BUNDLE_GEMFILE: "./gemfiles/rails60.gemfile"
|
122
|
+
|
123
|
+
steps:
|
124
|
+
- checkout
|
125
|
+
- prelim-deps
|
126
|
+
- bundle-install:
|
127
|
+
gemfile: "./gemfiles/rails60.gemfile"
|
128
|
+
- run-tests
|
129
|
+
|
130
|
+
libraries:
|
131
|
+
parallelism: 3
|
132
|
+
docker:
|
133
|
+
- image: circleci/ruby:2.6.3-stretch-node
|
134
|
+
- image: mariadb
|
135
|
+
environment:
|
136
|
+
MYSQL_DATABASE: 'travis_ci_test'
|
137
|
+
MYSQL_USER: 'root'
|
138
|
+
MYSQL_PASSWORD: ''
|
139
|
+
MYSQL_ALLOW_EMPTY_PASSWORD: 'yes'
|
140
|
+
MYSQL_ROOT_PASSWORD: ''
|
141
|
+
MYSQL_ROOT_HOST: '%'
|
142
|
+
- image: memcached
|
143
|
+
- image: postgres
|
144
|
+
environment:
|
145
|
+
POSTGRES_USER: 'stan'
|
146
|
+
POSTGRES_PASSWORD: 'stanlikesdata'
|
147
|
+
- image: redis
|
148
|
+
executor: ruby/default
|
149
|
+
environment:
|
150
|
+
BUNDLE_JOBS: "3"
|
151
|
+
BUNDLE_RETRY: "3"
|
152
|
+
BUNDLE_GEMFILE: "./gemfiles/libraries.gemfile"
|
153
|
+
|
154
|
+
steps:
|
155
|
+
- checkout
|
156
|
+
- prelim-deps
|
157
|
+
- bundle-install:
|
158
|
+
gemfile: "./gemfiles/libraries.gemfile"
|
159
|
+
- run-tests
|
160
|
+
|
161
|
+
workflows:
|
162
|
+
version: 2
|
163
|
+
whole-enchilada-MRI26:
|
164
|
+
jobs:
|
165
|
+
- ruby26
|
166
|
+
- rails50
|
167
|
+
- rails60
|
168
|
+
- libraries
|
@@ -8,8 +8,9 @@ module Instana
|
|
8
8
|
@app = app
|
9
9
|
end
|
10
10
|
|
11
|
-
def
|
12
|
-
kvs = {
|
11
|
+
def collect_kvs(env)
|
12
|
+
kvs = {}
|
13
|
+
kvs[:http] = {}
|
13
14
|
kvs[:http][:method] = env['REQUEST_METHOD']
|
14
15
|
kvs[:http][:url] = ::CGI.unescape(env['PATH_INFO'])
|
15
16
|
|
@@ -37,15 +38,27 @@ module Instana
|
|
37
38
|
end
|
38
39
|
}
|
39
40
|
end
|
41
|
+
return kvs
|
42
|
+
end
|
40
43
|
|
44
|
+
def call(env)
|
41
45
|
# Check incoming context
|
42
46
|
incoming_context = {}
|
43
47
|
if env.key?('HTTP_X_INSTANA_T')
|
44
48
|
incoming_context[:trace_id] = ::Instana::Util.header_to_id(env['HTTP_X_INSTANA_T'])
|
45
49
|
incoming_context[:span_id] = ::Instana::Util.header_to_id(env['HTTP_X_INSTANA_S']) if env.key?('HTTP_X_INSTANA_S')
|
46
50
|
incoming_context[:level] = env['HTTP_X_INSTANA_L'] if env.key?('HTTP_X_INSTANA_L')
|
51
|
+
|
52
|
+
# Honor X-Instana-L
|
53
|
+
if incoming_context[:level] and incoming_context[:level].length > 0
|
54
|
+
if incoming_context[:level][0] == "0"
|
55
|
+
return @app.call(env)
|
56
|
+
end
|
57
|
+
end
|
47
58
|
end
|
48
59
|
|
60
|
+
kvs = collect_kvs(env)
|
61
|
+
|
49
62
|
::Instana.tracer.log_start_or_continue(:rack, {}, incoming_context)
|
50
63
|
|
51
64
|
status, headers, response = @app.call(env)
|
@@ -78,8 +91,10 @@ module Instana
|
|
78
91
|
# Set reponse headers; encode as hex string
|
79
92
|
headers['X-Instana-T'] = ::Instana::Util.id_to_header(trace_id)
|
80
93
|
headers['X-Instana-S'] = ::Instana::Util.id_to_header(span_id)
|
94
|
+
headers['X-Instana-L'] = '1'
|
95
|
+
headers['Server-Timing'] = "intid;desc=#{::Instana::Util.id_to_header(trace_id)}"
|
96
|
+
::Instana.tracer.log_end(:rack, kvs)
|
81
97
|
end
|
82
|
-
::Instana.tracer.log_end(:rack, kvs)
|
83
98
|
end
|
84
99
|
end
|
85
100
|
end
|
data/lib/instana/test.rb
CHANGED
@@ -7,14 +7,15 @@ module Instana
|
|
7
7
|
def setup_environment
|
8
8
|
# Set defaults if not set
|
9
9
|
ENV['MEMCACHED_HOST'] ||= '127.0.0.1:11211'
|
10
|
-
ENV['
|
11
|
-
ENV['
|
10
|
+
ENV['POSTGRES_HOST'] ||= "127.0.0.1"
|
11
|
+
ENV['POSTGRES_USER'] ||= "stan"
|
12
|
+
ENV['POSTGRES_PASSWORD'] ||= "stanlikesdata"
|
12
13
|
ENV['TRAVIS_MYSQL_HOST'] ||= "127.0.0.1"
|
13
14
|
ENV['TRAVIS_MYSQL_USER'] ||= "root"
|
14
15
|
|
15
16
|
if !ENV.key?('DATABASE_URL')
|
16
17
|
if ENV['DB_FLAVOR'] == 'postgresql'
|
17
|
-
ENV['DATABASE_URL'] = "postgresql://#{ENV['
|
18
|
+
ENV['DATABASE_URL'] = "postgresql://#{ENV['POSTGRES_USER']}:#{ENV['POSTGRES_PASSWORD']}@#{ENV['POSTGRES_HOST']}:5432/#{ENV['POSTGRES_USER']}"
|
18
19
|
elsif ENV['DB_FLAVOR'] == 'mysql'
|
19
20
|
ENV['DATABASE_URL'] = "mysql://#{ENV['TRAVIS_MYSQL_USER']}:#{ENV['TRAVIS_MYSQL_PASS']}@#{ENV['TRAVIS_MYSQL_HOST']}:3306/travis_ci_test"
|
20
21
|
else
|
data/lib/instana/tracing/span.rb
CHANGED
@@ -303,6 +303,15 @@ module Instana
|
|
303
303
|
# a String, Numeric, or Boolean it will be encoded with to_s
|
304
304
|
#
|
305
305
|
def set_tag(key, value)
|
306
|
+
if ![Symbol, String].include?(key.class)
|
307
|
+
key = key.to_s
|
308
|
+
end
|
309
|
+
|
310
|
+
# If <value> is not a Symbol, String, Array, Hash or Numeric - convert to string
|
311
|
+
if ![Symbol, String, Array, TrueClass, FalseClass, Hash].include?(value.class) && !value.is_a?(Numeric)
|
312
|
+
value = value.to_s
|
313
|
+
end
|
314
|
+
|
306
315
|
if custom?
|
307
316
|
@data[:data][:sdk][:custom] ||= {}
|
308
317
|
@data[:data][:sdk][:custom][:tags] ||= {}
|
data/lib/instana/version.rb
CHANGED
@@ -29,23 +29,33 @@ class RackTest < Minitest::Test
|
|
29
29
|
# Span validation
|
30
30
|
assert_equal 1, spans.count
|
31
31
|
|
32
|
-
|
33
|
-
assert_equal :rack,
|
34
|
-
|
35
|
-
assert
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
assert
|
41
|
-
assert
|
42
|
-
assert
|
43
|
-
|
32
|
+
rack_span = spans.first
|
33
|
+
assert_equal :rack, rack_span[:n]
|
34
|
+
|
35
|
+
assert last_response.headers.key?("X-Instana-T")
|
36
|
+
assert last_response.headers["X-Instana-T"] == ::Instana::Util.id_to_header(rack_span[:t])
|
37
|
+
assert last_response.headers.key?("X-Instana-S")
|
38
|
+
assert last_response.headers["X-Instana-S"] == ::Instana::Util.id_to_header(rack_span[:s])
|
39
|
+
assert last_response.headers.key?("X-Instana-L")
|
40
|
+
assert last_response.headers["X-Instana-L"] == '1'
|
41
|
+
assert last_response.headers.key?("Server-Timing")
|
42
|
+
assert last_response.headers["Server-Timing"] == "intid;desc=#{::Instana::Util.id_to_header(rack_span[:t])}"
|
43
|
+
|
44
|
+
assert rack_span.key?(:data)
|
45
|
+
assert rack_span[:data].key?(:http)
|
46
|
+
assert_equal "GET", rack_span[:data][:http][:method]
|
47
|
+
assert_equal "/mrlobster", rack_span[:data][:http][:url]
|
48
|
+
assert_equal 200, rack_span[:data][:http][:status]
|
49
|
+
assert_equal 'example.org', rack_span[:data][:http][:host]
|
50
|
+
assert rack_span.key?(:f)
|
51
|
+
assert rack_span[:f].key?(:e)
|
52
|
+
assert rack_span[:f].key?(:h)
|
53
|
+
assert_equal ::Instana.agent.agent_uuid, rack_span[:f][:h]
|
44
54
|
|
45
55
|
# Backtrace fingerprint validation
|
46
|
-
assert
|
47
|
-
assert_equal 2,
|
48
|
-
refute_nil
|
56
|
+
assert rack_span.key?(:stack)
|
57
|
+
assert_equal 2, rack_span[:stack].count
|
58
|
+
refute_nil rack_span[:stack].first[:c].match(/instana\/instrumentation\/rack.rb/)
|
49
59
|
|
50
60
|
# Restore to default
|
51
61
|
::Instana.config[:collect_backtraces] = false
|
@@ -63,8 +73,8 @@ class RackTest < Minitest::Test
|
|
63
73
|
# Span validation
|
64
74
|
assert_equal 1, spans.count
|
65
75
|
|
66
|
-
|
67
|
-
assert_equal 'WalterBishop',
|
76
|
+
rack_span = spans.first
|
77
|
+
assert_equal 'WalterBishop', rack_span[:data][:service]
|
68
78
|
|
69
79
|
ENV.delete('INSTANA_SERVICE_NAME')
|
70
80
|
end
|
@@ -78,17 +88,27 @@ class RackTest < Minitest::Test
|
|
78
88
|
|
79
89
|
# Span validation
|
80
90
|
assert_equal 1, spans.count
|
81
|
-
|
82
|
-
assert_equal :rack,
|
83
|
-
|
84
|
-
assert
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
assert
|
89
|
-
assert
|
90
|
-
assert
|
91
|
-
|
91
|
+
rack_span = spans.first
|
92
|
+
assert_equal :rack, rack_span[:n]
|
93
|
+
|
94
|
+
assert last_response.headers.key?("X-Instana-T")
|
95
|
+
assert last_response.headers["X-Instana-T"] == ::Instana::Util.id_to_header(rack_span[:t])
|
96
|
+
assert last_response.headers.key?("X-Instana-S")
|
97
|
+
assert last_response.headers["X-Instana-S"] == ::Instana::Util.id_to_header(rack_span[:s])
|
98
|
+
assert last_response.headers.key?("X-Instana-L")
|
99
|
+
assert last_response.headers["X-Instana-L"] == '1'
|
100
|
+
assert last_response.headers.key?("Server-Timing")
|
101
|
+
assert last_response.headers["Server-Timing"] == "intid;desc=#{::Instana::Util.id_to_header(rack_span[:t])}"
|
102
|
+
|
103
|
+
assert rack_span.key?(:data)
|
104
|
+
assert rack_span[:data].key?(:http)
|
105
|
+
assert_equal "POST", rack_span[:data][:http][:method]
|
106
|
+
assert_equal "/mrlobster", rack_span[:data][:http][:url]
|
107
|
+
assert_equal 200, rack_span[:data][:http][:status]
|
108
|
+
assert rack_span.key?(:f)
|
109
|
+
assert rack_span[:f].key?(:e)
|
110
|
+
assert rack_span[:f].key?(:h)
|
111
|
+
assert_equal ::Instana.agent.agent_uuid, rack_span[:f][:h]
|
92
112
|
end
|
93
113
|
|
94
114
|
def test_basic_put
|
@@ -100,17 +120,27 @@ class RackTest < Minitest::Test
|
|
100
120
|
|
101
121
|
# Span validation
|
102
122
|
assert_equal 1, spans.count
|
103
|
-
|
104
|
-
assert_equal :rack,
|
105
|
-
|
106
|
-
assert
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
assert
|
111
|
-
assert
|
112
|
-
assert
|
113
|
-
|
123
|
+
rack_span = spans.first
|
124
|
+
assert_equal :rack, rack_span[:n]
|
125
|
+
|
126
|
+
assert last_response.headers.key?("X-Instana-T")
|
127
|
+
assert last_response.headers["X-Instana-T"] == ::Instana::Util.id_to_header(rack_span[:t])
|
128
|
+
assert last_response.headers.key?("X-Instana-S")
|
129
|
+
assert last_response.headers["X-Instana-S"] == ::Instana::Util.id_to_header(rack_span[:s])
|
130
|
+
assert last_response.headers.key?("X-Instana-L")
|
131
|
+
assert last_response.headers["X-Instana-L"] == '1'
|
132
|
+
assert last_response.headers.key?("Server-Timing")
|
133
|
+
assert last_response.headers["Server-Timing"] == "intid;desc=#{::Instana::Util.id_to_header(rack_span[:t])}"
|
134
|
+
|
135
|
+
assert rack_span.key?(:data)
|
136
|
+
assert rack_span[:data].key?(:http)
|
137
|
+
assert_equal "PUT", rack_span[:data][:http][:method]
|
138
|
+
assert_equal "/mrlobster", rack_span[:data][:http][:url]
|
139
|
+
assert_equal 200, rack_span[:data][:http][:status]
|
140
|
+
assert rack_span.key?(:f)
|
141
|
+
assert rack_span[:f].key?(:e)
|
142
|
+
assert rack_span[:f].key?(:h)
|
143
|
+
assert_equal ::Instana.agent.agent_uuid, rack_span[:f][:h]
|
114
144
|
end
|
115
145
|
|
116
146
|
def test_context_continuation
|
@@ -125,23 +155,33 @@ class RackTest < Minitest::Test
|
|
125
155
|
|
126
156
|
# Span validation
|
127
157
|
assert_equal 1, spans.count
|
128
|
-
|
129
|
-
assert_equal :rack,
|
130
|
-
|
131
|
-
assert
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
assert
|
136
|
-
assert
|
137
|
-
assert
|
138
|
-
|
158
|
+
rack_span = spans.first
|
159
|
+
assert_equal :rack, rack_span[:n]
|
160
|
+
|
161
|
+
assert last_response.headers.key?("X-Instana-T")
|
162
|
+
assert last_response.headers["X-Instana-T"] == ::Instana::Util.id_to_header(rack_span[:t])
|
163
|
+
assert last_response.headers.key?("X-Instana-S")
|
164
|
+
assert last_response.headers["X-Instana-S"] == ::Instana::Util.id_to_header(rack_span[:s])
|
165
|
+
assert last_response.headers.key?("X-Instana-L")
|
166
|
+
assert last_response.headers["X-Instana-L"] == '1'
|
167
|
+
assert last_response.headers.key?("Server-Timing")
|
168
|
+
assert last_response.headers["Server-Timing"] == "intid;desc=#{::Instana::Util.id_to_header(rack_span[:t])}"
|
169
|
+
|
170
|
+
assert rack_span.key?(:data)
|
171
|
+
assert rack_span[:data].key?(:http)
|
172
|
+
assert_equal "GET", rack_span[:data][:http][:method]
|
173
|
+
assert_equal "/mrlobster", rack_span[:data][:http][:url]
|
174
|
+
assert_equal 200, rack_span[:data][:http][:status]
|
175
|
+
assert rack_span.key?(:f)
|
176
|
+
assert rack_span[:f].key?(:e)
|
177
|
+
assert rack_span[:f].key?(:h)
|
178
|
+
assert_equal ::Instana.agent.agent_uuid, rack_span[:f][:h]
|
139
179
|
|
140
180
|
# Context validation
|
141
181
|
# The first span should have the passed in trace ID
|
142
182
|
# and specify the passed in span ID as it's parent.
|
143
|
-
assert_equal 1234,
|
144
|
-
assert_equal 4321,
|
183
|
+
assert_equal 1234, rack_span[:t]
|
184
|
+
assert_equal 4321, rack_span[:p]
|
145
185
|
end
|
146
186
|
|
147
187
|
def test_instana_response_headers
|
@@ -181,17 +221,17 @@ class RackTest < Minitest::Test
|
|
181
221
|
|
182
222
|
# Span validation
|
183
223
|
assert_equal 1, spans.count
|
184
|
-
|
224
|
+
rack_span = spans.first
|
185
225
|
|
186
|
-
assert
|
187
|
-
assert
|
188
|
-
assert !
|
189
|
-
assert_equal "ThereYouGo",
|
226
|
+
assert rack_span[:data][:http].key?(:header)
|
227
|
+
assert rack_span[:data][:http][:header].key?(:"X-Capture-This")
|
228
|
+
assert !rack_span[:data][:http][:header].key?(:"X-Capture-That")
|
229
|
+
assert_equal "ThereYouGo", rack_span[:data][:http][:header][:"X-Capture-This"]
|
190
230
|
|
191
231
|
# Backtrace fingerprint validation
|
192
|
-
assert
|
193
|
-
assert_equal 2,
|
194
|
-
refute_nil
|
232
|
+
assert rack_span.key?(:stack)
|
233
|
+
assert_equal 2, rack_span[:stack].count
|
234
|
+
refute_nil rack_span[:stack].first[:c].match(/instana\/instrumentation\/rack.rb/)
|
195
235
|
|
196
236
|
# Restore to default
|
197
237
|
::Instana.config[:collect_backtraces] = false
|
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
require 'sinatra'
|
2
2
|
if defined?(::Sinatra)
|
3
3
|
require 'test_helper'
|
4
4
|
require File.expand_path(File.dirname(__FILE__) + '/../apps/sinatra')
|
@@ -17,28 +17,36 @@ if defined?(::Sinatra)
|
|
17
17
|
r = get '/'
|
18
18
|
assert last_response.ok?
|
19
19
|
|
20
|
-
assert r.headers.key?("X-Instana-T")
|
21
|
-
assert r.headers.key?("X-Instana-S")
|
22
20
|
|
23
21
|
spans = ::Instana.processor.queued_spans
|
24
22
|
assert_equal 1, spans.count
|
25
23
|
|
26
|
-
|
27
|
-
assert_equal :rack,
|
28
|
-
|
29
|
-
assert first_span[:data].key?(:http)
|
30
|
-
|
31
|
-
assert first_span[:data][:http].key?(:method)
|
32
|
-
assert_equal "GET", first_span[:data][:http][:method]
|
24
|
+
rack_span = spans.first
|
25
|
+
assert_equal :rack, rack_span[:n]
|
26
|
+
# ::Instana::Util.pry!
|
33
27
|
|
34
|
-
assert
|
35
|
-
|
36
|
-
|
37
|
-
assert
|
38
|
-
|
39
|
-
|
40
|
-
assert
|
41
|
-
|
28
|
+
assert r.headers.key?("X-Instana-T")
|
29
|
+
assert r.headers["X-Instana-T"] == ::Instana::Util.id_to_header(rack_span[:t])
|
30
|
+
assert r.headers.key?("X-Instana-S")
|
31
|
+
assert r.headers["X-Instana-S"] == ::Instana::Util.id_to_header(rack_span[:s])
|
32
|
+
assert r.headers.key?("X-Instana-L")
|
33
|
+
assert r.headers["X-Instana-L"] == '1'
|
34
|
+
assert r.headers.key?("Server-Timing")
|
35
|
+
assert r.headers["Server-Timing"] == "intid;desc=#{::Instana::Util.id_to_header(rack_span[:t])}"
|
36
|
+
|
37
|
+
assert rack_span.key?(:data)
|
38
|
+
assert rack_span[:data].key?(:http)
|
39
|
+
assert rack_span[:data][:http].key?(:method)
|
40
|
+
assert_equal "GET", rack_span[:data][:http][:method]
|
41
|
+
|
42
|
+
assert rack_span[:data][:http].key?(:url)
|
43
|
+
assert_equal "/", rack_span[:data][:http][:url]
|
44
|
+
|
45
|
+
assert rack_span[:data][:http].key?(:status)
|
46
|
+
assert_equal 200, rack_span[:data][:http][:status]
|
47
|
+
|
48
|
+
assert rack_span[:data][:http].key?(:host)
|
49
|
+
assert_equal "example.org", rack_span[:data][:http][:host]
|
42
50
|
end
|
43
51
|
end
|
44
52
|
end
|
data/test/tracing/tracer_test.rb
CHANGED
@@ -46,6 +46,37 @@ class TracerTest < Minitest::Test
|
|
46
46
|
assert_equal ::Instana.agent.agent_uuid, first_span[:f][:h]
|
47
47
|
end
|
48
48
|
|
49
|
+
def test_exotic_tag_types
|
50
|
+
clear_all!
|
51
|
+
|
52
|
+
assert_equal false, ::Instana.tracer.tracing?
|
53
|
+
|
54
|
+
require 'resolv'
|
55
|
+
r = Resolv::DNS.new
|
56
|
+
ipv4 = r.getaddress("www.pwpush.com")
|
57
|
+
|
58
|
+
::Instana.tracer.start_or_continue_trace(:rack, {:ipaddr => ipv4}) do
|
59
|
+
assert_equal true, ::Instana.tracer.tracing?
|
60
|
+
sleep 0.1
|
61
|
+
end
|
62
|
+
|
63
|
+
spans = ::Instana.processor.queued_spans
|
64
|
+
assert_equal 1, spans.length
|
65
|
+
|
66
|
+
first_span = spans.first
|
67
|
+
assert_equal :rack, first_span[:n]
|
68
|
+
assert first_span[:ts].is_a?(Integer)
|
69
|
+
assert first_span[:d].is_a?(Integer)
|
70
|
+
assert first_span[:d].between?(100, 130)
|
71
|
+
assert first_span.key?(:data)
|
72
|
+
assert first_span[:data].key?(:ipaddr)
|
73
|
+
assert first_span[:data][:ipaddr].is_a?(String)
|
74
|
+
assert first_span.key?(:f)
|
75
|
+
assert first_span[:f].key?(:e)
|
76
|
+
assert first_span[:f].key?(:h)
|
77
|
+
assert_equal ::Instana.agent.agent_uuid, first_span[:f][:h]
|
78
|
+
end
|
79
|
+
|
49
80
|
def test_errors_are_properly_propagated
|
50
81
|
clear_all!
|
51
82
|
exception_raised = false
|
@@ -198,7 +229,6 @@ class TracerTest < Minitest::Test
|
|
198
229
|
assert_equal sdk_span[:k], 3
|
199
230
|
assert_equal sdk_span[:data][:sdk][:custom][:tags][:sub_task_info], 1
|
200
231
|
assert_equal sdk_span[:data][:sdk][:custom][:tags][:sub_task_exit_info], 1
|
201
|
-
|
202
232
|
end
|
203
233
|
|
204
234
|
def test_block_tracing_error_capture
|
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.11.
|
4
|
+
version: 1.11.8
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Peter Giacomo Lombardo
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-11-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
@@ -131,11 +131,11 @@ executables: []
|
|
131
131
|
extensions: []
|
132
132
|
extra_rdoc_files: []
|
133
133
|
files:
|
134
|
+
- ".circleci/config.yml"
|
134
135
|
- ".codeclimate.yml"
|
135
136
|
- ".fasterer.yml"
|
136
137
|
- ".gitignore"
|
137
138
|
- ".rubocop.yml"
|
138
|
-
- ".travis.yml"
|
139
139
|
- Dockerfile
|
140
140
|
- Gemfile
|
141
141
|
- LICENSE
|
@@ -254,7 +254,6 @@ files:
|
|
254
254
|
- test/tracing/custom_test.rb
|
255
255
|
- test/tracing/id_management_test.rb
|
256
256
|
- test/tracing/opentracing_test.rb
|
257
|
-
- test/tracing/trace_test.rb
|
258
257
|
- test/tracing/tracer_async_test.rb
|
259
258
|
- test/tracing/tracer_test.rb
|
260
259
|
homepage: https://www.instana.com/
|
@@ -292,7 +291,6 @@ test_files:
|
|
292
291
|
- test/tracing/tracer_test.rb
|
293
292
|
- test/tracing/custom_test.rb
|
294
293
|
- test/tracing/opentracing_test.rb
|
295
|
-
- test/tracing/trace_test.rb
|
296
294
|
- test/tracing/tracer_async_test.rb
|
297
295
|
- test/agent/agent_test.rb
|
298
296
|
- test/models/block.rb
|
data/.travis.yml
DELETED
@@ -1,43 +0,0 @@
|
|
1
|
-
language: ruby
|
2
|
-
|
3
|
-
cache:
|
4
|
-
bundler: true
|
5
|
-
directories:
|
6
|
-
- vendor/bundle
|
7
|
-
|
8
|
-
rvm:
|
9
|
-
- 2.6
|
10
|
-
- 2.4
|
11
|
-
|
12
|
-
before_install:
|
13
|
-
- gem update --system
|
14
|
-
- gem install bundler
|
15
|
-
- gem --version
|
16
|
-
|
17
|
-
before_script:
|
18
|
-
- psql -c 'create database travis_ci_test;' -U postgres
|
19
|
-
- mysql -e 'CREATE DATABASE travis_ci_test;'
|
20
|
-
|
21
|
-
script: "bundle exec rake test"
|
22
|
-
|
23
|
-
services:
|
24
|
-
- memcached
|
25
|
-
- redis
|
26
|
-
- mysql
|
27
|
-
- postgresql
|
28
|
-
|
29
|
-
gemfile:
|
30
|
-
- Gemfile
|
31
|
-
- gemfiles/libraries.gemfile
|
32
|
-
- gemfiles/rails50.gemfile
|
33
|
-
- gemfiles/rails60.gemfile
|
34
|
-
|
35
|
-
matrix:
|
36
|
-
exclude:
|
37
|
-
- rvm: 2.4
|
38
|
-
gemfile: gemfiles/rails60.gemfile
|
39
|
-
|
40
|
-
notifications:
|
41
|
-
slack:
|
42
|
-
rooms:
|
43
|
-
secure: Ae9tJmBO9/sgYWthHRS5uufAf8s6uIMdtmQn+gBkcAXaMWJgt1IAzpIj98Qsg15/lhHS8ezwCe7WIAWC4mM1cnwl/hP195dbgLzF4D2uOjaIXj55ckIIE06jBX1yHapu0vMFSaKwgL4auEEVg4xkehBb9TzLNG/LbExadZQOIkeLdtgU04VrPfDC9pZWPplXT4kzjMZkMESzBYaCfNl6eenu0sHdoxSvngv52MImog6aZQKT+k3ccAa1yzZNhUdy4gSZi1HafXdSCn4UTPDtkNIlsWBW8yprICLxZV/NvgUTEEJYSHO6Ucx9Er22LzKtNbEYlAs1GErGWjDzpqvvXt/5UwNx0rLDrVKI/xMIELEbT047mSgJ8tpVd0ErGA/bnDfbF2oDFTAEXq4jaeAMaVR9Q1CW0ZZF2Jh5jOKc41U+AVGgaMDaBA0ukDSeXvJcnteZ9EllOO8ZAtC2FKtBNnj36W13KTR0TkjMCl+KOiVJXnOyRJIR+CUL9BdDuODBVPZHqZaZ48N+MOG9dRb+fvkdTnwh7hU+UmR08kOsd4x+dDlm4dBrFrB8v8udQ7XuBN9AOZty2CPWFUSJM1BxtetyS3We0L6lQ8o/B9STFNK4KTa/M8wNq1Fm85h3ZKHHIHDpQnXM6vD8SV1p9u91C5UI8rEyxzW5IaT2oqXsCzU=
|
data/test/tracing/trace_test.rb
DELETED
@@ -1,67 +0,0 @@
|
|
1
|
-
# require 'test_helper'
|
2
|
-
#
|
3
|
-
# class TraceTest < Minitest::Test
|
4
|
-
# def test_trace_spans_count
|
5
|
-
# t = ::Instana::Trace.new(:test_trace, { :one => 1, :two => 2 })
|
6
|
-
# t.new_span(:sub_span, { :sub_four => 4 })
|
7
|
-
# t.end_span(:sub_five => 5)
|
8
|
-
# t.end_span(:three => 3)
|
9
|
-
# assert t.spans.size == 2
|
10
|
-
# end
|
11
|
-
#
|
12
|
-
# def test_trace_with_incoming_context
|
13
|
-
# incoming_context = { :trace_id => "1234", :span_id => "4321" }
|
14
|
-
# t = ::Instana::Trace.new(:test_trace, { :one => 1, :two => 2 }, incoming_context)
|
15
|
-
# first_span = t.spans.first
|
16
|
-
# assert_equal "1234", first_span[:t]
|
17
|
-
# assert_equal "4321", first_span[:p]
|
18
|
-
# assert t.spans.size == 1
|
19
|
-
# end
|
20
|
-
#
|
21
|
-
# def test_max_value_of_generated_id
|
22
|
-
# # Max is the maximum value for a Java signed long
|
23
|
-
# max_value = 9223372036854775807
|
24
|
-
# 1000.times do
|
25
|
-
# assert ::Instana::Util.generate_id <= max_value
|
26
|
-
# end
|
27
|
-
# end
|
28
|
-
#
|
29
|
-
# def test_min_value_of_generated_id
|
30
|
-
# # Max is the maximum value for a Java signed long
|
31
|
-
# max_value = -9223372036854775808
|
32
|
-
# 1000.times do
|
33
|
-
# assert ::Instana::Util.generate_id >= max_value
|
34
|
-
# end
|
35
|
-
# end
|
36
|
-
#
|
37
|
-
# def test_entry_span_doesnt_have_stack_by_default
|
38
|
-
# t = ::Instana::Trace.new(:rack)
|
39
|
-
# first_span = t.spans.first
|
40
|
-
# assert !first_span.key?(:stack)
|
41
|
-
# end
|
42
|
-
#
|
43
|
-
# def test_entry_span_has_stack_by_config
|
44
|
-
# ::Instana.config[:collect_backtraces] = true
|
45
|
-
# t = ::Instana::Trace.new(:rack)
|
46
|
-
# first_span = t.spans.first
|
47
|
-
# assert first_span.key?(:stack)
|
48
|
-
# assert_equal 2, first_span[:stack].count
|
49
|
-
# ::Instana.config[:collect_backtraces] = false
|
50
|
-
# end
|
51
|
-
#
|
52
|
-
# def test_exit_span_doesnt_have_stack_by_default
|
53
|
-
# t = ::Instana::Trace.new(:trace_test)
|
54
|
-
# t.new_span(:excon)
|
55
|
-
# second_span = t.spans.to_a[1]
|
56
|
-
# assert !second_span.key?(:stack)
|
57
|
-
# end
|
58
|
-
#
|
59
|
-
# def test_exit_span_has_stack_by_config
|
60
|
-
# ::Instana.config[:collect_backtraces] = true
|
61
|
-
# t = ::Instana::Trace.new(:trace_test)
|
62
|
-
# t.new_span(:excon)
|
63
|
-
# second_span = t.spans.to_a[1]
|
64
|
-
# assert second_span.key?(:stack)
|
65
|
-
# ::Instana.config[:collect_backtraces] = false
|
66
|
-
# end
|
67
|
-
# end
|