callstacking-rails 0.1.29 → 0.1.30
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 +4 -4
- data/README.md +21 -20
- data/lib/callstacking/rails/engine.rb +1 -0
- data/lib/callstacking/rails/instrument.rb +6 -1
- data/lib/callstacking/rails/loader.rb +2 -0
- data/lib/callstacking/rails/trace.rb +9 -6
- data/lib/callstacking/rails/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7423b24771b1ee8ad73efbd79f287546e2b92876743424250064541c0a91eb0e
|
4
|
+
data.tar.gz: 79ef13978d8252f26950486c3589b7d8ad2d5414a35683ba95ea0768b6187e52
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 52d1c88ad8385cf8f9f228672927fb8bcc3397fd4799e8dd3987885fe68982bbb6a45e32b7bad7ebae8aa02f9362e727636dc3c23f2b98a04427a1662023b8d5
|
7
|
+
data.tar.gz: 6f4ef1b35a429613b39fc898edb8e390711895134a0fddf295a988e9e738a182423fdfb923ae17008af36190086e7ef56189d597dae54def16ff913edcee7dd6
|
data/README.md
CHANGED
@@ -45,25 +45,18 @@ $ bundle
|
|
45
45
|
```
|
46
46
|
|
47
47
|
## CLI Setup
|
48
|
-
Register an account at callstacking.com:
|
49
48
|
|
50
|
-
|
49
|
+
*Step 1:*
|
50
|
+
> bundle exec callstacking-rails register
|
51
|
+
|
52
|
+
The above command will open a browser window and allow you to register an account at callstacking.com.
|
53
|
+
|
54
|
+
*Step 2:*
|
55
|
+
> bundle exec callstacking-rails setup
|
51
56
|
|
52
|
-
|
57
|
+
This interactively prompts you for your callstacking.com username/password.
|
53
58
|
|
54
|
-
|
55
|
-
|
56
|
-
Interactively prompts you for your callstacking.com username/password.
|
57
|
-
Stores auth details in `~/.callstacking`.
|
58
|
-
|
59
|
-
You can have multiple environments.
|
60
|
-
The default is `development`.
|
61
|
-
|
62
|
-
The `development:` section in the `~/.callstacking` config contains your credentials.
|
63
|
-
|
64
|
-
By setting the RAILS_ENV environment you can maintain multiple settings.
|
65
|
-
|
66
|
-
Questions? Create an issue: https://github.com/callstacking/callstacking-rails/issues
|
59
|
+
The auth details are stored in `~/.callstacking`.
|
67
60
|
|
68
61
|
## Enabling Tracing
|
69
62
|
|
@@ -78,7 +71,7 @@ and for a `debug` param to be set to `1`:
|
|
78
71
|
class ApplicationController < ActionController::Base
|
79
72
|
include Callstacking::Rails::Helpers::InstrumentHelper
|
80
73
|
|
81
|
-
|
74
|
+
prepend_around_action :callstacking_setup, if: -> { current_user&.admin? && params[:debug] == '1' }
|
82
75
|
```
|
83
76
|
|
84
77
|
For the above setup, you would you have to be authenticated as an admin and would append `?debug=1`
|
@@ -91,6 +84,8 @@ e.g.
|
|
91
84
|
|
92
85
|
The local Rails server log outputs the trace URL.
|
93
86
|
|
87
|
+
<img width="1141" alt="screenshot of trace url output in Rails logs" src="https://user-images.githubusercontent.com/4600/236599713-49a82a83-d8c0-4e51-9442-5da1fbca7f9c.png">
|
88
|
+
|
94
89
|
## Production Environment
|
95
90
|
|
96
91
|
For production, you can provide the auth token via the `CALLSTACKING_API_TOKEN` environment variable.
|
@@ -103,14 +98,20 @@ The traces are recorded at https://callstacking.com/traces
|
|
103
98
|
|
104
99
|
For local HTML requests, once your page has rendered, you will see a `💥` icon on the right hand side.
|
105
100
|
|
106
|
-
Click the icon and observe the
|
101
|
+
Click the icon and observe the trace.
|
102
|
+
|
103
|
+
### Headless API requests
|
107
104
|
|
108
|
-
|
105
|
+
The trace URL is output via the Rails logs. https://callstacking.com/traces will updated with your latest trace.
|
109
106
|
|
110
107
|
## Tests
|
111
108
|
``
|
112
109
|
rake app:test:all
|
113
110
|
``
|
114
111
|
|
112
|
+
## Questions/Bugs/Feature Requests
|
113
|
+
|
114
|
+
Create an issue: https://github.com/callstacking/callstacking-rails/issues
|
115
|
+
|
115
116
|
## License
|
116
|
-
The
|
117
|
+
The license can be viewed at https://github.com/callstacking/callstacking-rails/blob/main/LICENSE
|
@@ -80,6 +80,8 @@ module Callstacking
|
|
80
80
|
end
|
81
81
|
|
82
82
|
def enable!(klasses)
|
83
|
+
reset!
|
84
|
+
|
83
85
|
Array.wrap(klasses).each do |klass|
|
84
86
|
instrument_klass(klass, application_level: true)
|
85
87
|
end
|
@@ -127,7 +129,10 @@ module Callstacking
|
|
127
129
|
module_index = klass.ancestors.map(&:to_s).index(module_name)
|
128
130
|
|
129
131
|
unless module_index
|
130
|
-
|
132
|
+
# Development class reload -
|
133
|
+
# ancestors are reset but module definition remains
|
134
|
+
new_module = Object.const_get(module_name) rescue nil
|
135
|
+
new_module||=Object.const_set(module_name, Module.new)
|
131
136
|
span_modules << new_module
|
132
137
|
|
133
138
|
new_module.instance_variable_set("@klass", klass)
|
@@ -25,7 +25,9 @@ module Callstacking
|
|
25
25
|
end
|
26
26
|
|
27
27
|
trace.enable
|
28
|
+
end
|
28
29
|
|
30
|
+
def reset!
|
29
31
|
instrumenter.instrument_method(ActionView::PartialRenderer, :render, application_level: false)
|
30
32
|
instrumenter.instrument_method(ActionView::TemplateRenderer, :render, application_level: false)
|
31
33
|
end
|
@@ -35,10 +35,12 @@ module Callstacking
|
|
35
35
|
controller.action_name, controller.controller_name,
|
36
36
|
controller.action_name, controller.request.format, ::Rails.root.to_s,
|
37
37
|
controller.request&.original_url,
|
38
|
-
controller.request.headers, controller.request.params)
|
38
|
+
controller.request.headers, controller.request.params, @traces)
|
39
39
|
end
|
40
40
|
|
41
41
|
def end_trace(controller)
|
42
|
+
return if @trace_id.nil? || @tuid.nil?
|
43
|
+
|
42
44
|
complete_request(@trace_id, @tuid,
|
43
45
|
controller.action_name, controller.controller_name,
|
44
46
|
controller.action_name, controller.request.format,
|
@@ -141,7 +143,11 @@ module Callstacking
|
|
141
143
|
traces.clear
|
142
144
|
end
|
143
145
|
end
|
144
|
-
def start_request(trace_id, tuid, method, controller, action, format, path, original_url, headers, params)
|
146
|
+
def start_request(trace_id, tuid, method, controller, action, format, path, original_url, headers, params, traces)
|
147
|
+
lock.synchronize do
|
148
|
+
traces.clear
|
149
|
+
end
|
150
|
+
|
145
151
|
return if do_not_track_request?(original_url, format)
|
146
152
|
|
147
153
|
client.create(trace_id, tuid,
|
@@ -167,10 +173,7 @@ module Callstacking
|
|
167
173
|
end
|
168
174
|
|
169
175
|
def complete_request(trace_id, tuid, method, controller, action, format, original_url, traces, max_trace_entries)
|
170
|
-
if do_not_track_request?(original_url, format)
|
171
|
-
traces.clear
|
172
|
-
return
|
173
|
-
end
|
176
|
+
return if do_not_track_request?(original_url, format)
|
174
177
|
|
175
178
|
create_message(tuid, completed_request_message(method, controller, action, format),
|
176
179
|
spans.increment_order_num, traces)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: callstacking-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.30
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jim Jones
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-05-
|
11
|
+
date: 2023-05-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|