skylight 1.0.0.beta3 → 1.0.0.beta4

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
  SHA1:
3
- metadata.gz: 4624d9778ee894c7de5d5b892c1c691a90597ea9
4
- data.tar.gz: 041745f8d26066a7bfbe0e2db38f7ba84be1b1d1
3
+ metadata.gz: 17f5108640b6ddd60f1e126dda1e69005a2aa130
4
+ data.tar.gz: ee06fc206e7a6b570db1e23c89b83c53362f4b5d
5
5
  SHA512:
6
- metadata.gz: 728c0f355ba9b206376b78db6201da29d365c56d11e7dc8c5c4f32457ce52817440ff0c8cd2c22825fecb094b8aa915526ea80e3d1b3594a3cff65ed35fd077d
7
- data.tar.gz: 0f0d0eb10449986b40cb2feadd57fc9d947798e9920f2d6b893b987b0a6ce3a6480c3db170bc430ba8e18de59cdfad81ae250bf1dd4a07175c2c721818b94c45
6
+ metadata.gz: adde4cc18fa3673ce4dd410e1446f6dad659884f88ad7a6095f0f1444a2ae28148d24679eda2ee2dd86c17f264ba90eeba2d9d51526436846f1dcd5a7d584d52
7
+ data.tar.gz: 3548e5730c12bce02eee29f46a4a415b80ebe8f811c0fe83d584836d565d8bb435bc72488d730cd90b8b2bbc4e1fb09c8077beefca3bca91caf058d889cb3513
@@ -1,3 +1,8 @@
1
+ ## 1.0.0.beta4 (April 22, 2016)
2
+
3
+ * [FEATURE] Track formats separately in Rails endpoints. Turn on with `separate_formats: true`.
4
+ * [BUGFIX] Finish Rack::Responses in Middleware as some Rack apps don't do this
5
+
1
6
  ## 1.0.0.beta3 (February 23, 2016)
2
7
 
3
8
  * [BUGFIX] Update Rust Agent with SQL improvements, including handling for arrays and WITH
@@ -34,7 +39,7 @@
34
39
 
35
40
  ## 0.9.4 (November 23, 2015)
36
41
 
37
- * [FEATURE] Added instrumentation for official Mongo Ruby Driver (utilized by Mongoid 5+). Add 'mongo' to probes list to enable.
42
+ * [FEATURE] Added instrumentation for official Mongo Ruby Driver (utilized by Mongoid 5+). Add 'mongo' to probes list to enable.
38
43
  * [BUGFIX] SQL lexer now handles indentifiers beginning with underscores.
39
44
  * [BUGFIX] Excon instrumentation now works correctly.
40
45
  * [BUGFIX] Graceful handling of native agent failures on old OS X versions.
data/LICENSE.md CHANGED
@@ -1,5 +1,5 @@
1
1
  All other components of this product, except where otherwise noted, are
2
- Copyright (c) 2013-2014 Tilde, Inc.
2
+ Copyright (c) 2013-2016 Tilde, Inc.
3
3
  All rights reserved.
4
4
 
5
5
  Certain inventions disclosed in this file may be claimed within patents
@@ -39,14 +39,14 @@ for lost profits or data.
39
39
  Other Licenses
40
40
  ==============
41
41
 
42
- ActiveSupport
42
+ Ruby on Rails
43
43
  -------------
44
44
 
45
- Copyright (c) 2005-2014 David Heinemeier Hansson
45
+ Copyright (c) 2005-2016 David Heinemeier Hansson
46
46
 
47
47
  Released under the MIT License.
48
48
 
49
- Original source at https://github.com/rails/rails/tree/master/activesupport.
49
+ Original source at https://github.com/rails/rails.
50
50
 
51
51
 
52
52
  HighLine
@@ -42,6 +42,7 @@ module Skylight
42
42
  "IGNORED_ENDPOINT" => :'ignored_endpoint',
43
43
  "IGNORED_ENDPOINTS" => :'ignored_endpoints',
44
44
  "SQL_MODE" => :'sql_mode',
45
+ "SEPARATE_FORMATS" => :'separate_formats',
45
46
 
46
47
  # == Skylight Remote ==
47
48
  "AUTH_URL" => :'auth_url',
@@ -95,6 +96,7 @@ module Skylight
95
96
  :'log_level' => 'INFO'.freeze,
96
97
  :'alert_log_file' => '-'.freeze,
97
98
  :'log_sql_parse_errors' => false,
99
+ :'separate_formats' => false,
98
100
  :'hostname' => Util::Hostname.default_hostname,
99
101
  :'heroku.dyno_info_path' => '/etc/heroku/dyno'
100
102
  }
@@ -525,6 +527,10 @@ authentication: #{self[:authentication]}
525
527
  @deploy ||= Util::Deploy.build(self)
526
528
  end
527
529
 
530
+ def separate_formats?
531
+ !!get(:separate_formats)
532
+ end
533
+
528
534
  private
529
535
 
530
536
  def check_nfs(path)
@@ -59,6 +59,13 @@ module Skylight
59
59
  t { "middleware beginning trace" }
60
60
  trace = Skylight.trace "Rack", 'app.rack.request'
61
61
  resp = @app.call(env)
62
+
63
+ # Responses should be finished but in some situations they aren't
64
+ # e.g. https://github.com/ruby-grape/grape/issues/1041
65
+ if resp.respond_to?(:finish)
66
+ resp = resp.finish
67
+ end
68
+
62
69
  resp[2] = BodyProxy.new(resp[2]) { trace.submit } if trace
63
70
  resp
64
71
  rescue Exception
@@ -38,6 +38,13 @@ module Skylight
38
38
  @config = config
39
39
  setup if respond_to?(:setup)
40
40
  end
41
+
42
+ def normalize(trace, name, payload)
43
+ :skip
44
+ end
45
+
46
+ def normalize_after(trace, span, name, payload)
47
+ end
41
48
  end
42
49
 
43
50
  class RenderNormalizer < Normalizer
@@ -121,6 +128,10 @@ module Skylight
121
128
  normalizer_for(name).normalize(trace, name, payload)
122
129
  end
123
130
 
131
+ def normalize_after(trace, span, name, payload)
132
+ normalizer_for(name).normalize_after(trace, span, name, payload)
133
+ end
134
+
124
135
  def normalizer_for(name)
125
136
  @normalizers[name] || DEFAULT
126
137
  end
@@ -5,13 +5,25 @@ module Skylight
5
5
  register "process_action.action_controller"
6
6
 
7
7
  CAT = "app.controller.request".freeze
8
- PAYLOAD_KEYS = %w[ controller action params format method path ].map(&:to_sym).freeze
8
+
9
+ # Payload Keys: controller, action, params, format, method, path
10
+ # Additional keys available in `normalize_after`: status, view_runtime
11
+ # Along with ones added by probe: variant
9
12
 
10
13
  def normalize(trace, name, payload)
11
14
  trace.endpoint = controller_action(payload)
12
15
  [ CAT, trace.endpoint, nil ]
13
16
  end
14
17
 
18
+ def normalize_after(trace, span, name, payload)
19
+ return unless config.separate_formats?
20
+
21
+ format = [payload[:format], payload[:variant]].compact.flatten.join('+')
22
+ unless format.empty?
23
+ trace.endpoint += "<sk-format>#{format}</sk-format>"
24
+ end
25
+ end
26
+
15
27
  private
16
28
 
17
29
  def controller_action(payload)
@@ -12,7 +12,9 @@ module Skylight
12
12
  title = serializer_class.name.sub(/^ActiveModel::(Serializer::)?/, '')
13
13
 
14
14
  if adapter_instance = payload[:adapter]
15
- adapter_name = adapter_instance.class.name.sub(/^ActiveModel::Serializer::Adapter::/, '')
15
+ adapter_name = adapter_instance.class.name
16
+ .sub(/^ActiveModel::Serializer::Adapter::/, '')
17
+ .sub(/^ActiveModelSerializers::Adapter::/, '')
16
18
  desc = "Adapter: #{adapter_name}"
17
19
  end
18
20
 
@@ -0,0 +1,48 @@
1
+ module Skylight
2
+ module Probes
3
+ module ActionController
4
+ class Probe
5
+ def install
6
+ ::ActionController::Instrumentation.class_eval do
7
+ private
8
+ alias append_info_to_payload_without_sk append_info_to_payload
9
+ def append_info_to_payload(payload)
10
+ append_info_to_payload_without_sk(payload)
11
+ payload[:variant] = request.respond_to?(:variant) ? request.variant : nil
12
+ end
13
+ end
14
+
15
+ #if RAILS_VERSION < 4.2.1
16
+ # Backport https://github.com/rails/rails/pull/17978
17
+ ::ActionController::Instrumentation.class_eval do
18
+ def process_action(*args)
19
+ raw_payload = {
20
+ :controller => self.class.name,
21
+ :action => self.action_name,
22
+ :params => request.filtered_parameters,
23
+ :format => request.format.try(:ref),
24
+ :method => request.request_method,
25
+ :path => (request.fullpath rescue "unknown")
26
+ }
27
+
28
+ ActiveSupport::Notifications.instrument("start_processing.action_controller", raw_payload.dup)
29
+
30
+ ActiveSupport::Notifications.instrument("process_action.action_controller", raw_payload) do |payload|
31
+ begin
32
+ result = super
33
+ payload[:status] = response.status
34
+ result
35
+ ensure
36
+ append_info_to_payload(payload)
37
+ end
38
+ end
39
+ end
40
+ #end
41
+ end
42
+ end
43
+ end
44
+ end
45
+
46
+ register("ActionController::Instrumentation", "action_controller/metal/instrumentation", ActionController::Probe.new)
47
+ end
48
+ end
@@ -13,9 +13,9 @@ module Skylight
13
13
  config.skylight.config_path = "config/skylight.yml"
14
14
 
15
15
  # The probes to load
16
- # net_http, action_view, and grape are on by default
16
+ # net_http, action_controller, action_view, and grape are on by default
17
17
  # Also available: excon, redis, sinatra, tilt, sequel
18
- config.skylight.probes = ['net_http', 'action_view', 'grape']
18
+ config.skylight.probes = ['net_http', 'action_controller', 'action_view', 'grape']
19
19
 
20
20
  initializer 'skylight.configure' do |app|
21
21
  # Load probes even when agent is inactive to catch probe related bugs sooner
@@ -86,6 +86,7 @@ module Skylight
86
86
 
87
87
  while curr = trace.notifications.pop
88
88
  if curr.name == name
89
+ normalize_after(trace, curr.span, name, payload)
89
90
  trace.done(curr.span) if curr.span
90
91
  return
91
92
  end
@@ -110,5 +111,9 @@ module Skylight
110
111
  @normalizers.normalize(*args)
111
112
  end
112
113
 
114
+ def normalize_after(*args)
115
+ @normalizers.normalize_after(*args)
116
+ end
117
+
113
118
  end
114
119
  end
@@ -14,7 +14,7 @@ module Skylight
14
14
  end
15
15
 
16
16
  def file_path
17
- File.expand_path("~/.skylight")
17
+ File.expand_path(ENV["SKYLIGHT_USER_CONFIG_PATH"] || "~/.skylight")
18
18
  end
19
19
 
20
20
  def disable_dev_warning?
@@ -1,4 +1,4 @@
1
1
  module Skylight
2
- VERSION = '1.0.0-beta3'
2
+ VERSION = '1.0.0-beta4'
3
3
  end
4
4
 
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: 1.0.0.beta3
4
+ version: 1.0.0.beta4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tilde, Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-24 00:00:00.000000000 Z
11
+ date: 2016-04-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -83,6 +83,7 @@ files:
83
83
  - lib/skylight/normalizers/grape/endpoint_run_filters.rb
84
84
  - lib/skylight/normalizers/moped/query.rb
85
85
  - lib/skylight/probes.rb
86
+ - lib/skylight/probes/action_controller.rb
86
87
  - lib/skylight/probes/action_view.rb
87
88
  - lib/skylight/probes/active_model_serializers.rb
88
89
  - lib/skylight/probes/excon.rb