Skip to content

Commit 422764b

Browse files
authored
Merge pull request #13 from jcolbyfisher/opt-out-of-web-collector
opt-out flag for automatic web instrumentation
2 parents 3df8637 + a691583 commit 422764b

3 files changed

Lines changed: 6 additions & 2 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ After requiring the main file, you can further configure with:
4949
| server_port | The port to run the exporter on | `9394` | `ENV['PROMETHEUS_SERVER_PORT']` |
5050
| server_thread_pool_size | The number of threads used for the exporter server | `3` | `ENV['PROMETHEUS_SERVER_THREAD_POOL_SIZE']` |
5151
| process_name | What the current process name is (used in logging) | `"unknown"` | `ENV['PROCESS']` |
52+
| railtie_disabled | Opt out flag for Railtie; use `Bigcommerce::Prometheus::Instrumentors::Web.new(app: Rails.application).start` in your app's code to start it up yourself | `0` | `ENV['PROMETHEUS_DISABLE_RAILTIE']` |
5253

5354
## Custom Collectors
5455

lib/bigcommerce/prometheus/configuration.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,10 @@ module Configuration
5151
resque_collectors: [],
5252
resque_type_collectors: [],
5353
web_collectors: [],
54-
web_type_collectors: []
54+
web_type_collectors: [],
55+
56+
# Additional configuration
57+
railtie_disabled: ENV.fetch('PROMETHEUS_DISABLE_RAILTIE', 0).to_i.positive?
5558
}.freeze
5659

5760
attr_accessor *VALID_CONFIG_KEYS.keys

lib/bigcommerce/prometheus/integrations/railtie.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ module Integrations
2323
#
2424
class Railtie < ::Rails::Railtie
2525
initializer 'zzz.bc_prometheus_ruby.configure_rails_initialization' do |app|
26-
Bigcommerce::Prometheus::Instrumentors::Web.new(app: app).start
26+
Bigcommerce::Prometheus::Instrumentors::Web.new(app: app).start unless ::Bigcommerce::Prometheus.railtie_disabled
2727
end
2828
end
2929
end

0 commit comments

Comments
 (0)