instana 1.204.0 → 1.205.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/instana/backend/host_agent_reporting_observer.rb +15 -0
- data/lib/instana/instrumentation/active_record.rb +1 -1
- data/lib/instana/tracing/processor.rb +28 -0
- data/lib/instana/tracing/span.rb +2 -0
- data/lib/instana/version.rb +1 -1
- data/test/backend/host_agent_reporting_observer_test.rb +13 -0
- data/test/instrumentation/rails_active_record_test.rb +0 -7
- data/test/tracing/span_test.rb +17 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1c3c7c5fc1b71dc144d09c38b3bc7d581aafda4cb2eb8e2cd6ee4e49da8d57e8
|
4
|
+
data.tar.gz: da8350cc78acff8b7d01856eb1e2e9cf91654fc9fa74622db909fa566ac3de33
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2c2a0b858a3d838892d58980dd7b95909e7b7606ea23d64862f771adc3b097a2096787d4173ac1c4f12062dc8029de65247a27081f28d8ece7b70dc5fb360c8a
|
7
|
+
data.tar.gz: 89d697026a6d1f34192caa240ff2f058b370595e40feb0e00e428ac343c5fb0af6a81a7c9766f67f4bef1cd9b3c3e9f7c18842fdbbfa66adb65aafa9a3fe810e
|
@@ -9,6 +9,7 @@ module Instana
|
|
9
9
|
ENTITY_DATA_URL = '/com.instana.plugin.ruby.%i'.freeze
|
10
10
|
RESPONSE_DATA_URL = '/com.instana.plugin.ruby/response.%i?messageId=%s'.freeze
|
11
11
|
TRACES_DATA_URL = "/com.instana.plugin.ruby/traces.%i".freeze
|
12
|
+
TRACE_METRICS_URL = "/tracermetrics".freeze
|
12
13
|
|
13
14
|
attr_reader :report_timer
|
14
15
|
|
@@ -35,10 +36,24 @@ module Instana
|
|
35
36
|
def report_to_backend
|
36
37
|
report_metrics if ::Instana.config[:metrics][:enabled]
|
37
38
|
report_traces if ::Instana.config[:tracing][:enabled]
|
39
|
+
report_trace_stats if ::Instana.config[:tracing][:enabled]
|
38
40
|
rescue StandardError => e
|
39
41
|
@logger.error(%(#{e}\n#{e.backtrace.join("\n")}))
|
40
42
|
end
|
41
43
|
|
44
|
+
def report_trace_stats
|
45
|
+
discovery = @discovery.value
|
46
|
+
return unless discovery
|
47
|
+
|
48
|
+
payload = {
|
49
|
+
tracer: 'ruby',
|
50
|
+
pid: discovery['pid'],
|
51
|
+
metrics: @processor.span_metrics
|
52
|
+
}
|
53
|
+
|
54
|
+
@client.send_request('POST', TRACE_METRICS_URL, payload)
|
55
|
+
end
|
56
|
+
|
42
57
|
def report_traces
|
43
58
|
discovery = @discovery.value
|
44
59
|
return unless discovery
|
@@ -19,7 +19,7 @@ module Instana
|
|
19
19
|
}
|
20
20
|
}
|
21
21
|
|
22
|
-
if binds.all? { |b| b.respond_to?(:value_before_type_cast) }
|
22
|
+
if binds.all? { |b| b.respond_to?(:value_before_type_cast) } && !::Instana.config[:sanitize_sql]
|
23
23
|
mapped = binds.map(&:value_before_type_cast)
|
24
24
|
call_payload[:activerecord][:binds] = mapped
|
25
25
|
end
|
@@ -20,6 +20,9 @@ module Instana
|
|
20
20
|
@batch_size = 3000
|
21
21
|
@logger = logger
|
22
22
|
@pid = Process.pid
|
23
|
+
|
24
|
+
@spans_opened = Concurrent::AtomicFixnum.new(0)
|
25
|
+
@spans_closed = Concurrent::AtomicFixnum.new(0)
|
23
26
|
end
|
24
27
|
|
25
28
|
# Adds a span to the span queue
|
@@ -34,9 +37,31 @@ module Instana
|
|
34
37
|
end
|
35
38
|
# :nocov:
|
36
39
|
|
40
|
+
@spans_closed.increment
|
37
41
|
@queue.push(span)
|
38
42
|
end
|
39
43
|
|
44
|
+
# Note that we've started a new span. Used to
|
45
|
+
# generate monitoring metrics.
|
46
|
+
def start_span(_)
|
47
|
+
@spans_opened.increment
|
48
|
+
end
|
49
|
+
|
50
|
+
# Clears and retrieves metrics associated with span creation and submission
|
51
|
+
def span_metrics
|
52
|
+
response = {
|
53
|
+
opened: @spans_opened.value,
|
54
|
+
closed: @spans_closed.value,
|
55
|
+
filtered: 0,
|
56
|
+
dropped: 0
|
57
|
+
}
|
58
|
+
|
59
|
+
@spans_opened.value = 0
|
60
|
+
@spans_closed.value = 0
|
61
|
+
|
62
|
+
response
|
63
|
+
end
|
64
|
+
|
40
65
|
##
|
41
66
|
# send
|
42
67
|
#
|
@@ -82,6 +107,9 @@ module Instana
|
|
82
107
|
# test suite to reset state.
|
83
108
|
#
|
84
109
|
def clear!
|
110
|
+
@spans_opened.value = 0
|
111
|
+
@spans_closed.value = 0
|
112
|
+
|
85
113
|
until @queue.empty? do
|
86
114
|
# Non-blocking pop; ignore exception
|
87
115
|
@queue.pop(true) rescue nil
|
data/lib/instana/tracing/span.rb
CHANGED
data/lib/instana/version.rb
CHANGED
@@ -23,6 +23,8 @@ class HostAgentReportingObserverTest < Minitest::Test
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def test_report
|
26
|
+
stub_request(:post, "http://10.10.10.10:9292/tracermetrics")
|
27
|
+
.to_return(status: 200)
|
26
28
|
stub_request(:post, "http://10.10.10.10:9292/com.instana.plugin.ruby.0")
|
27
29
|
.to_return(status: 200)
|
28
30
|
|
@@ -35,6 +37,8 @@ class HostAgentReportingObserverTest < Minitest::Test
|
|
35
37
|
end
|
36
38
|
|
37
39
|
def test_report_fail
|
40
|
+
stub_request(:post, "http://10.10.10.10:9292/tracermetrics")
|
41
|
+
.to_return(status: 200)
|
38
42
|
stub_request(:post, "http://10.10.10.10:9292/com.instana.plugin.ruby.0")
|
39
43
|
.to_return(status: 500)
|
40
44
|
|
@@ -54,6 +58,9 @@ class HostAgentReportingObserverTest < Minitest::Test
|
|
54
58
|
args: {file: 'test_helper.rb'}
|
55
59
|
)
|
56
60
|
|
61
|
+
stub_request(:post, "http://10.10.10.10:9292/tracermetrics")
|
62
|
+
.to_return(status: 200)
|
63
|
+
|
57
64
|
stub_request(:post, "http://10.10.10.10:9292/com.instana.plugin.ruby.0")
|
58
65
|
.to_return(status: 200, body: action)
|
59
66
|
|
@@ -75,6 +82,9 @@ class HostAgentReportingObserverTest < Minitest::Test
|
|
75
82
|
args: {file: 'test_helper.rb'}
|
76
83
|
])
|
77
84
|
|
85
|
+
stub_request(:post, "http://10.10.10.10:9292/tracermetrics")
|
86
|
+
.to_return(status: 200)
|
87
|
+
|
78
88
|
stub_request(:post, "http://10.10.10.10:9292/com.instana.plugin.ruby.0")
|
79
89
|
.to_return(status: 200, body: action)
|
80
90
|
|
@@ -90,6 +100,9 @@ class HostAgentReportingObserverTest < Minitest::Test
|
|
90
100
|
end
|
91
101
|
|
92
102
|
def test_agent_action_error
|
103
|
+
stub_request(:post, "http://10.10.10.10:9292/tracermetrics")
|
104
|
+
.to_return(status: 200)
|
105
|
+
|
93
106
|
stub_request(:post, "http://10.10.10.10:9292/com.instana.plugin.ruby.0")
|
94
107
|
.to_return(status: 200, body: 'INVALID')
|
95
108
|
|
@@ -38,8 +38,6 @@ class RailsActiveRecordTest < Minitest::Test
|
|
38
38
|
data = span[:data][:activerecord]
|
39
39
|
|
40
40
|
assert data[:sql].start_with?('INSERT INTO')
|
41
|
-
assert 'core', data[:binds][0]
|
42
|
-
assert 'blue', data[:binds][1]
|
43
41
|
end
|
44
42
|
|
45
43
|
def test_read
|
@@ -54,8 +52,6 @@ class RailsActiveRecordTest < Minitest::Test
|
|
54
52
|
data = span[:data][:activerecord]
|
55
53
|
|
56
54
|
assert data[:sql].start_with?('SELECT')
|
57
|
-
assert 'core', data[:binds][0]
|
58
|
-
assert 1, data[:binds][1]
|
59
55
|
end
|
60
56
|
|
61
57
|
def test_update
|
@@ -73,8 +69,6 @@ class RailsActiveRecordTest < Minitest::Test
|
|
73
69
|
data = span[:data][:activerecord]
|
74
70
|
|
75
71
|
assert data[:sql].start_with?('UPDATE')
|
76
|
-
assert 'red', data[:binds][0]
|
77
|
-
assert 1, data[:binds][2]
|
78
72
|
end
|
79
73
|
|
80
74
|
def test_delete
|
@@ -90,7 +84,6 @@ class RailsActiveRecordTest < Minitest::Test
|
|
90
84
|
data = span[:data][:activerecord]
|
91
85
|
|
92
86
|
assert data[:sql].start_with?('DELETE')
|
93
|
-
assert 1, data[:binds][0]
|
94
87
|
end
|
95
88
|
|
96
89
|
def test_raw
|
data/test/tracing/span_test.rb
CHANGED
@@ -133,4 +133,21 @@ class SpanTest < Minitest::Test
|
|
133
133
|
assert_equal({}, span.tags)
|
134
134
|
time.verify
|
135
135
|
end
|
136
|
+
|
137
|
+
def test_inc_processed_counts
|
138
|
+
clear_all!
|
139
|
+
|
140
|
+
span = Instana::Span.new(:excon)
|
141
|
+
span.close
|
142
|
+
|
143
|
+
metrics = Instana.processor.span_metrics
|
144
|
+
|
145
|
+
assert_equal 1, metrics[:opened]
|
146
|
+
assert_equal 1, metrics[:closed]
|
147
|
+
|
148
|
+
metrics = Instana.processor.span_metrics
|
149
|
+
|
150
|
+
assert_equal 0, metrics[:opened]
|
151
|
+
assert_equal 0, metrics[:closed]
|
152
|
+
end
|
136
153
|
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
|
+
version: 1.205.0
|
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: 2021-07-
|
11
|
+
date: 2021-07-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|