scout_apm_logging 0.0.3 → 0.0.5
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/CHANGELOG.md +6 -0
- data/lib/scout_apm/logging/loggers/formatter.rb +8 -9
- data/lib/scout_apm/logging/monitor/collector/configuration.rb +2 -0
- data/lib/scout_apm/logging/version.rb +1 -1
- data/spec/integration/rails/lifecycle_spec.rb +5 -0
- data/spec/rails/app.rb +1 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a74ddd478e8429ef76315b9bdb23557583719b0ed241f0fecb1c0a6658b4efe7
|
4
|
+
data.tar.gz: 72bc063672bff254e893c196662c69cc06934297379e21ee3482e15974b4f465
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4f5ba120cff4d9087ce213736477eebb687159b126f415bf7e6ea2c3ddbf7b6058aa48b605f91031d4883af1b20019010a4f01ee6871b1fda79b5ff02cf29111
|
7
|
+
data.tar.gz: f029117cdc4d4b83d26dd5cbb67a9ac7f64fac72c67763d97bb6a712b3f566a0d9661a463c6f563b86aa18369e69188f6251e3c791035e6c737bc6155e5c2ae8
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
## 0.0.5
|
2
|
+
* Remove `msg` attribute after it has been moved to the log body to prevent duplication.
|
3
|
+
|
4
|
+
## 0.0.4
|
5
|
+
* Fix memoizing of log attributes, which could lead to persistent attributes.
|
6
|
+
|
1
7
|
## 0.0.3
|
2
8
|
* **Feature**: Add support for TaggedLogging.
|
3
9
|
* Add ability to customize file logger size. Increase default size to 10MiB.
|
@@ -12,12 +12,15 @@ module ScoutApm
|
|
12
12
|
class Formatter < ::Logger::Formatter
|
13
13
|
DATETIME_FORMAT = '%Y-%m-%dT%H:%M:%S.%LZ'
|
14
14
|
|
15
|
-
def call(severity, time, progname, msg)
|
16
|
-
attributes_to_log
|
17
|
-
|
15
|
+
def call(severity, time, progname, msg)
|
16
|
+
attributes_to_log = {
|
17
|
+
severity: severity,
|
18
|
+
time: format_datetime(time),
|
19
|
+
pid: Process.pid.to_s,
|
20
|
+
msg: msg2str(msg)
|
21
|
+
}
|
22
|
+
|
18
23
|
attributes_to_log[:progname] = progname if progname
|
19
|
-
attributes_to_log[:pid] = Process.pid.to_s
|
20
|
-
attributes_to_log[:msg] = msg2str(msg)
|
21
24
|
attributes_to_log['service.name'] = service_name
|
22
25
|
|
23
26
|
attributes_to_log.merge!(scout_layer)
|
@@ -30,10 +33,6 @@ module ScoutApm
|
|
30
33
|
|
31
34
|
private
|
32
35
|
|
33
|
-
def attributes_to_log
|
34
|
-
@attributes_to_log ||= {}
|
35
|
-
end
|
36
|
-
|
37
36
|
def format_datetime(time)
|
38
37
|
time.utc.strftime(DATETIME_FORMAT)
|
39
38
|
end
|
@@ -95,6 +95,8 @@ module ScoutApm
|
|
95
95
|
- 'set(attributes["raw_bytes"], body)'
|
96
96
|
# Replace the body with the log message.
|
97
97
|
- 'set(body, attributes["msg"])'
|
98
|
+
# Remove the msg attribute.
|
99
|
+
- 'delete_key(attributes, "msg")'
|
98
100
|
# Move service.name attribute to resource attribute.
|
99
101
|
- 'set(resource.attributes["service.name"], attributes["service.name"])'
|
100
102
|
batch:
|
@@ -48,6 +48,11 @@ describe ScoutApm::Logging do
|
|
48
48
|
expect(messages.count('[YIELD] Yield Test')).to eq(1)
|
49
49
|
expect(messages.count('Another Log')).to eq(1)
|
50
50
|
|
51
|
+
log_locations = lines.map { |item| item['log_location'] }.compact
|
52
|
+
|
53
|
+
# Verify that log attributes aren't persisted
|
54
|
+
expect(log_locations.size).to eq(1)
|
55
|
+
|
51
56
|
# Kill the rails process. We use kill as using any other signal throws a long log line.
|
52
57
|
Process.kill('KILL', rails_pid)
|
53
58
|
# Kill the process and ensure PID file clean up
|
data/spec/rails/app.rb
CHANGED
@@ -20,6 +20,7 @@ end
|
|
20
20
|
|
21
21
|
class RootController < ActionController::Base
|
22
22
|
def index
|
23
|
+
Rails.logger.warn('Add location log attributes')
|
23
24
|
Rails.logger.tagged('TEST').info('Some log')
|
24
25
|
Rails.logger.tagged('YIELD') { logger.info('Yield Test') }
|
25
26
|
Rails.logger.info('Another Log')
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: scout_apm_logging
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Scout APM
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-08-
|
11
|
+
date: 2024-08-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: scout_apm
|
@@ -146,7 +146,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
146
146
|
- !ruby/object:Gem::Version
|
147
147
|
version: '0'
|
148
148
|
requirements: []
|
149
|
-
rubygems_version: 3.
|
149
|
+
rubygems_version: 3.1.6
|
150
150
|
signing_key:
|
151
151
|
specification_version: 4
|
152
152
|
summary: Ruby Logging Support
|