sidekiq_prometheus 1.5.0 → 1.7.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: 49989dd6e8b4c7c651f70d69e674630900cf5eb3150c4be85df6becb83fc1d18
4
- data.tar.gz: c42b2eac238eaa7c435628962872c750c08b1430a8166219de0343c4fe987fa5
3
+ metadata.gz: c76de7fe8caef12bc6e505dd5e01648c5da34d87b00a6cf756d232a1c988bb46
4
+ data.tar.gz: d211a23831395d5058a7c9ddb281870fde3154956194324984a816b54067e300
5
5
  SHA512:
6
- metadata.gz: 23702691b261c1f0ea0984cccca1267cb5ad3be7a3ebd0ea4c7591d12bb9403e5104cedc372b023f440e080a71ff5c432022f35527ff1e898dba5d07a36ab056
7
- data.tar.gz: 84197b360bbe8c54da5c1e83911643a274a132164bf699d2f8672fbc908e93216918dc405f829f919f9a27fbbaf25d4bed26ff132428f29d14599a5eed1f1d73
6
+ metadata.gz: 0cc266bed6f539d955405fe35b5e41a2f539b65ce7d4a552b70e745fe760a6e1a216ee22278889a193e7456e42bc72cc54b486b7f7266a2a3e80b33754c251f4
7
+ data.tar.gz: 1544e8d064ccc46548153382e531131e250b4bf8acf567daebbf40daab8d934c0d46ef11bdd05ad7ff16f6961b79a205bde999d4e17b1a27e272ca2c1dd1b827
data/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  CHANGELOG
2
2
 
3
+ <a name="v1.6.0"></a>
4
+ ## [v1.6.0](https://github.com/fastly/sidekiq-prometheus/compare/v1.5.0...v1.6.0) (2021-08-03)
5
+
6
+ ### Features
7
+
8
+ * add option for silencing the WEBrick access logging of /metrics
9
+
10
+ ### Pull Requests
11
+
12
+ * Merge pull request [#25](https://github.com/fastly/sidekiq-prometheus/issues/25) from fastly/option_for_silencing_webrick
13
+
3
14
 
4
15
  <a name="v1.5.0"></a>
5
16
  ## [v1.5.0](https://github.com/fastly/sidekiq-prometheus/compare/v1.4.0...v1.5.0) (2021-08-02)
data/README.md CHANGED
@@ -82,6 +82,7 @@ end
82
82
  * `periodic_metrics_enabled`: Boolean that determines whether to run the periodic metrics reporter. `PeriodicMetrics` runs a separate thread that reports on global metrics (if enabled) as well worker GC stats (if enabled). It reports metrics on the interval defined by `periodic_reporting_interval`. Defaults to `true`.
83
83
  * `periodic_reporting_interval`: interval in seconds for reporting periodic metrics. Default: `30`
84
84
  * `metrics_server_enabled`: Boolean that determines whether to run the rack server. Defaults to `true`
85
+ * `metrics_server_logger_enabled`: Boolean that determines if the metrics server will log access logs. Defaults to `true`
85
86
  * `metrics_host`: Host on which the rack server will listen. Defaults to
86
87
  `localhost`
87
88
  * `metrics_port`: Port on which the rack server will listen. Defaults to `9359`
@@ -11,6 +11,9 @@ module SidekiqPrometheus::Metrics
11
11
  { name: :sidekiq_workers_size,
12
12
  type: :gauge,
13
13
  docstring: 'Total number of workers processing jobs', },
14
+ { name: :sidekiq_processes_size,
15
+ type: :gauge,
16
+ docstring: 'Total number of running sidekiq processes', },
14
17
  { name: :sidekiq_dead_size,
15
18
  type: :gauge,
16
19
  docstring: 'Total Dead Size', },
@@ -18,7 +18,7 @@ class SidekiqPrometheus::PeriodicMetrics
18
18
  attr_reader :interval
19
19
  attr_reader :senate, :sidekiq_stats, :sidekiq_queue
20
20
 
21
- GLOBAL_STATS = %i[failed processed retry_size dead_size scheduled_size workers_size].freeze
21
+ GLOBAL_STATS = %i[failed processed retry_size dead_size scheduled_size workers_size processes_size].freeze
22
22
  GC_STATS = {
23
23
  counters: %i[major_gc_count minor_gc_count total_allocated_objects],
24
24
  gauges: %i[heap_live_slots heap_free_slots],
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SidekiqPrometheus
4
- VERSION = '1.5.0'
4
+ VERSION = '1.7.0'
5
5
  end
@@ -57,6 +57,9 @@ module SidekiqPrometheus
57
57
  # @return [Integer] Port on which the metrics server will listen. Default: 9357
58
58
  attr_accessor :metrics_port
59
59
 
60
+ # @return [Boolean] When set to false will silence the metric server access logs. Default: true
61
+ attr_accessor :metrics_server_logger_enabled
62
+
60
63
  # Override the default Prometheus::Client
61
64
  # @return [Prometheus::Client]
62
65
  attr_writer :client
@@ -76,6 +79,7 @@ module SidekiqPrometheus
76
79
  self.metrics_server_enabled = true
77
80
  self.metrics_host = 'localhost'
78
81
  self.metrics_port = 9359
82
+ self.metrics_server_logger_enabled = true
79
83
  self.custom_labels = {}
80
84
  self.custom_metrics = []
81
85
 
@@ -129,6 +133,13 @@ module SidekiqPrometheus
129
133
  metrics_server_enabled
130
134
  end
131
135
 
136
+ ##
137
+ # Helper method for +metrics_server_logger_enabled+ configuration setting
138
+ # @return [Boolean] defaults to true
139
+ def metrics_server_logger_enabled?
140
+ metrics_server_logger_enabled
141
+ end
142
+
132
143
  ##
133
144
  # Get a metric from the registry
134
145
  # @param metric [Symbol] name of metric to fetch
@@ -200,14 +211,23 @@ module SidekiqPrometheus
200
211
  # Will listen on SidekiqPrometheus.metrics_host and
201
212
  # SidekiqPrometheus.metrics_port
202
213
  def metrics_server
214
+ opts = {
215
+ Port: SidekiqPrometheus.metrics_port,
216
+ Host: SidekiqPrometheus.metrics_host,
217
+ }
218
+
219
+ unless metrics_server_logger_enabled?
220
+ opts[:Logger] = WEBrick::Log.new('/dev/null')
221
+ opts[:AccessLog] = []
222
+ end
223
+
203
224
  @_metrics_server ||= Thread.new do
204
225
  Rack::Handler::WEBrick.run(
205
226
  Rack::Builder.new {
206
227
  use Prometheus::Middleware::Exporter, registry: SidekiqPrometheus.registry
207
228
  run ->(_) { [301, { 'Location' => '/metrics' }, []] }
208
229
  },
209
- Port: SidekiqPrometheus.metrics_port,
210
- Host: SidekiqPrometheus.metrics_host,
230
+ **opts
211
231
  )
212
232
  end
213
233
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sidekiq_prometheus
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.0
4
+ version: 1.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lukas Eklund
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2021-08-02 00:00:00.000000000 Z
12
+ date: 2022-09-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler