builder_apm 0.5.10 → 0.5.12

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 76836856ebaf118f3b50eb04f1e03a9dcdcb1d3779a197c178bce179e895bbc4
4
- data.tar.gz: 1590eb4a9204c231cdeb32683745d97c84656ab655641eb84eea4ae30de8d96d
3
+ metadata.gz: 2f9d7c7af0913b72c61b524ecc012de2bf7184cbeb0feeb42dbf61e6b7fb71d6
4
+ data.tar.gz: c4337273e42bec6234f1cb8c2987ab82a5dddb28ee150e179b3162d5d53ebdf5
5
5
  SHA512:
6
- metadata.gz: 06fce8a116b3a6edee614ed982b5e83e648c6bfdf4a2166336a182898f3acb04e290639bc982702cea0a34cefa8aefe8bc86ca29156f9714d18bc7c814d88313
7
- data.tar.gz: 7d9e190154d9b178f3eb7ea921fe0918e047ea99cbb6a4bcd7a424b5e88a8db594afeab1f74377f1cd25fe116c91c5b8c3b62a98ba38f758a9488725d8f07c0b
6
+ metadata.gz: 70c6b5cbe90f474260100e7d7c563a555f73cfe2f1f8072462f6e6934be7990ebf6c486b02d2b820b879c4fb65828abe86b0cc66b9dcc95348417a84ea051dbe
7
+ data.tar.gz: 3b8b18b6c41bacc1b3cfd0a0a6ca2f691f097d2ce495bc99583b0582a61c28d654443235982360e3912cf256448de817c8de6a679f1009b1b13a91cddd19912b
@@ -5,6 +5,7 @@ module BuilderApm
5
5
  initializer 'builder_apm.start' do |app|
6
6
  BuilderApm::Controllers::Instrumenter.new.start
7
7
  BuilderApm::Models::Instrumenter.start if BuilderApm.configuration.enable_active_record_profiler
8
+ BuilderApm::Methods::Instrumenter.new.start if BuilderApm.configuration.enable_methods_profiler
8
9
  end
9
10
 
10
11
  config.after_initialize do
@@ -10,7 +10,7 @@ module BuilderApm
10
10
  def start
11
11
  @trace = setup_trace
12
12
  @trace.enable
13
- self
13
+ Thread.current[:trace_point] = @trace
14
14
  end
15
15
 
16
16
  def stop
@@ -21,7 +21,7 @@ module BuilderApm
21
21
  me = self
22
22
  TracePoint.new(:call, :return, :end, :raise) do |tp|
23
23
  starttime = Time.now.to_f * 1000
24
- me.process_trace_point(tp) if me.valid_trace_point?(tp)
24
+ me.process_trace_point(tp) if Thread.current[:request_id] && me.valid_trace_point?(tp)
25
25
  duration = (Time.now.to_f * 1000) - starttime
26
26
 
27
27
  Thread.current[:method_tracing] = (Thread.current[:method_tracing] ||= 0) + duration
@@ -30,7 +30,6 @@ module BuilderApm
30
30
 
31
31
  def valid_trace_point?(tp)
32
32
  return false unless tp.path.start_with?(@root_path)
33
- return false unless Thread.current[:request_id]
34
33
 
35
34
  start_controller = Thread.current[:stack]&.first
36
35
  start_controller && "#{tp.defined_class}##{tp.method_id}" != start_controller[:method]
@@ -40,7 +39,7 @@ module BuilderApm
40
39
  end
41
40
 
42
41
  def process_trace_point(tp)
43
- if tp.event == :call || tp.event == :b_call || tp.event == :c_call
42
+ if tp.event == :call
44
43
  method_id = "#{tp.defined_class}##{tp.method_id}"
45
44
  (@call_times[method_id]||= []) << Process.clock_gettime(Process::CLOCK_MONOTONIC)
46
45
  caller_info = caller_locations(4,1).first
@@ -15,12 +15,12 @@ module BuilderApm
15
15
  Thread.current[:db_runtime] = 0
16
16
  Thread.current[:method_tracing] = 0
17
17
  Thread.current[:db_tracing] = 0
18
- @trace = BuilderApm::Methods::Instrumenter.new.start if BuilderApm.configuration.enable_methods_profiler
18
+ Thread.current[:trace_point].disable if Thread.current[:trace_point]
19
+ Thread.current[:trace_point] = nil
19
20
 
20
21
  @status, @headers, @response = @app.call(env)
21
22
 
22
23
  ensure
23
- @trace.stop if BuilderApm.configuration.enable_methods_profiler
24
24
  end_time = Time.now.to_f * 1000
25
25
  handle_timing(start_time, end_time, request_id)
26
26
 
@@ -1,3 +1,3 @@
1
1
  module BuilderApm
2
- VERSION = "0.5.10"
2
+ VERSION = "0.5.12"
3
3
  end
@@ -2,8 +2,6 @@ BuilderApm.configure do |config|
2
2
  config.redis_url = 'redis://localhost:6379/0' # optional - defaults to 'redis://localhost:6379/0'
3
3
  config.api_key = ENV["OPENAI_API_KEY"] #required only if you want to use Ai Doctor
4
4
  config.api = "Bravo" # optional - default to 'Bravo' - "Bravo" - internal Ai / "OpenAi" - use openai ChatGPT
5
- config.gems_to_track = [] # optional - default to empty array []
6
- config.enable_controller_profiler = true # optional - defaults to true
7
5
  config.enable_active_record_profiler = true # optional - defaults to true
8
6
  config.enable_methods_profiler = true # optional - defaults to true
9
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: builder_apm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.10
4
+ version: 0.5.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paul Ketelle
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-09-26 00:00:00.000000000 Z
11
+ date: 2023-10-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -130,7 +130,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
130
130
  - !ruby/object:Gem::Version
131
131
  version: '0'
132
132
  requirements: []
133
- rubygems_version: 3.1.4
133
+ rubygems_version: 3.1.0
134
134
  signing_key:
135
135
  specification_version: 4
136
136
  summary: Write a short summary, because RubyGems requires one.