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 +4 -4
- data/lib/plain_apm/config.rb +24 -6
- data/lib/plain_apm/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e496879797c3c3bedfeea9f641b9f113bae2104b6a3c69bb67fdd6cfd8734af6
|
4
|
+
data.tar.gz: 484e1217d8d459ccf6c3619da23730c2126094136648a6c8fe15f5dbb63962b1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '052286dd61178482ed0c794f0486d28d21914bb250a77b86ec408599a25d6b6198baa844f34678ec6094ad84f3d3ec37ff2a5761ec89286527d19676ed1b7ef5'
|
7
|
+
data.tar.gz: 51b7cbc86ff0c6c8595ffde40361713f41e206d0d73f63ef0bb8270454a3a62af16e5851a789c2c9c2367cb8ade92e36324d9acaca64bd1784cf81fe486ddf15
|
data/lib/plain_apm/config.rb
CHANGED
@@ -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"]
|
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
|
-
|
19
|
-
|
20
|
-
|
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
|
-
|
38
|
+
# Do not instrument
|
39
|
+
def force_disabled?
|
40
|
+
ENV["PLAIN_APM_DISABLED"] == "1"
|
23
41
|
end
|
24
42
|
end
|
25
43
|
end
|
data/lib/plain_apm/version.rb
CHANGED