skylight 5.0.0 → 5.0.1
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/CHANGELOG.md +3 -0
- data/lib/skylight/helpers.rb +22 -4
- data/lib/skylight/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: 76c9ece1445d480897ecc306024fe939dacb94c14a02e68f7e33f5d722955284
|
4
|
+
data.tar.gz: 839b19ed8b3846003b3a54e5d0f3e327b0f969f2672b267dcaf4d1aa27df6254
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2cbbcfd4a159b6abfa976f9d8ad4a87317973955d058408b681b1564d6d54bacadcb0e60c4bbac9ea03383dfed6d9355ac953a0b636c50a60ff99e52bcb3c5a2
|
7
|
+
data.tar.gz: b338f0d0a22d0b904600d050f217758d3b07c28e66c88c6f5eb961cd8701750b58a7175e3e9e31dad604c6c58c2d1b22197517c239192f41b9579c5c08a9ca5b
|
data/CHANGELOG.md
CHANGED
data/lib/skylight/helpers.rb
CHANGED
@@ -130,7 +130,7 @@ module Skylight
|
|
130
130
|
|
131
131
|
private
|
132
132
|
|
133
|
-
|
133
|
+
HAS_ARGUMENT_FORWARDING = Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("2.7.0")
|
134
134
|
|
135
135
|
def __sk_instrument_method_on(klass, name, title, **opts)
|
136
136
|
category = (opts[:category] || "app.method").to_s
|
@@ -145,13 +145,31 @@ module Skylight
|
|
145
145
|
# source_file and source_line to be removed from the trace span before it is submitted.
|
146
146
|
source_file, source_line = klass.instance_method(name).source_location
|
147
147
|
|
148
|
+
# We should strongly prefer using the new argument-forwarding syntax (...) where available.
|
149
|
+
# In Ruby 2.7, the following are known to be syntax errors:
|
150
|
+
#
|
151
|
+
# - mixing positional arguments with argument forwarding (e.g., send(:method_name, ...))
|
152
|
+
# - calling a setter method with multiple arguments, unless dispatched via send or public_send.
|
153
|
+
#
|
154
|
+
# So it is possible, though not recommended, to define setter methods that take multiple arguments,
|
155
|
+
# keywords, and/or blocks. Unfortunately, this means that for setters, we still need to explicitly
|
156
|
+
# forward the different argument types.
|
157
|
+
is_setter_method = name.to_s.end_with?("=")
|
158
|
+
|
148
159
|
arg_string =
|
149
|
-
if
|
150
|
-
"*args, **kwargs, &blk"
|
160
|
+
if HAS_ARGUMENT_FORWARDING
|
161
|
+
is_setter_method ? "*args, **kwargs, &blk" : "..."
|
151
162
|
else
|
152
163
|
"*args, &blk"
|
153
164
|
end
|
154
165
|
|
166
|
+
original_method_dispatch =
|
167
|
+
if is_setter_method
|
168
|
+
"self.send(:before_instrument_#{name}, #{arg_string})"
|
169
|
+
else
|
170
|
+
"before_instrument_#{name}(#{arg_string})"
|
171
|
+
end
|
172
|
+
|
155
173
|
klass.class_eval <<-RUBY, __FILE__, __LINE__ + 1
|
156
174
|
alias_method :"before_instrument_#{name}", :"#{name}" # alias_method :"before_instrument_process", :"process"
|
157
175
|
def #{name}(#{arg_string}) # def process(*args, **kwargs, &blk)
|
@@ -165,7 +183,7 @@ module Skylight
|
|
165
183
|
meta = {} # meta = {}
|
166
184
|
#
|
167
185
|
begin # begin
|
168
|
-
|
186
|
+
#{original_method_dispatch} # self.before_instrument_process(...)
|
169
187
|
rescue Exception => e # rescue Exception => e
|
170
188
|
meta[:exception_object] = e # meta[:exception_object] = e
|
171
189
|
raise e # raise e
|
data/lib/skylight/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: skylight
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.0.
|
4
|
+
version: 5.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tilde, Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-03-
|
11
|
+
date: 2021-03-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|