instana 1.4.6 → 1.4.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/instana/tracer.rb +1 -1
- data/lib/instana/util.rb +7 -1
- data/lib/instana/version.rb +1 -1
- data/test/tracing/id_management_test.rb +35 -1
- 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: 46ca5cff704edd13d94cd98eff05943e16d54132
|
4
|
+
data.tar.gz: da416ea68943aee4b223683c8a0a1a7e33d5fbe8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1a109723a6d7285203e57d93163c7be999dd3ed7f90b3aff053d40b625a0631dc814773db35d8abed7dbdf62cf08b615649e1f0d8597841ed963354061bdd556
|
7
|
+
data.tar.gz: ca5605829d78d18841516c6af59a70d552479affd0d353169d86e245fe5e2ec0b3d5e6d1708baa92c57f1ab3f680cb4332bf6246b1e565af83cff93060215c43
|
data/lib/instana/tracer.rb
CHANGED
@@ -393,7 +393,7 @@ module Instana
|
|
393
393
|
# Indicates if the name of the current span matches <candidate>
|
394
394
|
#
|
395
395
|
def current_span_name?(candidate)
|
396
|
-
self.current_trace && self.current_trace.current_span.name == candidate
|
396
|
+
self.current_trace && self.current_trace.current_span.name == candidate.to_sym
|
397
397
|
end
|
398
398
|
|
399
399
|
# Used in the test suite, this resets the tracer to non-tracing state.
|
data/lib/instana/util.rb
CHANGED
@@ -191,7 +191,7 @@ module Instana
|
|
191
191
|
Instana.logger.debug "id_to_header received a #{id.class}: returning empty string"
|
192
192
|
return String.new
|
193
193
|
end
|
194
|
-
[id.to_i].pack('q>').unpack('H*')[0]
|
194
|
+
[id.to_i].pack('q>').unpack('H*')[0].gsub(/^0+/, '')
|
195
195
|
rescue => e
|
196
196
|
Instana.logger.error "#{__method__}:#{File.basename(__FILE__)}:#{__LINE__}: #{e.message}"
|
197
197
|
Instana.logger.debug e.backtrace.join("\r\n")
|
@@ -208,6 +208,12 @@ module Instana
|
|
208
208
|
Instana.logger.debug "header_to_id received a #{header_id.class}: returning 0"
|
209
209
|
return 0
|
210
210
|
end
|
211
|
+
if header_id.length < 16
|
212
|
+
# The header is less than 16 chars. Prepend
|
213
|
+
# zeros so we can convert correctly
|
214
|
+
missing = 16 - header_id.length
|
215
|
+
header_id = ("0" * missing) + header_id
|
216
|
+
end
|
211
217
|
[header_id].pack("H*").unpack("q>")[0]
|
212
218
|
rescue => e
|
213
219
|
Instana.logger.error "#{__method__}:#{File.basename(__FILE__)}:#{__LINE__}: #{e.message}"
|
data/lib/instana/version.rb
CHANGED
@@ -26,7 +26,7 @@ class TracerIDMgmtTest < Minitest::Test
|
|
26
26
|
|
27
27
|
# Assert that it is a string and there are no non-hex characters
|
28
28
|
assert converted_id.is_a?(String)
|
29
|
-
assert converted_id ==
|
29
|
+
assert converted_id == ''
|
30
30
|
|
31
31
|
# Test passing a nil
|
32
32
|
converted_id = Instana::Util.id_to_header(nil)
|
@@ -78,6 +78,23 @@ class TracerIDMgmtTest < Minitest::Test
|
|
78
78
|
id = Instana::Util.header_to_id(original_header_id)
|
79
79
|
converted_back_header_id = Instana::Util.id_to_header(id)
|
80
80
|
assert_equal original_header_id, converted_back_header_id
|
81
|
+
|
82
|
+
# Test a random value
|
83
|
+
id = -7815363404733516491
|
84
|
+
header = "938a406416457535"
|
85
|
+
|
86
|
+
result = Instana::Util.header_to_id(header)
|
87
|
+
assert_equal id, result
|
88
|
+
|
89
|
+
result = Instana::Util.id_to_header(id)
|
90
|
+
assert_equal header, result
|
91
|
+
|
92
|
+
10000.times do
|
93
|
+
original_id = ::Instana::Util.generate_id
|
94
|
+
header_id = Instana::Util.id_to_header(original_id)
|
95
|
+
converted_back_id = Instana::Util.header_to_id(header_id)
|
96
|
+
assert original_id == converted_back_id
|
97
|
+
end
|
81
98
|
end
|
82
99
|
|
83
100
|
def test_id_max_value_and_conversion
|
@@ -93,4 +110,21 @@ class TracerIDMgmtTest < Minitest::Test
|
|
93
110
|
assert_equal min_id, Instana::Util.header_to_id(min_hex)
|
94
111
|
end
|
95
112
|
|
113
|
+
def test_that_leading_zeros_handled_correctly
|
114
|
+
|
115
|
+
header = ::Instana::Util.id_to_header(16)
|
116
|
+
assert_equal "10", header
|
117
|
+
|
118
|
+
id = ::Instana::Util.header_to_id("10")
|
119
|
+
assert_equal 16, id
|
120
|
+
|
121
|
+
id = ::Instana::Util.header_to_id("0000000000000010")
|
122
|
+
assert_equal 16, id
|
123
|
+
|
124
|
+
id = ::Instana::Util.header_to_id("88b6c735206ca42")
|
125
|
+
assert_equal 615705016619420226, id
|
126
|
+
|
127
|
+
id = ::Instana::Util.header_to_id("088b6c735206ca42")
|
128
|
+
assert_equal 615705016619420226, id
|
129
|
+
end
|
96
130
|
end
|
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.7
|
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-05-
|
11
|
+
date: 2017-05-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|