sidekiq_prometheus 1.5.0 → 1.6.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: a6dc43957020461f1b740cee64cdfff9b40f624d4bfe41d57eab772a27fd2b21
4
+ data.tar.gz: adb0cb635975340d514fbea0c798e5269238eb990700a7eeae8c9a2d8d32e6e7
5
5
  SHA512:
6
- metadata.gz: 23702691b261c1f0ea0984cccca1267cb5ad3be7a3ebd0ea4c7591d12bb9403e5104cedc372b023f440e080a71ff5c432022f35527ff1e898dba5d07a36ab056
7
- data.tar.gz: 84197b360bbe8c54da5c1e83911643a274a132164bf699d2f8672fbc908e93216918dc405f829f919f9a27fbbaf25d4bed26ff132428f29d14599a5eed1f1d73
6
+ metadata.gz: 48f466c9d2904644ce161665b5f06092dff197e4b2550d9355d6c6e57832fc779d4ef3f5c0abaa63013c91fd249bb134234f201aafe9a9271f3bb121123b25ec
7
+ data.tar.gz: c2c181822b1a9d1e2ace0084301ac4517966a8bf4672884dd48c352d7af18374e7b2cb94d5f628a799dce8e12a372dadbc814d9d0cd91be211da097b0584e765
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_logging_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`
@@ -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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SidekiqPrometheus
4
- VERSION = '1.5.0'
4
+ VERSION = '1.6.0'
5
5
  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.6.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: 2021-08-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler