plain_apm 0.2.9 → 0.3.0

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: c39a4ac239df66dd854830dcc645189a5a21aa1708acae43d2928fb03c691bd6
4
- data.tar.gz: 1acda2ec24a71c06870c32697d00f63136fad59dacecea4e21b99c5df05982cc
3
+ metadata.gz: e496879797c3c3bedfeea9f641b9f113bae2104b6a3c69bb67fdd6cfd8734af6
4
+ data.tar.gz: 484e1217d8d459ccf6c3619da23730c2126094136648a6c8fe15f5dbb63962b1
5
5
  SHA512:
6
- metadata.gz: 3f3c3d112b0bf4b364711d0072fdea6db28da08be2cf36c82bb3c982b9b3c7ba8205caa3a642be503e731c29a88d0e8684b246291dffa24b469a2600d3c875fc
7
- data.tar.gz: c62b897b2b45e7f4bf98059d344e647099592c7b8541950d0a271b0a2ae7d8e3e70bd11a75775de0de7f0094313157cb698ccee13ec3edec2a1aee9c6090c180
6
+ metadata.gz: '052286dd61178482ed0c794f0486d28d21914bb250a77b86ec408599a25d6b6198baa844f34678ec6094ad84f3d3ec37ff2a5761ec89286527d19676ed1b7ef5'
7
+ data.tar.gz: 51b7cbc86ff0c6c8595ffde40361713f41e206d0d73f63ef0bb8270454a3a62af16e5851a789c2c9c2367cb8ade92e36324d9acaca64bd1784cf81fe486ddf15
@@ -7,19 +7,37 @@ module PlainApm
7
7
  attr_accessor :endpoint, :app_key, :enabled
8
8
 
9
9
  def initialize
10
- @enabled = enabled?
10
+ @enabled = enabled? && key_present?
11
11
  @endpoint = ENV["PLAIN_APM_ENDPOINT"] || DEFAULT_EVENT_ENDPOINT
12
- @app_key = ENV["PLAIN_APM_APP_KEY"] || warn("Missing PLAIN_APM_APP_KEY environment variable, plain_apm agent won't start.")
12
+ @app_key = ENV["PLAIN_APM_APP_KEY"]
13
+
14
+ if enabled? && !key_present?
15
+ warn("Missing PLAIN_APM_APP_KEY environment variable, plain_apm agent won't start.")
16
+ end
13
17
  end
14
18
 
15
19
  private
16
20
 
17
21
  def enabled?
18
- force = ENV["PLAIN_APM_ENABLED"] == "1"
19
- key_present = ENV["PLAIN_APM_APP_KEY"] != ""
20
- production = (ENV["RAILS_ENV"] || ENV["RACK_ENV"]) == "production"
22
+ (production? || force_enabled?) && !force_disabled?
23
+ end
24
+
25
+ def key_present?
26
+ ENV["PLAIN_APM_APP_KEY"] != ""
27
+ end
28
+
29
+ def production?
30
+ (ENV["RAILS_ENV"] || ENV["RACK_ENV"]) == "production"
31
+ end
32
+
33
+ # Allow to start in e.g. development.
34
+ def force_enabled?
35
+ ENV["PLAIN_APM_ENABLED"] == "1"
36
+ end
21
37
 
22
- key_present && (production || force)
38
+ # Do not instrument
39
+ def force_disabled?
40
+ ENV["PLAIN_APM_DISABLED"] == "1"
23
41
  end
24
42
  end
25
43
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PlainApm
4
- VERSION = "0.2.9"
4
+ VERSION = "0.3.0"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: plain_apm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.9
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - PlainAPM Team