appsignal 2.9.4-java → 2.9.5-java

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: 2303bfeb546ac1f1b6c03090be84755aec9ab6210fefbd5d165f16aa446db426
4
- data.tar.gz: 90335983a5d7510dd60bc4c115c19fac30c2494aac990fff1a6f4e32b0cb8827
3
+ metadata.gz: effa13f4712da9135dbc3c18772b32247582744e1cf88ac17c9ef42606f7e48a
4
+ data.tar.gz: 462d6bcfa88907d7e22b1d9f462c07cbc6b730d4b71e9dfc56d4ae67906223cd
5
5
  SHA512:
6
- metadata.gz: 3aa227832976b5ab3aaca606273c9feb27568867914bd61ea8956d74963fbb16461db5f61c21e0e24c11d229802e4ba605235ecc902162389672a17c953b6c77
7
- data.tar.gz: fb51d1964fd3e388324263efe3af0aa6fa7a90bb2c0b8f9a3bb149fb854b377d774b3cc84ffc5aade6fadd87619d83a5a682d836fa348e9a1ce5d6f0fe477e00
6
+ metadata.gz: ba076205d8671f8fdaf2c9581ec23a0ff4c08f4b2b9bf26afe81e2481ede99cb17ae5b95b83db344fbc61df13f58213ad11c0b99aee4f5731be5155e5faa356c
7
+ data.tar.gz: 00b290c9140898b039d2d66e43386ed23d8248d27675f43178c489356e96cf6911d5d585c9432898d4685f0772f4556f28bcbe0a44418480ccb51859a3c62cf5
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 2.9.5
4
+ - Delay the first minutely probe for a bit, since it might take some
5
+ time for dependencies to initialize. PR #511
6
+
3
7
  ## 2.9.4
4
8
  - Log error backtraces in minutely probes as debug messages. PR #495
5
9
  - Don't add cluster behavior in Puma single mode. PR #504
@@ -33,6 +37,14 @@
33
37
  - Move instrumentation & metrics helpers to modules. PR #487
34
38
  - Add Puma minutely probe. PR #488
35
39
  - Log invalid EventFormatter registrations as errors. PR #491
40
+ - Support container CPU host metrics.
41
+ Commit f2fca1ec5a850cd84fbc8cefe63af8f039ebb155
42
+ - Support StatsD server in agent.
43
+ Commit f2fca1ec5a850cd84fbc8cefe63af8f039ebb155
44
+ - Fix samples being reported for multiple namespaces.
45
+ Commit f2fca1ec5a850cd84fbc8cefe63af8f039ebb155
46
+ - Report memory and swap usage in percent using the memory_usage and
47
+ swap_usage metrics. Commit f2fca1ec5a850cd84fbc8cefe63af8f039ebb155
36
48
 
37
49
  ## 2.8.4
38
50
  - Log memory usage of agent if high.
@@ -10,8 +10,8 @@ require File.expand_path("../../lib/appsignal/system.rb", __FILE__)
10
10
  EXT_PATH = File.expand_path("..", __FILE__).freeze
11
11
  AGENT_CONFIG = YAML.load(File.read(File.join(EXT_PATH, "agent.yml"))).freeze
12
12
 
13
- PLATFORM = Appsignal::System.agent_platform
14
- ARCH = "#{RbConfig::CONFIG["host_cpu"]}-#{PLATFORM}".freeze
13
+ AGENT_PLATFORM = Appsignal::System.agent_platform
14
+ ARCH = "#{RbConfig::CONFIG["host_cpu"]}-#{AGENT_PLATFORM}".freeze
15
15
  CA_CERT_PATH = File.join(EXT_PATH, "../resources/cacert.pem").freeze
16
16
 
17
17
  def ext_path(path)
@@ -37,7 +37,7 @@ def report
37
37
  "time" => Time.now.utc,
38
38
  "package_path" => File.dirname(__dir__),
39
39
  "architecture" => rbconfig["host_cpu"],
40
- "target" => PLATFORM,
40
+ "target" => AGENT_PLATFORM,
41
41
  "musl_override" => Appsignal::System.force_musl_build?,
42
42
  "dependencies" => {},
43
43
  "flags" => {}
@@ -25,7 +25,7 @@ def install
25
25
  is_linux_system = [
26
26
  Appsignal::System::LINUX_TARGET,
27
27
  Appsignal::System::MUSL_TARGET
28
- ].include?(PLATFORM)
28
+ ].include?(AGENT_PLATFORM)
29
29
 
30
30
  require "mkmf"
31
31
  link_libraries if is_linux_system
@@ -28,6 +28,8 @@ module Appsignal
28
28
  def initialize(config = {})
29
29
  @config = config
30
30
  @cache = {}
31
+ config_string = " with config: #{config}" unless config.empty?
32
+ Appsignal.logger.debug("Initializing Sidekiq probe#{config_string}")
31
33
  require "sidekiq/api"
32
34
  end
33
35
 
@@ -87,11 +89,15 @@ module Appsignal
87
89
  return @hostname if defined?(@hostname)
88
90
  if config.key?(:hostname)
89
91
  @hostname = config[:hostname]
92
+ Appsignal.logger.debug "Sidekiq probe: Using hostname config " \
93
+ "option #{@hostname.inspect} as hostname"
90
94
  return @hostname
91
95
  end
92
96
 
93
97
  host = nil
94
98
  ::Sidekiq.redis { |c| host = c.connection[:host] }
99
+ Appsignal.logger.debug "Sidekiq probe: Using Redis server hostname " \
100
+ "#{host.inspect} as hostname"
95
101
  @hostname = host
96
102
  end
97
103
  end
@@ -137,6 +137,7 @@ module Appsignal
137
137
  stop
138
138
  initialize_probes
139
139
  @@thread = Thread.new do
140
+ sleep initial_wait_time
140
141
  loop do
141
142
  logger = Appsignal.logger
142
143
  logger.debug("Gathering minutely metrics with #{probes.count} probes")
@@ -149,7 +150,7 @@ module Appsignal
149
150
  logger.debug ex.backtrace.join("\n")
150
151
  end
151
152
  end
152
- sleep(Appsignal::Minutely.wait_time)
153
+ sleep wait_time
153
154
  end
154
155
  end
155
156
  end
@@ -167,6 +168,12 @@ module Appsignal
167
168
 
168
169
  private
169
170
 
171
+ def initial_wait_time
172
+ remaining_seconds = 60 - Time.now.sec
173
+ return remaining_seconds if remaining_seconds > 30
174
+ remaining_seconds + 60
175
+ end
176
+
170
177
  def initialize_probes
171
178
  probes.each do |name, probe|
172
179
  instance = probe.respond_to?(:new) ? probe.new : probe
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Appsignal
4
- VERSION = "2.9.4".freeze
4
+ VERSION = "2.9.5".freeze
5
5
  end
@@ -202,14 +202,16 @@ describe Appsignal::Config do
202
202
  context "with a config file" do
203
203
  let(:config) { project_fixture_config("production") }
204
204
 
205
- it "is not valid or active" do
206
- expect(config.valid?).to be_truthy
207
- expect(config.active?).to be_truthy
208
- end
205
+ context "with valid config" do
206
+ it "is valid and active" do
207
+ expect(config.valid?).to be_truthy
208
+ expect(config.active?).to be_truthy
209
+ end
209
210
 
210
- it "does not log an error" do
211
- expect_any_instance_of(Logger).to_not receive(:error)
212
- config
211
+ it "does not log an error" do
212
+ log = capture_logs { config }
213
+ expect(log).to_not contains_log(:error)
214
+ end
213
215
  end
214
216
 
215
217
  it "sets the file_config" do
@@ -671,6 +671,22 @@ describe Appsignal::Hooks::SidekiqProbe do
671
671
  expect(defined?(Sidekiq::API)).to be_truthy
672
672
  end
673
673
 
674
+ it "logs config on initialize" do
675
+ log = capture_logs { probe }
676
+ expect(log).to contains_log(:debug, "Initializing Sidekiq probe\n")
677
+ end
678
+
679
+ it "logs used hostname on call once" do
680
+ log = capture_logs { probe.call }
681
+ expect(log).to contains_log(
682
+ :debug,
683
+ %(Sidekiq probe: Using Redis server hostname "localhost" as hostname)
684
+ )
685
+ log = capture_logs { probe.call }
686
+ # Match more logs with incompelete message
687
+ expect(log).to_not contains_log(:debug, %(Sidekiq probe: ))
688
+ end
689
+
674
690
  it "collects custom metrics" do
675
691
  expect_gauge("worker_count", 24).twice
676
692
  expect_gauge("process_count", 25).twice
@@ -698,7 +714,16 @@ describe Appsignal::Hooks::SidekiqProbe do
698
714
 
699
715
  it "uses the redis hostname for the hostname tag" do
700
716
  allow(Appsignal).to receive(:set_gauge).and_call_original
701
- probe.call
717
+ log = capture_logs { probe }
718
+ expect(log).to contains_log(
719
+ :debug,
720
+ %(Initializing Sidekiq probe with config: {:hostname=>"#{redis_hostname}"})
721
+ )
722
+ log = capture_logs { probe.call }
723
+ expect(log).to contains_log(
724
+ :debug,
725
+ "Sidekiq probe: Using hostname config option #{redis_hostname.inspect} as hostname"
726
+ )
702
727
  expect(Appsignal).to have_received(:set_gauge)
703
728
  .with(anything, anything, :hostname => redis_hostname).at_least(:once)
704
729
  end
@@ -31,7 +31,14 @@ describe Appsignal::Minutely do
31
31
  before do
32
32
  Appsignal.logger = test_logger(log_stream)
33
33
  # Speed up test time
34
- allow(Appsignal::Minutely).to receive(:wait_time).and_return(0.001)
34
+ expect(Appsignal::Minutely).to receive(:initial_wait_time)
35
+ .ordered
36
+ .once
37
+ .and_return(0.001)
38
+ expect(Appsignal::Minutely).to receive(:wait_time)
39
+ .ordered
40
+ .at_least(:once)
41
+ .and_return(0.001)
35
42
  end
36
43
 
37
44
  context "with an instance of a class" do
@@ -94,6 +101,9 @@ describe Appsignal::Minutely do
94
101
  end
95
102
 
96
103
  it "ensures only one minutely probes thread is active at a time" do
104
+ # Starting twice in this spec, so expecting it more than once
105
+ expect(Appsignal::Minutely).to receive(:initial_wait_time).at_least(:once).and_return(0.001)
106
+
97
107
  alive_thread_counter = proc { Thread.list.reject { |t| t.status == "dead" }.length }
98
108
  probe = Probe.new
99
109
  Appsignal::Minutely.probes.register :my_probe, probe
@@ -141,6 +151,10 @@ describe Appsignal::Minutely do
141
151
  end
142
152
 
143
153
  describe ".stop" do
154
+ before do
155
+ allow(Appsignal::Minutely).to receive(:initial_wait_time).and_return(0.001)
156
+ end
157
+
144
158
  it "stops the minutely thread" do
145
159
  Appsignal::Minutely.start
146
160
  thread = Appsignal::Minutely.class_variable_get(:@@thread)
@@ -163,8 +177,30 @@ describe Appsignal::Minutely do
163
177
 
164
178
  describe ".wait_time" do
165
179
  it "gets the time to the next minute" do
166
- allow_any_instance_of(Time).to receive(:sec).and_return(20)
167
- expect(Appsignal::Minutely.wait_time).to eq 40
180
+ time = Time.new(2019, 4, 9, 12, 0, 20)
181
+ Timecop.freeze time do
182
+ expect(Appsignal::Minutely.wait_time).to eq 40
183
+ end
184
+ end
185
+ end
186
+
187
+ describe ".initial_wait_time" do
188
+ context "when started in the last 30 seconds of a minute" do
189
+ it "waits for the number of seconds + 60" do
190
+ time = Time.new(2019, 4, 9, 12, 0, 31)
191
+ Timecop.freeze time do
192
+ expect(Appsignal::Minutely.send(:initial_wait_time)).to eql(29 + 60)
193
+ end
194
+ end
195
+ end
196
+
197
+ context "when started in the first 30 seconds of a minute" do
198
+ it "waits the remaining seconds in the minute" do
199
+ time = Time.new(2019, 4, 9, 12, 0, 29)
200
+ Timecop.freeze time do
201
+ expect(Appsignal::Minutely.send(:initial_wait_time)).to eql(31)
202
+ end
203
+ end
168
204
  end
169
205
  end
170
206
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: appsignal
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.9.4
4
+ version: 2.9.5
5
5
  platform: java
6
6
  authors:
7
7
  - Robert Beekman
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2019-04-02 00:00:00.000000000 Z
12
+ date: 2019-04-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rack
@@ -393,7 +393,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
393
393
  - !ruby/object:Gem::Version
394
394
  version: '0'
395
395
  requirements: []
396
- rubygems_version: 3.0.2
396
+ rubyforge_project:
397
+ rubygems_version: 2.7.6
397
398
  signing_key:
398
399
  specification_version: 4
399
400
  summary: Logs performance and exception data from your app to appsignal.com