Skip to content

Commit 928c5d6

Browse files
committed
Bump to 0.1.4
1 parent fa5193f commit 928c5d6

4 files changed

Lines changed: 27 additions & 8 deletions

File tree

.rubocop.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,9 @@ Metrics/MethodLength:
2424

2525
Metrics/AbcSize:
2626
Max: 40
27+
28+
Metrics/CyclomaticComplexity:
29+
Max: 20
30+
31+
Metrics/PerceivedComplexity:
32+
Max: 30

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ Changelog for the bc-prometheus-ruby gem.
22

33
h3. Pending Release
44

5+
h3. 0.1.4
6+
7+
- Handle circumstances when before_fork_callbacks is called outside of the web process
8+
59
h3. 0.1.3
610

711
- Move to bigcommerce fork of multitrap to handle IGNORE clauses more cleanly

lib/bigcommerce/prometheus/integrations/puma.rb

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,21 +25,23 @@ class Puma
2525
##
2626
# Start the puma collector
2727
#
28-
def self.start
28+
def self.start(client: nil, frequency: nil)
29+
return unless puma_enabled?
30+
2931
::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
3234
)
3335
if active_record_enabled?
3436
::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
3739
)
3840
end
3941
::PrometheusExporter::Instrumentation::Process.start(
40-
client: ::Bigcommerce::Prometheus.client,
42+
client: client || ::Bigcommerce::Prometheus.client,
4143
type: ::Bigcommerce::Prometheus.puma_process_label,
42-
frequency: ::Bigcommerce::Prometheus.puma_collection_frequency
44+
frequency: frequency || ::Bigcommerce::Prometheus.puma_collection_frequency
4345
)
4446
end
4547

@@ -49,6 +51,13 @@ def self.start
4951
def self.active_record_enabled?
5052
defined?(ActiveRecord) && ::ActiveRecord::Base.connection_pool.respond_to?(:stat)
5153
end
54+
55+
##
56+
# @return [Boolean]
57+
#
58+
def self.puma_enabled?
59+
defined?(Puma) && Puma.respond_to?(:stats)
60+
end
5261
end
5362
end
5463
end

lib/bigcommerce/prometheus/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@
1717
#
1818
module Bigcommerce
1919
module Prometheus
20-
VERSION = '0.1.3'
20+
VERSION = '0.1.4'
2121
end
2222
end

0 commit comments

Comments
 (0)