instana 1.206.0 → 1.207.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bc4bc258b5a217883b3267436a0b70adaef7f270718cd2ab97fc9204c9adab76
4
- data.tar.gz: 77e8b1317b0c6739211bee22c63cfdeb2fa4e9a44b21ec43e6ba76c55440e180
3
+ metadata.gz: 01f078ad2a63d8cd71303a9bf7b413209eda0b2f464ce72f88c84ae05bf797da
4
+ data.tar.gz: d547946bdbb52ea3c3c3a7fc317f7bcd2dd8ccf37d52507788bff1b85fc4434c
5
5
  SHA512:
6
- metadata.gz: ebe6816e014418efb136c4b96c73eb186453e1324da065a5a6943c43677ae91a9816d81e2fc1896c33037b13f7958556164adecbf00f5b993787c956e9e2b2ef
7
- data.tar.gz: b69393f258edb339153b60f980b168c585c57b364070a90cb97e119b2ed0931ebbdee913353d5761ce383c9eb6bc7eb054e0a471e7fa8b04dd6470fdcac80db0
6
+ metadata.gz: df3a3926477ab6842628f7fe1062655e63760c0fc1e5100912c8191f5894b8b4dabb1e030441b0b924d379bd6be56a9b69e877c22220153acba3393af59e4b51
7
+ data.tar.gz: 05fd9a76497614afca946d9538577bdfda21bd3a901759b285d7033425610206fd5a88405f86e86d52928da8f9324798cbf579bb516d845a8749f7c000d98fdf
@@ -102,17 +102,27 @@ module Instana
102
102
  end
103
103
 
104
104
  def metrics_payload(discovery)
105
- proc_table = Sys::ProcTable.ps(pid: Process.pid)
106
- process = ProcessInfo.new(proc_table)
107
-
108
- {
105
+ payload = {
109
106
  pid: discovery['pid'],
110
- name: Util.get_app_name,
111
- exec_args: process.arguments,
112
- gc: GCSnapshot.instance.report,
113
- thread: {count: ::Thread.list.count},
114
- memory: {rss_size: process.memory_used}
107
+ name: Util.get_app_name
115
108
  }
109
+
110
+ if ::Instana.config[:metrics][:memory][:enabled]
111
+ proc_table = Sys::ProcTable.ps(pid: Process.pid)
112
+ process = ProcessInfo.new(proc_table)
113
+ payload[:exec_args] = process.arguments
114
+ payload[:memory] = {rss_size: process.memory_used}
115
+ end
116
+
117
+ if ::Instana.config[:metrics][:gc][:enabled]
118
+ payload[:gc] = GCSnapshot.instance.report
119
+ end
120
+
121
+ if ::Instana.config[:metrics][:thread][:enabled]
122
+ payload[:thread] = {count: ::Thread.list.count}
123
+ end
124
+
125
+ payload
116
126
  end
117
127
  end
118
128
  end
@@ -2,6 +2,6 @@
2
2
  # (c) Copyright Instana Inc. 2016
3
3
 
4
4
  module Instana
5
- VERSION = "1.206.0"
5
+ VERSION = "1.207.0"
6
6
  VERSION_FULL = "instana-#{VERSION}"
7
7
  end
@@ -127,6 +127,75 @@ class HostAgentReportingObserverTest < Minitest::Test
127
127
  ::Instana.config[:metrics][:enabled] = true
128
128
  end
129
129
 
130
+ def test_disable_metrics_memory
131
+ ::Instana.config[:metrics][:memory][:enabled] = false
132
+
133
+ stub_request(:post, "http://10.10.10.10:9292/tracermetrics")
134
+ .to_return(status: 200)
135
+
136
+ stub_request(:post, "http://10.10.10.10:9292/com.instana.plugin.ruby.0")
137
+ .with(body: ->(data) { (JSON.parse(data).keys & ['exec_args', 'memory']).length.eql?(0) })
138
+ .to_return(status: 200)
139
+
140
+ stub_request(:post, "http://10.10.10.10:9292/com.instana.plugin.ruby/traces.0")
141
+ .to_return(status: 200)
142
+
143
+ client = Instana::Backend::RequestClient.new('10.10.10.10', 9292)
144
+ discovery = Concurrent::Atom.new({'pid' => 0})
145
+
146
+ subject = Instana::Backend::HostAgentReportingObserver.new(client, discovery, timer_class: MockTimer)
147
+
148
+ subject.report_timer.block.call
149
+ ensure
150
+ ::Instana.config[:metrics][:memory][:enabled] = true
151
+ end
152
+
153
+ def test_disable_gc
154
+ ::Instana.config[:metrics][:gc][:enabled] = false
155
+
156
+ stub_request(:post, "http://10.10.10.10:9292/tracermetrics")
157
+ .to_return(status: 200)
158
+
159
+ stub_request(:post, "http://10.10.10.10:9292/com.instana.plugin.ruby.0")
160
+ .with(body: ->(data) { (JSON.parse(data).keys & ['gc']).length.eql?(0) })
161
+ .to_return(status: 200)
162
+
163
+ stub_request(:post, "http://10.10.10.10:9292/com.instana.plugin.ruby/traces.0")
164
+ .to_return(status: 200)
165
+
166
+ client = Instana::Backend::RequestClient.new('10.10.10.10', 9292)
167
+ discovery = Concurrent::Atom.new({'pid' => 0})
168
+
169
+ subject = Instana::Backend::HostAgentReportingObserver.new(client, discovery, timer_class: MockTimer)
170
+
171
+ subject.report_timer.block.call
172
+ ensure
173
+ ::Instana.config[:metrics][:gc][:enabled] = true
174
+ end
175
+
176
+ def test_disable_thread
177
+ ::Instana.config[:metrics][:thread][:enabled] = false
178
+
179
+ stub_request(:post, "http://10.10.10.10:9292/tracermetrics")
180
+ .to_return(status: 200)
181
+
182
+ stub_request(:post, "http://10.10.10.10:9292/com.instana.plugin.ruby.0")
183
+ .with(body: ->(data) { (JSON.parse(data).keys & ['thread']).length.eql?(0) })
184
+ .to_return(status: 200)
185
+
186
+ stub_request(:post, "http://10.10.10.10:9292/com.instana.plugin.ruby/traces.0")
187
+ .to_return(status: 200)
188
+
189
+ client = Instana::Backend::RequestClient.new('10.10.10.10', 9292)
190
+ discovery = Concurrent::Atom.new({'pid' => 0})
191
+
192
+ subject = Instana::Backend::HostAgentReportingObserver.new(client, discovery, timer_class: MockTimer)
193
+
194
+ subject.report_timer.block.call
195
+ ensure
196
+ ::Instana.config[:metrics][:thread][:enabled] = true
197
+ end
198
+
130
199
  def test_disable_tracing
131
200
  ::Instana.config[:tracing][:enabled] = false
132
201
 
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.206.0
4
+ version: 1.207.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-08-25 00:00:00.000000000 Z
11
+ date: 2021-08-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler