bc-prometheus-ruby 0.1.3 → 0.1.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8c4c4c0a02b669f30bb1fe0577bff4f4ea621b071e196ef4da9cf6fbcaf3cdc2
4
- data.tar.gz: 63df1c931c201e6553130283cbce1970b43cc1801c0522249b9a2661821c7f12
3
+ metadata.gz: 1c0e12140ddec68a3948d287f64447dd3bfc431a26cdb1c5bee3148732263396
4
+ data.tar.gz: 60d57ee94401660ee6f9fa980106d70f9e158b29c03de6b7f28a6965effabe4a
5
5
  SHA512:
6
- metadata.gz: b248ce10ec9d1a7e2d836fed0ddac2a294fe93878aae36b9b43681359ce34199d558bb2ba1b82a1eeeba23b4db9f6f22d6085ff5c0c28e4118dcea55bcda689c
7
- data.tar.gz: 3351143d764d3057000302c228f988b024a25bda4aa75c6afa5a38a858827e5f24552f70d471007a3c2f9f4ca7cc00dbb94a6fec8ce468ac8dbf253a896fc6e0
6
+ metadata.gz: e60684700496ab86fc11451bb472e5747103f6c100724959b3477859ed89f4d21b392894bcac431cb740501bca7e4878b65c8b33a9c6e8b78c96bddea1ae042f
7
+ data.tar.gz: 46b989c7bd48a418944adfc477cd870962e9ab0bb02d0645f5a31f99848cef8fb0262df10f049b3ddec8c2dbf30c6e7efae5fd31867bb9bc3b5f13a14eb0856e
data/CHANGELOG.md CHANGED
@@ -2,6 +2,10 @@ Changelog for the bc-prometheus-ruby gem.
2
2
 
3
3
  h3. Pending Release
4
4
 
5
+ h3. 0.1.4
6
+
7
+ - Handle circumstances when before_fork_callbacks is called outside of the web process
8
+
5
9
  h3. 0.1.3
6
10
 
7
11
  - Move to bigcommerce fork of multitrap to handle IGNORE clauses more cleanly
@@ -25,21 +25,23 @@ module Bigcommerce
25
25
  ##
26
26
  # Start the puma collector
27
27
  #
28
- def self.start
28
+ def self.start(client: nil, frequency: nil)
29
+ return unless puma_enabled?
30
+
29
31
  ::PrometheusExporter::Instrumentation::Puma.start(
30
- client: ::Bigcommerce::Prometheus.client,
31
- frequency: ::Bigcommerce::Prometheus.puma_collection_frequency
32
+ client: client || ::Bigcommerce::Prometheus.client,
33
+ frequency: frequency || ::Bigcommerce::Prometheus.puma_collection_frequency
32
34
  )
33
35
  if active_record_enabled?
34
36
  ::PrometheusExporter::Instrumentation::ActiveRecord.start(
35
- client: ::Bigcommerce::Prometheus.client,
36
- frequency: ::Bigcommerce::Prometheus.puma_collection_frequency
37
+ client: client || ::Bigcommerce::Prometheus.client,
38
+ frequency: frequency || ::Bigcommerce::Prometheus.puma_collection_frequency
37
39
  )
38
40
  end
39
41
  ::PrometheusExporter::Instrumentation::Process.start(
40
- client: ::Bigcommerce::Prometheus.client,
42
+ client: client || ::Bigcommerce::Prometheus.client,
41
43
  type: ::Bigcommerce::Prometheus.puma_process_label,
42
- frequency: ::Bigcommerce::Prometheus.puma_collection_frequency
44
+ frequency: frequency || ::Bigcommerce::Prometheus.puma_collection_frequency
43
45
  )
44
46
  end
45
47
 
@@ -49,6 +51,13 @@ module Bigcommerce
49
51
  def self.active_record_enabled?
50
52
  defined?(ActiveRecord) && ::ActiveRecord::Base.connection_pool.respond_to?(:stat)
51
53
  end
54
+
55
+ ##
56
+ # @return [Boolean]
57
+ #
58
+ def self.puma_enabled?
59
+ defined?(Puma) && Puma.respond_to?(:stats)
60
+ end
52
61
  end
53
62
  end
54
63
  end
@@ -17,6 +17,6 @@
17
17
  #
18
18
  module Bigcommerce
19
19
  module Prometheus
20
- VERSION = '0.1.3'
20
+ VERSION = '0.1.4'
21
21
  end
22
22
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bc-prometheus-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shaun McCormick
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-11-08 00:00:00.000000000 Z
11
+ date: 2019-11-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake