builder_apm 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 31a9a4393e090f4980960c61d6f5cb2cf307a352534b9f8f264c2238dcd281f4
4
- data.tar.gz: a01935162ea2b1fa2701a080536aadc6259c3a9c102148ef1df4475ddd7a89de
3
+ metadata.gz: 3093b97251b903ff111919ffe0d9a70aaa0471aa0ad7bb300de2def9d538ac02
4
+ data.tar.gz: 89c83518fc32c6bc771de43d508989e95c8c7e0a390d6ae48fdb76325c1985bb
5
5
  SHA512:
6
- metadata.gz: 61269a7ae1127eebfbdec316e015e64e6e0a76b23d81433c1a2569f4ccfabbebccc289d4f5588dfa46ac100d33dd5269fdc6e37208167598cdee7e6066ec35d5
7
- data.tar.gz: 3736371f1c53590cf7e811c19fa7262e70470f50207d414087a08967bd3cdc7375f93a9256906df7ce44bb10aa14b887045da11144791169ca6a861cf19e02c3
6
+ metadata.gz: 6553a4566484b7598e24f193645c113221a55f1508e3a1c6446620110d7ce6c499326a331f7fa6a5ab543b45b350f46fed994483d6442644816a14c5ba9d71a6
7
+ data.tar.gz: 5bd0063576d12bb6b7e5e61f64e93f084776944bfb2fb9aadccee08a8a334f3f4cc0bd3411a79bba386bfb280c07ba6f6cedf0430c316a3e61a01dadaa54359b
@@ -15,10 +15,11 @@ module BuilderApm
15
15
  end
16
16
 
17
17
  def process_start(event)
18
- return if event.payload[:controller].nil? || event.payload[:controller].start_with?("BuilderApm::")
18
+ return if event.payload[:controller].nil? # || event.payload[:controller].start_with?("BuilderApm::")
19
19
 
20
20
  uuid = event.payload[:headers].env['action_dispatch.request_id']
21
21
  Thread.current[:request_id] = uuid
22
+ Thread.current[:stack] = [setup_controller_stack_data(event)]
22
23
  end
23
24
 
24
25
  def process_action(event)
@@ -32,6 +33,21 @@ module BuilderApm
32
33
 
33
34
  private
34
35
 
36
+ def setup_controller_stack_data(event)
37
+ controller = event.payload[:controller]
38
+ method_id = "#{controller.constantize}##{event.payload[:action]}"
39
+ method_line = file_and_line_number(event.payload[:controller], event.payload[:action])
40
+
41
+ {
42
+ method: method_id,
43
+ method_line: "#{method_line}",
44
+ triggering_line: "",
45
+ children: [],
46
+ start_time: Time.now.to_f * 1000,
47
+ sql_events: []
48
+ }
49
+ end
50
+
35
51
  def event_from_args(*args)
36
52
  data = args.extract_options!
37
53
  ActiveSupport::Notifications::Event.new(*args, data)
@@ -23,7 +23,7 @@ module BuilderApm
23
23
  end
24
24
 
25
25
  def valid_trace_point?(tp)
26
- !Thread.current[:request_id].nil? && tp.path.start_with?(@root_path)
26
+ !Thread.current[:request_id].nil? && tp.path.start_with?(@root_path) && !tp.path.include?('controller.rb')
27
27
  end
28
28
 
29
29
  def process_trace_point(tp)
@@ -39,7 +39,10 @@ module BuilderApm
39
39
  data[:real_start_time] = start_time
40
40
  data[:real_end_time] = end_time
41
41
  data[:real_duration_time] = end_time - start_time
42
-
42
+ data[:stack][0][:start_time] = start_time
43
+ data[:stack][0][:end_time] = end_time
44
+ data[:stack][0][:duration] = end_time - start_time
45
+
43
46
  begin
44
47
  @redis_client.pipelined do |pipeline|
45
48
  pipeline.rpush("builder_apm:Analysis:#{data[:controller]}##{data[:action]}:duration", data[:real_duration_time]||0)
@@ -1,3 +1,3 @@
1
1
  module BuilderApm
2
- VERSION = "0.3.0"
2
+ VERSION = "0.3.1"
3
3
  end
metadata CHANGED
@@ -1,11 +1,11 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: builder_apm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paul Ketelle
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
11
  date: 2023-07-25 00:00:00.000000000 Z
@@ -110,11 +110,11 @@ files:
110
110
  - lib/generators/builder_apm/templates/builder_apm_config.rb
111
111
  - lib/generators/builder_apm/templates/create_builder_apm_requests.rb
112
112
  - lib/generators/builder_apm/templates/create_builder_apm_sql_queries.rb
113
- homepage:
113
+ homepage:
114
114
  licenses:
115
115
  - MIT
116
116
  metadata: {}
117
- post_install_message:
117
+ post_install_message:
118
118
  rdoc_options: []
119
119
  require_paths:
120
120
  - lib
@@ -129,8 +129,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
129
129
  - !ruby/object:Gem::Version
130
130
  version: '0'
131
131
  requirements: []
132
- rubygems_version: 3.0.9
133
- signing_key:
132
+ rubygems_version: 3.1.4
133
+ signing_key:
134
134
  specification_version: 4
135
135
  summary: Write a short summary, because RubyGems requires one.
136
136
  test_files: []