plain_apm 0.2.8 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/plain_apm/agent.rb +2 -0
- data/lib/plain_apm/config.rb +24 -6
- data/lib/plain_apm/version.rb +1 -1
- metadata +2 -2
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/agent.rb
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
require "singleton"
|
4
4
|
require "json"
|
5
|
+
require "socket"
|
5
6
|
|
6
7
|
module PlainApm
|
7
8
|
class Agent
|
@@ -30,6 +31,7 @@ module PlainApm
|
|
30
31
|
event.merge!(
|
31
32
|
"version" => PlainApm::VERSION,
|
32
33
|
"collected_at" => Time.now.utc.to_f,
|
34
|
+
"hostname" => Socket.gethostname,
|
33
35
|
"pid" => Process.pid,
|
34
36
|
"thread_id" => Thread.current.object_id.to_s,
|
35
37
|
)
|
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
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: plain_apm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- PlainAPM Team
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-10-
|
11
|
+
date: 2022-10-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|