skylight 5.0.0.beta4 → 5.0.0.beta5

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: e48a2154fa5a468b0dcf798747f66fe567fbf6cb0175a0f53535a1f940723457
4
- data.tar.gz: 63c73ac7bc2c41a403fd0e02b24ccc8b84ed0dba6631e350e246f513c903a74e
3
+ metadata.gz: b88023f7d8db82c17a9cb5d0fae14702a3b39fb92023d5f0ecbe5196cd51046d
4
+ data.tar.gz: 9aa57b65b50757df3c653e51de4d0f237ed56b9ef393c13189f4ba52aa074a9d
5
5
  SHA512:
6
- metadata.gz: 5c259f829aa6ae38dfa2a33aed39b3591513b0773f7f9cf37bd583d879754aa7139cd57850ce7f3d4c4687ddb09a7764a09903699d179b20569c69fc84050984
7
- data.tar.gz: 583ac1d6465ddd0c105eb5f5ee090392ec4eedfa73e2fbff83a13bb4f265808e6097c789bb079cea99ec990108187e36fb34418dbe020dae21b059a7deba3153
6
+ metadata.gz: ca4332a8adfc401efe9b58825049cd9a62e721bbd292bc5092aac7c37fcfd7e8f1b884aa75bf018b3fd3a264637f767cf092ac819ad0bc5d88e304111cce1839
7
+ data.tar.gz: 37242a88201778290030c3cb76a14608a261330c5e7137b97877b36020b4aa6d4cee151960fbd7801eb02c885cc4dab90310a9d9797ef3984df8c987bfa77823
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## 5.0.0.beta5
2
+ * [IMPROVEMENT] Improve keyword argument handling in Skylight::Helpers (thanks @lukebooth!)
3
+ * [IMPROVEMENT] Replace a Kernel.puts with Skylight.log (thanks @johnnyshields!)
4
+ * [IMPROVEMENT] Various updates to the SQL lexer
5
+ * [FEATURE] Add normalizer for Shrine events (thanks @janko!)
6
+
1
7
  ## 5.0.0.beta4
2
8
  * [IMPROVEMENT] Reduce volume of log messages sent to the native logger in debug level
3
9
 
@@ -28,6 +34,9 @@
28
34
  * [BUGFIX] Do not refer to Redis constant until the probe is installed
29
35
  * [BUGFIX] Fix nested calls to `Normalizers::Faraday::Request.disable`
30
36
 
37
+ ## 4.3.2 (December 14, 2020)
38
+ * [BUGFIX] Backport an ActionView fix from Skylight 5 (makes Skylight 4 compatible with Rails 6.1)
39
+
31
40
  ## 4.3.1 (June 24, 2020)
32
41
  * [BUGFIX] Fix an issue in which `Mime::NullType` would result in an exception
33
42
 
data/ext/libskylight.yml CHANGED
@@ -1,6 +1,8 @@
1
- version: "5.0.0-8db9566"
1
+ # commit: ea59cc7bdbbee0f69d1cf7e69827974a9ea67645
2
+ ---
3
+ version: "5.0.0-488d432"
2
4
  checksums:
3
- x86-linux: "15321a6defe4a376cdae77c2e2c41cf9d048dd0a0ee0aa5acd62a6c0047d731e"
4
- x86_64-linux: "ebc784098e5c12b6f86c7daa6c8d162dd7d1e14e2aab2cbdf2bdd2d57b511f8e"
5
- x86_64-linux-musl: "dd5a2cf8248e0af9b59d3a4bcb75b0af5757afd24546b9aa670cb19ea66bda16"
6
- x86_64-darwin: "591d56927e82f720aed39d5782756e676c4bca652e71ef2b0c4041ad3c6343d0"
5
+ x86-linux: "3c16b6db1508f35720258551783fbcd30fd231638bad316ea76748d659838399"
6
+ x86_64-linux: "94383aa3359c3f2e9c0e3c16ee263d46c5673dd255f8842e6acadf5ec3131c06"
7
+ x86_64-linux-musl: "d2e2e2e61c321315f9bcaa157426f33aef8ffc2330ba46b2cdcbd9442e65f728"
8
+ x86_64-darwin: "bcc925d0bcbae83a484f35dbc9729dcf262e1f3a8c29b8d387d0f58ad8f3afa3"
@@ -14,7 +14,7 @@ module Skylight
14
14
 
15
15
  if (opts = @__sk_instrument_next_method)
16
16
  @__sk_instrument_next_method = nil
17
- instrument_method(name, opts)
17
+ instrument_method(name, **opts)
18
18
  end
19
19
  end
20
20
 
@@ -24,7 +24,7 @@ module Skylight
24
24
 
25
25
  if (opts = @__sk_instrument_next_method)
26
26
  @__sk_instrument_next_method = nil
27
- instrument_class_method(name, opts)
27
+ instrument_class_method(name, **opts)
28
28
  end
29
29
  end
30
30
 
@@ -77,14 +77,12 @@ module Skylight
77
77
  # do_expensive_stuff
78
78
  # end
79
79
  # end
80
- def instrument_method(*args)
81
- opts = args.pop if args.last.is_a?(Hash)
82
-
80
+ def instrument_method(*args, **opts)
83
81
  if (name = args.pop)
84
82
  title = "#{self}##{name}"
85
- __sk_instrument_method_on(self, name, title, opts || {})
83
+ __sk_instrument_method_on(self, name, title, **opts)
86
84
  else
87
- @__sk_instrument_next_method = opts || {}
85
+ @__sk_instrument_next_method = opts
88
86
  end
89
87
  end
90
88
 
@@ -123,16 +121,18 @@ module Skylight
123
121
  #
124
122
  # instrument_class_method :my_method, title: 'Expensive work'
125
123
  # end
126
- def instrument_class_method(name, opts = {})
124
+ def instrument_class_method(name, **opts)
127
125
  # NOTE: If the class is defined anonymously and then assigned to a variable this code
128
126
  # will not be aware of the updated name.
129
127
  title = "#{self}.#{name}"
130
- __sk_instrument_method_on(__sk_singleton_class, name, title, opts || {})
128
+ __sk_instrument_method_on(__sk_singleton_class, name, title, **opts)
131
129
  end
132
130
 
133
131
  private
134
132
 
135
- def __sk_instrument_method_on(klass, name, title, opts)
133
+ HAS_KW_ARGUMENT_FORWARDING = Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("2.7.0")
134
+
135
+ def __sk_instrument_method_on(klass, name, title, **opts)
136
136
  category = (opts[:category] || "app.method").to_s
137
137
  title = (opts[:title] || title).to_s
138
138
  desc = opts[:description].to_s if opts[:description]
@@ -145,10 +145,16 @@ 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
+ arg_string =
149
+ if HAS_KW_ARGUMENT_FORWARDING
150
+ "*args, **kwargs, &blk"
151
+ else
152
+ "*args, &blk"
153
+ end
154
+
148
155
  klass.class_eval <<-RUBY, __FILE__, __LINE__ + 1
149
156
  alias_method :"before_instrument_#{name}", :"#{name}" # alias_method :"before_instrument_process", :"process"
150
- #
151
- def #{name}(*args, &blk) # def process(*args, &blk)
157
+ def #{name}(#{arg_string}) # def process(*args, **kwargs, &blk)
152
158
  span = Skylight.instrument( # span = Skylight.instrument(
153
159
  category: :"#{category}", # category: :"app.method",
154
160
  title: #{title.inspect}, # title: "process",
@@ -157,8 +163,9 @@ module Skylight
157
163
  source_line: #{source_line.inspect}) # source_line: 123)
158
164
  #
159
165
  meta = {} # meta = {}
166
+ #
160
167
  begin # begin
161
- send(:before_instrument_#{name}, *args, &blk) # send(:before_instrument_process)
168
+ send(:before_instrument_#{name}, #{arg_string}) # send(:before_instrument_process, *args, **kwargs, &blk)
162
169
  rescue Exception => e # rescue Exception => e
163
170
  meta[:exception_object] = e # meta[:exception_object] = e
164
171
  raise e # raise e
@@ -145,7 +145,8 @@ module Skylight
145
145
  graphiti/resolve
146
146
  graphiti/render
147
147
  graphql/base
148
- sequel/sql].each do |file|
148
+ sequel/sql
149
+ shrine].each do |file|
149
150
  require "skylight/normalizers/#{file}"
150
151
  end
151
152
  end
@@ -0,0 +1,34 @@
1
+ module Skylight
2
+ module Normalizers
3
+ class Shrine < Normalizer
4
+ TITLES = {
5
+ "upload.shrine" => "Upload",
6
+ "download.shrine" => "Download",
7
+ "open.shrine" => "Open",
8
+ "exists.shrine" => "Exists",
9
+ "delete.shrine" => "Delete",
10
+ "metadata.shrine" => "Metadata",
11
+ "mime_type.shrine" => "MIME Type",
12
+ "image_dimensions.shrine" => "Image Dimensions",
13
+ "signature.shrine" => "Signature",
14
+ "extension.shrine" => "Extension",
15
+ "derivation.shrine" => "Derivation",
16
+ "derivatives.shrine" => "Derivatives",
17
+ "data_uri.shrine" => "Data URI",
18
+ "remote_url.shrine" => "Remote URL"
19
+ }.freeze
20
+
21
+ TITLES.each_key do |key|
22
+ register key
23
+ end
24
+
25
+ def normalize(_trace, name, _payload)
26
+ title = ["Shrine", TITLES[name]].join(" ")
27
+
28
+ cat = "app.#{name.split('.').reverse.join('.')}"
29
+
30
+ [cat, title, nil]
31
+ end
32
+ end
33
+ end
34
+ end
@@ -26,7 +26,7 @@ module Skylight
26
26
 
27
27
  def disable_skylight_probe(class_name)
28
28
  klass = ::ActiveSupport::Inflector.safe_constantize("Skylight::Probes::#{class_name}::Probe")
29
- (klass ? klass.disable { yield } : yield).tap { puts "re-enabling: #{klass}" }
29
+ (klass ? klass.disable { yield } : yield).tap { Skylight.log(:debug, "re-enabling: #{klass}") }
30
30
  end
31
31
  end
32
32
  end
@@ -3,5 +3,5 @@ module Skylight
3
3
  # for compatibility with semver when it is parsed by the rust agent.
4
4
  # This string will be transformed in the gemspec to "5.0.0.alpha"
5
5
  # to conform with rubygems.
6
- VERSION = "5.0.0-beta4".freeze
6
+ VERSION = "5.0.0-beta5".freeze
7
7
  end
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.0.beta4
4
+ version: 5.0.0.beta5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tilde, Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-12-03 00:00:00.000000000 Z
11
+ date: 2021-02-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -142,14 +142,14 @@ dependencies:
142
142
  requirements:
143
143
  - - "~>"
144
144
  - !ruby/object:Gem::Version
145
- version: 1.4.0
145
+ version: 1.8.1
146
146
  type: :development
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
150
  - - "~>"
151
151
  - !ruby/object:Gem::Version
152
- version: 1.4.0
152
+ version: 1.8.1
153
153
  - !ruby/object:Gem::Dependency
154
154
  name: timecop
155
155
  requirement: !ruby/object:Gem::Requirement
@@ -260,6 +260,7 @@ files:
260
260
  - lib/skylight/normalizers/graphql/base.rb
261
261
  - lib/skylight/normalizers/render.rb
262
262
  - lib/skylight/normalizers/sequel/sql.rb
263
+ - lib/skylight/normalizers/shrine.rb
263
264
  - lib/skylight/normalizers/sql.rb
264
265
  - lib/skylight/probes.rb
265
266
  - lib/skylight/probes/action_controller.rb
@@ -367,7 +368,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
367
368
  - !ruby/object:Gem::Version
368
369
  version: 1.3.1
369
370
  requirements: []
370
- rubygems_version: 3.1.4
371
+ rubygems_version: 3.2.3
371
372
  signing_key:
372
373
  specification_version: 4
373
374
  summary: Skylight is a smart profiler for Rails, Sinatra, and other Ruby apps.