File tree 4 files changed +2
-40
lines changed
4 files changed +2
-40
lines changed Original file line number Diff line number Diff line change @@ -36,20 +36,6 @@ def self.pool
36
36
@pool
37
37
end
38
38
39
- # Returns a relative path and line number based on the last application call
40
- # frame.
41
- def self . last_relative_application_frame
42
- frame = caller_locations . find do |l |
43
- l . path . start_with? ( RAILS_ROOT ) && !l . path . start_with? ( METRICS_ROOT )
44
- end
45
-
46
- if frame
47
- return frame . path . sub ( PATH_REGEX , '' ) , frame . lineno
48
- else
49
- return nil , nil
50
- end
51
- end
52
-
53
39
def self . submit_metrics ( metrics )
54
40
prepared = prepare_metrics ( metrics )
55
41
Original file line number Diff line number Diff line change @@ -33,16 +33,8 @@ def values_for(event)
33
33
34
34
def tags_for ( event )
35
35
path = relative_path ( event . payload [ :identifier ] )
36
- tags = { view : path }
37
36
38
- file , line = Metrics . last_relative_application_frame
39
-
40
- if file and line
41
- tags [ :file ] = file
42
- tags [ :line ] = line
43
- end
44
-
45
- tags
37
+ { view : path }
46
38
end
47
39
48
40
def current_transaction
Original file line number Diff line number Diff line change 14
14
15
15
before do
16
16
allow ( subscriber ) . to receive ( :current_transaction ) . and_return ( transaction )
17
-
18
- allow ( Gitlab ::Metrics ) . to receive ( :last_relative_application_frame ) .
19
- and_return ( [ 'app/views/x.html.haml' , 4 ] )
20
17
end
21
18
22
19
describe '#render_template' do
23
20
it 'tracks rendering of a template' do
24
21
values = { duration : 2.1 }
25
- tags = {
26
- view : 'app/views/x.html.haml' ,
27
- file : 'app/views/x.html.haml' ,
28
- line : 4
29
- }
22
+ tags = { view : 'app/views/x.html.haml' }
30
23
31
24
expect ( transaction ) . to receive ( :increment ) .
32
25
with ( :view_duration , 2.1 )
Original file line number Diff line number Diff line change 13
13
end
14
14
end
15
15
16
- describe '.last_relative_application_frame' do
17
- it 'returns an Array containing a file path and line number' do
18
- file , line = described_class . last_relative_application_frame
19
-
20
- expect ( line ) . to eq ( __LINE__ - 2 )
21
- expect ( file ) . to eq ( 'spec/lib/gitlab/metrics_spec.rb' )
22
- end
23
- end
24
-
25
16
describe '#submit_metrics' do
26
17
it 'prepares and writes the metrics to InfluxDB' do
27
18
connection = double ( :connection )
You can’t perform that action at this time.
0 commit comments