dboard 3.2.2 → 3.2.3
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/collector.rb +6 -5
- data/lib/logging.rb +11 -0
- data/lib/publisher.rb +2 -1
- data/lib/version.rb +1 -1
- data/spec/collector_spec.rb +3 -5
- data/spec/publisher_spec.rb +5 -2
- data/spec/spec_helper.rb +2 -0
- metadata +2 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a9931a1f53b9ace7790cebe3ea4ae8a63048f94a46060c39b331016c85c49d2a
|
|
4
|
+
data.tar.gz: eaf80b9f6c5d057a904308fe60c2f1408627d53b0f211a13b2c22ff594d23756
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a429b056de777feda66bf30e80c3341acb03ae4443bb8bbd8de8ed3d29870580a1749fa8c9adeff684fba463b2d3fdfae54b6ce55e8111bb10496b8d7693b42a
|
|
7
|
+
data.tar.gz: 15e09890a79432bdbff0a2297fd8c192393e0156f7829544da8cc9e0d5d6641e0064c8c504338298bb4bce22a2a5e1f11a289078d8d86662416b9800af2afdba
|
data/lib/collector.rb
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
require File.expand_path(File.join(File.dirname(__FILE__), "logging"))
|
|
1
2
|
require File.expand_path(File.join(File.dirname(__FILE__), "publisher"))
|
|
2
3
|
require "singleton"
|
|
3
4
|
|
|
@@ -103,8 +104,8 @@ module Dboard
|
|
|
103
104
|
@after_update_callback.call
|
|
104
105
|
end
|
|
105
106
|
rescue Exception => ex
|
|
106
|
-
|
|
107
|
-
|
|
107
|
+
Dboard.logger.error("Failed to update #{source}: #{ex.message}")
|
|
108
|
+
Dboard.logger.error(ex.backtrace.join("\n"))
|
|
108
109
|
@error_callback.call(ex)
|
|
109
110
|
end
|
|
110
111
|
|
|
@@ -158,8 +159,8 @@ module Dboard
|
|
|
158
159
|
break if cleared
|
|
159
160
|
end
|
|
160
161
|
rescue Exception => ex
|
|
161
|
-
|
|
162
|
-
|
|
162
|
+
Dboard.logger.error("Something failed in the update worker for #{key}: #{ex.message}")
|
|
163
|
+
Dboard.logger.error(ex.backtrace.join("\n"))
|
|
163
164
|
ensure
|
|
164
165
|
@mutex.synchronize { @active[key] = false } unless cleared
|
|
165
166
|
end
|
|
@@ -189,7 +190,7 @@ module Dboard
|
|
|
189
190
|
|
|
190
191
|
started = monotonic_now
|
|
191
192
|
update_source(source, instance, batch)
|
|
192
|
-
|
|
193
|
+
Dboard.logger.info([ "#{source} refreshed", describe_batch(batch), "in #{(monotonic_now - started).round(1)}s" ].compact.join(" "))
|
|
193
194
|
true
|
|
194
195
|
}
|
|
195
196
|
end
|
data/lib/logging.rb
ADDED
data/lib/publisher.rb
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
require File.expand_path(File.join(File.dirname(__FILE__), "logging"))
|
|
1
2
|
require "json"
|
|
2
3
|
|
|
3
4
|
module Dboard
|
|
@@ -5,7 +6,7 @@ module Dboard
|
|
|
5
6
|
def self.publish(source, data)
|
|
6
7
|
Api::Client.post("/sources/#{source}", body: { data: data.to_json }, timeout: 10000)
|
|
7
8
|
rescue SocketError => ex
|
|
8
|
-
|
|
9
|
+
Dboard.logger.error("SocketError: #{ex.message}")
|
|
9
10
|
end
|
|
10
11
|
end
|
|
11
12
|
end
|
data/lib/version.rb
CHANGED
data/spec/collector_spec.rb
CHANGED
|
@@ -105,7 +105,6 @@ RSpec.describe Dboard::Collector do
|
|
|
105
105
|
allow(new_relic).to receive(:fetch).and_raise(error)
|
|
106
106
|
allow(callback).to receive(:call)
|
|
107
107
|
allow(Dboard::Publisher).to receive(:publish)
|
|
108
|
-
allow_any_instance_of(Dboard::Collector).to receive(:puts)
|
|
109
108
|
Dboard::Collector.register_error_callback callback
|
|
110
109
|
|
|
111
110
|
Dboard::Collector.instance.update_source(:new_relic, new_relic)
|
|
@@ -133,13 +132,13 @@ RSpec.describe Dboard::Collector do
|
|
|
133
132
|
expect(Dboard::Publisher).to have_received(:publish).with(:new_relic, { db: "100%" })
|
|
134
133
|
end
|
|
135
134
|
|
|
136
|
-
it "
|
|
135
|
+
it "logs debugging info" do
|
|
137
136
|
allow(new_relic).to receive(:fetch).and_raise(Exception.new("some error"))
|
|
138
|
-
allow(Dboard
|
|
137
|
+
allow(Dboard.logger).to receive(:error)
|
|
139
138
|
|
|
140
139
|
Dboard::Collector.instance.update_source(:new_relic, new_relic)
|
|
141
140
|
|
|
142
|
-
expect(Dboard
|
|
141
|
+
expect(Dboard.logger).to have_received(:error).twice
|
|
143
142
|
end
|
|
144
143
|
end
|
|
145
144
|
|
|
@@ -148,7 +147,6 @@ RSpec.describe Dboard::Collector do
|
|
|
148
147
|
|
|
149
148
|
before do
|
|
150
149
|
reset_collector!
|
|
151
|
-
allow(collector).to receive(:puts)
|
|
152
150
|
allow(Dboard::Publisher).to receive(:publish)
|
|
153
151
|
end
|
|
154
152
|
|
data/spec/publisher_spec.rb
CHANGED
|
@@ -26,8 +26,11 @@ describe "Publisher", ".publish" do
|
|
|
26
26
|
|
|
27
27
|
# 2021-12-07: No idea why we've treated this one specially, but keeping it for now.
|
|
28
28
|
it "logs socket errors if we run out of retries" do
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
allow(Dboard::Api::Client).to receive(:post).and_raise(SocketError.new("failed to connect"))
|
|
30
|
+
allow(Dboard.logger).to receive(:error)
|
|
31
|
+
|
|
31
32
|
Dboard::Publisher.publish(:new_relic, {})
|
|
33
|
+
|
|
34
|
+
expect(Dboard.logger).to have_received(:error).with("SocketError: failed to connect")
|
|
32
35
|
end
|
|
33
36
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: dboard
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.2.
|
|
4
|
+
version: 3.2.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Joakim Kolsjö
|
|
@@ -113,6 +113,7 @@ files:
|
|
|
113
113
|
- lib/collector.rb
|
|
114
114
|
- lib/config.rb
|
|
115
115
|
- lib/dboard.rb
|
|
116
|
+
- lib/logging.rb
|
|
116
117
|
- lib/publisher.rb
|
|
117
118
|
- lib/version.rb
|
|
118
119
|
- spec/collector_spec.rb
|