vx-lib-instrumentation 0.1.10 → 0.1.11
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/vx/lib/instrumentation/version.rb +1 -1
- data/lib/vx/lib/instrumentation.rb +16 -4
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ffcca3384777b519cd65b0a9f92218be25e8e546
|
4
|
+
data.tar.gz: fe5568c440ae31cd4b1b54746295db11ca766765
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d3387b7c835cb6d29edb97e0084b190ae418e3486dcaf7d24e3725af1d92d93709e564e828195aa9dd08ccfd5956166449a29570bfdbbf8f50c1724eb4f9d83c
|
7
|
+
data.tar.gz: 44a09daa2de42c0369e87bc5e558a8212468129272aafb797c6887409ccb36e9f0b1889ddf575a8a09a6a3b5d7447ead1d41b974520c37a59ce1b7f789472321
|
@@ -14,6 +14,12 @@ module Vx ; module Lib ; module Instrumentation
|
|
14
14
|
|
15
15
|
extend self
|
16
16
|
|
17
|
+
@@app_name = nil
|
18
|
+
|
19
|
+
def app_name
|
20
|
+
@@app_name
|
21
|
+
end
|
22
|
+
|
17
23
|
def root
|
18
24
|
File.expand_path("../", __FILE__)
|
19
25
|
end
|
@@ -24,8 +30,12 @@ module Vx ; module Lib ; module Instrumentation
|
|
24
30
|
end
|
25
31
|
end
|
26
32
|
|
27
|
-
def install(target,
|
33
|
+
def install(target, options = {})
|
28
34
|
$stdout.puts " --> activate Vx::Instrumentation, log stored in #{target}"
|
35
|
+
|
36
|
+
log_level = options[:log_level] || 0
|
37
|
+
@@app_name = options[:app_name] || 'default'
|
38
|
+
|
29
39
|
Lib::Instrumentation::Logger.setup target
|
30
40
|
Lib::Instrumentation::Logger.logger.level = log_level
|
31
41
|
end
|
@@ -54,6 +64,7 @@ module Vx ; module Lib ; module Instrumentation
|
|
54
64
|
"@timestamp" => Time.now.strftime(DATE_FORMAT),
|
55
65
|
"@tags" => tags,
|
56
66
|
"@fields" => env,
|
67
|
+
app_name: app_name,
|
57
68
|
process_id: Process.pid,
|
58
69
|
thread_id: Thread.current.object_id,
|
59
70
|
exception: ex.class.to_s,
|
@@ -69,12 +80,13 @@ module Vx ; module Lib ; module Instrumentation
|
|
69
80
|
Lib::Instrumentation::Logger.logger.log(
|
70
81
|
::Logger::INFO,
|
71
82
|
"@event" => name,
|
72
|
-
process_id: Process.pid,
|
73
|
-
thread_id: Thread.current.object_id,
|
74
83
|
"@timestamp" => started.strftime(DATE_FORMAT),
|
75
84
|
"@duration" => (finished - started).to_f,
|
76
85
|
"@fields" => payload,
|
77
|
-
"@tags" => tags
|
86
|
+
"@tags" => tags,
|
87
|
+
process_id: Process.pid,
|
88
|
+
thread_id: Thread.current.object_id,
|
89
|
+
app_name: app_name
|
78
90
|
)
|
79
91
|
end
|
80
92
|
|