scout_apm 2.4.5 → 2.4.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.markdown +4 -0
- data/lib/scout_apm/agent_context.rb +1 -1
- data/lib/scout_apm/db_query_metric_set.rb +6 -1
- data/lib/scout_apm/logger.rb +8 -1
- data/lib/scout_apm/tracked_request.rb +5 -2
- data/lib/scout_apm/version.rb +1 -1
- data/test/unit/logger_test.rb +2 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 20990a5a7adefbcb87f28ddb286a4bf867de5351
|
4
|
+
data.tar.gz: b21b4bc5da902f58a3aaedee308dab194c282de3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c37715e2944f6ca6813b86f646c0c7e2760de0b620990577802c8de76a543a7bae3b4ea5ca95fe5d7c9b85928f7055ead625f0412de92a83e7b78ef3dec68d47
|
7
|
+
data.tar.gz: adcaa59ce8c6f536f83bb61987fc5755c29938c669f0a27796e2f442739f593e543cd84687283c2242e1cc2ff8f4bf744173c34b90b0fd2aedfab559326677fc
|
data/CHANGELOG.markdown
CHANGED
@@ -41,7 +41,7 @@ module ScoutApm
|
|
41
41
|
@remote_server = ScoutApm::Remote::Server.new(
|
42
42
|
bind,
|
43
43
|
port,
|
44
|
-
ScoutApm::Remote::Router.new(ScoutApm::SynchronousRecorder.new(
|
44
|
+
ScoutApm::Remote::Router.new(ScoutApm::SynchronousRecorder.new(self), logger),
|
45
45
|
logger
|
46
46
|
)
|
47
47
|
|
@@ -4,7 +4,6 @@ module ScoutApm
|
|
4
4
|
include Enumerable
|
5
5
|
|
6
6
|
attr_reader :metrics # the raw metrics. You probably want #metrics_to_report
|
7
|
-
attr_reader :context
|
8
7
|
|
9
8
|
def marshal_dump
|
10
9
|
[ @metrics ]
|
@@ -22,6 +21,12 @@ module ScoutApm
|
|
22
21
|
@metrics = Hash.new
|
23
22
|
end
|
24
23
|
|
24
|
+
# Need to look this up again if we end up as nil. Which I guess can happen
|
25
|
+
# after a Marshal load?
|
26
|
+
def context
|
27
|
+
@context ||= ScoutApm::Agent.instance.context
|
28
|
+
end
|
29
|
+
|
25
30
|
def each
|
26
31
|
metrics.each do |_key, db_query_metric_stat|
|
27
32
|
yield db_query_metric_stat
|
data/lib/scout_apm/logger.rb
CHANGED
@@ -8,11 +8,12 @@
|
|
8
8
|
# :stdout => true - explicitly force the log to write to stdout (if set, ignore log_file_path)
|
9
9
|
# :stderr => true - explicitly force the log to write to stderr (if set, ignore log_file_path)
|
10
10
|
# :logger_class => Class or String - a class to use as the underlying logger. Defaults to Ruby's Logger. See notes
|
11
|
-
# :log_level => symbol, string, or integer -
|
11
|
+
# :log_level => symbol, string, or integer - defaults to INFO level
|
12
12
|
#
|
13
13
|
# The :logger_class option
|
14
14
|
# - allows any class to be used as the underlying logger. Currently requires to respond to:
|
15
15
|
# - debug, info, warn, error, fatal in both string and block form.
|
16
|
+
# - debug?, info?, warn?, error?, fatal?
|
16
17
|
# - #level= with a number (0 = debug, 1 = info, 2= warn, 3=error, 4=fatal)
|
17
18
|
# - #formatter= that takes a Ruby Logger::Formatter class. This method must be here, but the value may be ignored
|
18
19
|
#
|
@@ -39,6 +40,12 @@ module ScoutApm
|
|
39
40
|
def error(*args, &block); @logger.error(*args, &block); end
|
40
41
|
def fatal(*args, &block); @logger.fatal(*args, &block); end
|
41
42
|
|
43
|
+
def debug?; @logger.debug?; end
|
44
|
+
def info?; @logger.info?; end
|
45
|
+
def warn?; @logger.warn?; end
|
46
|
+
def error?; @logger.error?; end
|
47
|
+
def fatal?; @logger.fatal?; end
|
48
|
+
|
42
49
|
def log_level=(level)
|
43
50
|
@logger.level = log_level_from_opts(level)
|
44
51
|
end
|
@@ -251,7 +251,7 @@ module ScoutApm
|
|
251
251
|
|
252
252
|
# If we didn't have store, but we're trying to record anyway, go
|
253
253
|
# figure that out. (this happens in Remote Agent scenarios)
|
254
|
-
|
254
|
+
restore_from_dump! if @agent_context.nil?
|
255
255
|
|
256
256
|
# Bail out early if the user asked us to ignore this uri
|
257
257
|
return if @agent_context.ignored_uris.ignore?(annotations[:uri])
|
@@ -430,11 +430,14 @@ module ScoutApm
|
|
430
430
|
@call_set = nil
|
431
431
|
@store = nil
|
432
432
|
@recorder = nil
|
433
|
+
@agent_context = nil
|
433
434
|
end
|
434
435
|
|
435
436
|
# Go re-fetch the store based on what the Agent's official one is. Used
|
436
437
|
# after hydrating a dumped TrackedRequest
|
437
|
-
def
|
438
|
+
def restore_from_dump!
|
439
|
+
@agent_context = ScoutApm::Agent.instance.context
|
440
|
+
@recorder = @agent_context.recorder
|
438
441
|
@store = @agent_context.store
|
439
442
|
end
|
440
443
|
end
|
data/lib/scout_apm/version.rb
CHANGED
data/test/unit/logger_test.rb
CHANGED
@@ -1,10 +1,12 @@
|
|
1
1
|
require 'test_helper'
|
2
|
+
require 'fileutils'
|
2
3
|
|
3
4
|
require 'scout_apm/logger'
|
4
5
|
|
5
6
|
class LoggerTest < Minitest::Test
|
6
7
|
def setup
|
7
8
|
@env_root = Pathname.new(File.dirname(__FILE__)) + "../../"
|
9
|
+
FileUtils.mkdir_p(@env_root + "log")
|
8
10
|
end
|
9
11
|
|
10
12
|
def test_detect_stdout
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: scout_apm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.4.
|
4
|
+
version: 2.4.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Derek Haynes
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2018-01-
|
12
|
+
date: 2018-01-29 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: minitest
|