scout_apm 2.1.28 → 2.1.29
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/config.rb +3 -0
- data/lib/scout_apm/environment.rb +8 -0
- data/lib/scout_apm/utils/backtrace_parser.rb +1 -1
- data/lib/scout_apm/utils/scm.rb +14 -0
- data/lib/scout_apm/version.rb +1 -1
- data/lib/scout_apm.rb +1 -0
- data/test/unit/utils/backtrace_parser_test.rb +5 -0
- data/test/unit/utils/scm.rb +17 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6a05b91b0cb840bd278bee2f470494b5e5a85a32
|
4
|
+
data.tar.gz: a6d75703bd477570ceb40c31dd230f0ca57657ba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7677505dc87d23ce4cbe362bcf6ceced27cd484af214e8563e7b37f215885c8fdb314e70c56252e4968cbf11892aec9e9003e04e37947ba9512d3a6ce8e2daa2
|
7
|
+
data.tar.gz: 0cb53c39bd75b62a931b8c55125554cd364982231b94c89657eb6d4f89baa8ff46fc8dbe91aa7c24aed6027128c68cd4568ac4b26eaf1c7b9c2f8c190d2f218f
|
data/CHANGELOG.markdown
CHANGED
data/lib/scout_apm/config.rb
CHANGED
@@ -25,6 +25,7 @@ require 'scout_apm/environment'
|
|
25
25
|
# profile - turn on/off scoutprof (only applicable in Gem versions including scoutprof)
|
26
26
|
# proxy - an http proxy
|
27
27
|
# report_format - 'json' or 'marshal'. Marshal is legacy and will be removed.
|
28
|
+
# scm_subdirectory - if the app root lives in source management in a subdirectory. E.g. #{SCM_ROOT}/src
|
28
29
|
# uri_reporting - 'path' or 'full_path' default is 'full_path', which reports URL params as well as the path.
|
29
30
|
#
|
30
31
|
# Any of these config settings can be set with an environment variable prefixed
|
@@ -53,6 +54,7 @@ module ScoutApm
|
|
53
54
|
'profile',
|
54
55
|
'proxy',
|
55
56
|
'report_format',
|
57
|
+
'scm_subdirectory',
|
56
58
|
'uri_reporting',
|
57
59
|
]
|
58
60
|
|
@@ -215,6 +217,7 @@ module ScoutApm
|
|
215
217
|
'log_level' => 'info',
|
216
218
|
'profile' => true, # for scoutprof
|
217
219
|
'report_format' => 'json',
|
220
|
+
'scm_subdirectory' => '',
|
218
221
|
'uri_reporting' => 'full_path',
|
219
222
|
}.freeze
|
220
223
|
|
@@ -84,6 +84,14 @@ module ScoutApm
|
|
84
84
|
end
|
85
85
|
end
|
86
86
|
|
87
|
+
def scm_subdirectory
|
88
|
+
@scm_subdirectory ||= if Agent.instance.config.value('scm_subdirectory').empty?
|
89
|
+
''
|
90
|
+
else
|
91
|
+
Agent.instance.config.value('scm_subdirectory').sub(/^\//, '') # Trim any leading slash
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
87
95
|
def root
|
88
96
|
@root ||= framework_root
|
89
97
|
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# Module for helping to deal with Source Code Management settings
|
2
|
+
module ScoutApm
|
3
|
+
module Utils
|
4
|
+
class Scm
|
5
|
+
# Takes an *already relative* path +path+
|
6
|
+
# Returns a relative path, prepending the configured +scm_subdirectory+ environment string
|
7
|
+
def self.relative_scm_path(path, scm_subdirectory = ScoutApm::Environment.instance.scm_subdirectory)
|
8
|
+
@@scm_subdirectory ||= scm_subdirectory.sub(/^\//, '')
|
9
|
+
@@scm_subdirectoy_blank ||= @@scm_subdirectory.empty?
|
10
|
+
@@scm_subdirectoy_blank ? path : File.join(@@scm_subdirectory, path)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
data/lib/scout_apm/version.rb
CHANGED
data/lib/scout_apm.rb
CHANGED
@@ -94,6 +94,7 @@ require 'scout_apm/utils/backtrace_parser'
|
|
94
94
|
require 'scout_apm/utils/installed_gems'
|
95
95
|
require 'scout_apm/utils/klass_helper'
|
96
96
|
require 'scout_apm/utils/null_logger'
|
97
|
+
require 'scout_apm/utils/scm'
|
97
98
|
require 'scout_apm/utils/sql_sanitizer'
|
98
99
|
require 'scout_apm/utils/time'
|
99
100
|
require 'scout_apm/utils/unique_id'
|
@@ -39,6 +39,11 @@ class BacktraceParserTest < Minitest::Test
|
|
39
39
|
end
|
40
40
|
end
|
41
41
|
|
42
|
+
def test_calls_scm_relative_path
|
43
|
+
ScoutApm::Utils::Scm.expects(:relative_scm_path).at_least_once
|
44
|
+
assert ScoutApm::Utils::BacktraceParser.new(raw_backtrace, root).call
|
45
|
+
end
|
46
|
+
|
42
47
|
def test_works_on_shorter_backtraces
|
43
48
|
result = ScoutApm::Utils::BacktraceParser.new(raw_backtrace(1), root).call
|
44
49
|
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require_relative '../../test_helper'
|
2
|
+
require 'scout_apm/utils/scm'
|
3
|
+
|
4
|
+
class ScmTest < Minitest::Test
|
5
|
+
|
6
|
+
def test_relative_scm_path_blank
|
7
|
+
assert_equal 'app/models/person.rb', ScoutApm::Utils::Scm.relative_scm_path('app/models/person.rb', '')
|
8
|
+
end
|
9
|
+
|
10
|
+
def test_relative_scm_path_not_blank
|
11
|
+
assert_equal 'src/app/models/person.rb', ScoutApm::Utils::Scm.relative_scm_path('app/models/person.rb', 'src')
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_relative_scm_path_not_blank_with_slashes
|
15
|
+
assert_equal 'src/app/models/person.rb', ScoutApm::Utils::Scm.relative_scm_path('app/models/person.rb', '/src/')
|
16
|
+
end
|
17
|
+
end
|
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.1.
|
4
|
+
version: 2.1.29
|
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: 2017-08-
|
12
|
+
date: 2017-08-03 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: minitest
|
@@ -234,6 +234,7 @@ files:
|
|
234
234
|
- lib/scout_apm/utils/klass_helper.rb
|
235
235
|
- lib/scout_apm/utils/null_logger.rb
|
236
236
|
- lib/scout_apm/utils/numbers.rb
|
237
|
+
- lib/scout_apm/utils/scm.rb
|
237
238
|
- lib/scout_apm/utils/sql_sanitizer.rb
|
238
239
|
- lib/scout_apm/utils/sql_sanitizer_regex.rb
|
239
240
|
- lib/scout_apm/utils/sql_sanitizer_regex_1_8_7.rb
|
@@ -267,6 +268,7 @@ files:
|
|
267
268
|
- test/unit/utils/active_record_metric_name_test.rb
|
268
269
|
- test/unit/utils/backtrace_parser_test.rb
|
269
270
|
- test/unit/utils/numbers_test.rb
|
271
|
+
- test/unit/utils/scm.rb
|
270
272
|
homepage: https://github.com/scoutapp/scout_apm_ruby
|
271
273
|
licenses:
|
272
274
|
- Proprietary (See LICENSE.md)
|