g5_prom_rails 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/g5_prom_rails/sidekiq_application_metrics.rb +36 -30
- data/lib/g5_prom_rails/version.rb +1 -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: a550648d2600ce6e0646297076ebdf0775481cb1
|
4
|
+
data.tar.gz: 0555b5e32a9852ac09b56d4fe71d34dd233146e7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e2f115cedfd41f842f268598ff5106beceb55f9eead7ca007eebe5b63dd11cadbc846ff0c28575912d8ac605f3e8e04d232c238b5187015ebe34113e78c622ce
|
7
|
+
data.tar.gz: e3810cbbdeb532a07d5bf7bec765156cfc032a2824b25c46f09752ee019b273811b1ac00df1559e9ba5f902106211cb31b39a53f29379183481449f664193dba
|
@@ -1,38 +1,44 @@
|
|
1
|
-
|
1
|
+
begin
|
2
|
+
require 'sidekiq/api'
|
2
3
|
|
3
|
-
module G5PromRails::SidekiqApplicationMetrics
|
4
|
-
|
4
|
+
module G5PromRails::SidekiqApplicationMetrics
|
5
|
+
extend ActiveSupport::Concern
|
5
6
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
7
|
+
def initialize_sidekiq_application
|
8
|
+
@processed_counter = G5PromRails::SettableCounter.new(
|
9
|
+
:sidekiq_processed,
|
10
|
+
"jobs processed"
|
11
|
+
)
|
12
|
+
per_application.register(@processed_counter)
|
13
|
+
@failed_counter = G5PromRails::SettableCounter.new(
|
14
|
+
:sidekiq_failed,
|
15
|
+
"jobs failed"
|
16
|
+
)
|
17
|
+
per_application.register(@failed_counter)
|
17
18
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
19
|
+
@retry_gauge = per_application.gauge(
|
20
|
+
:sidekiq_retry,
|
21
|
+
"jobs to be retried"
|
22
|
+
)
|
23
|
+
@queues_gauge = per_application.gauge(
|
24
|
+
:sidekiq_queued,
|
25
|
+
"job queue lengths"
|
26
|
+
)
|
27
|
+
end
|
27
28
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
29
|
+
def update_sidekiq_statistics
|
30
|
+
stats = Sidekiq::Stats.new
|
31
|
+
@processed_counter.set({}, stats.processed)
|
32
|
+
@failed_counter.set({}, stats.failed)
|
33
|
+
@retry_gauge.set({}, stats.retry_size)
|
33
34
|
|
34
|
-
|
35
|
-
|
35
|
+
Sidekiq::Stats::Queues.new.lengths.each do |queue, length|
|
36
|
+
@queues_gauge.set({ queue: queue }, length)
|
37
|
+
end
|
36
38
|
end
|
37
39
|
end
|
40
|
+
rescue LoadError
|
41
|
+
if defined?(Sidekiq)
|
42
|
+
puts "problem loading sidekiq/api in g5_prom_rails, but you have sidekiq"
|
43
|
+
end
|
38
44
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: g5_prom_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Don Petersen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-08-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|