skylight-core 2.0.0.beta1

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.
Files changed (86) hide show
  1. checksums.yaml +7 -0
  2. data/lib/skylight/core/config.rb +454 -0
  3. data/lib/skylight/core/errors.rb +6 -0
  4. data/lib/skylight/core/fanout.rb +44 -0
  5. data/lib/skylight/core/formatters/http.rb +23 -0
  6. data/lib/skylight/core/gc.rb +107 -0
  7. data/lib/skylight/core/instrumentable.rb +144 -0
  8. data/lib/skylight/core/instrumenter.rb +249 -0
  9. data/lib/skylight/core/middleware.rb +101 -0
  10. data/lib/skylight/core/normalizers/action_controller/process_action.rb +50 -0
  11. data/lib/skylight/core/normalizers/action_controller/send_file.rb +50 -0
  12. data/lib/skylight/core/normalizers/action_view/render_collection.rb +22 -0
  13. data/lib/skylight/core/normalizers/action_view/render_partial.rb +21 -0
  14. data/lib/skylight/core/normalizers/action_view/render_template.rb +21 -0
  15. data/lib/skylight/core/normalizers/active_job/enqueue_at.rb +21 -0
  16. data/lib/skylight/core/normalizers/active_model_serializers/render.rb +26 -0
  17. data/lib/skylight/core/normalizers/active_record/instantiation.rb +17 -0
  18. data/lib/skylight/core/normalizers/active_record/sql.rb +33 -0
  19. data/lib/skylight/core/normalizers/active_support/cache.rb +20 -0
  20. data/lib/skylight/core/normalizers/active_support/cache_clear.rb +16 -0
  21. data/lib/skylight/core/normalizers/active_support/cache_decrement.rb +16 -0
  22. data/lib/skylight/core/normalizers/active_support/cache_delete.rb +16 -0
  23. data/lib/skylight/core/normalizers/active_support/cache_exist.rb +16 -0
  24. data/lib/skylight/core/normalizers/active_support/cache_fetch_hit.rb +16 -0
  25. data/lib/skylight/core/normalizers/active_support/cache_generate.rb +16 -0
  26. data/lib/skylight/core/normalizers/active_support/cache_increment.rb +16 -0
  27. data/lib/skylight/core/normalizers/active_support/cache_read.rb +16 -0
  28. data/lib/skylight/core/normalizers/active_support/cache_read_multi.rb +16 -0
  29. data/lib/skylight/core/normalizers/active_support/cache_write.rb +16 -0
  30. data/lib/skylight/core/normalizers/coach/handler_finish.rb +36 -0
  31. data/lib/skylight/core/normalizers/coach/middleware_finish.rb +23 -0
  32. data/lib/skylight/core/normalizers/couch_potato/query.rb +20 -0
  33. data/lib/skylight/core/normalizers/data_mapper/sql.rb +12 -0
  34. data/lib/skylight/core/normalizers/default.rb +27 -0
  35. data/lib/skylight/core/normalizers/elasticsearch/request.rb +20 -0
  36. data/lib/skylight/core/normalizers/faraday/request.rb +37 -0
  37. data/lib/skylight/core/normalizers/grape/endpoint.rb +30 -0
  38. data/lib/skylight/core/normalizers/grape/endpoint_render.rb +26 -0
  39. data/lib/skylight/core/normalizers/grape/endpoint_run.rb +33 -0
  40. data/lib/skylight/core/normalizers/grape/endpoint_run_filters.rb +23 -0
  41. data/lib/skylight/core/normalizers/moped/query.rb +100 -0
  42. data/lib/skylight/core/normalizers/sequel/sql.rb +12 -0
  43. data/lib/skylight/core/normalizers/sql.rb +49 -0
  44. data/lib/skylight/core/normalizers.rb +170 -0
  45. data/lib/skylight/core/probes/action_controller.rb +31 -0
  46. data/lib/skylight/core/probes/action_view.rb +37 -0
  47. data/lib/skylight/core/probes/active_model_serializers.rb +55 -0
  48. data/lib/skylight/core/probes/elasticsearch.rb +37 -0
  49. data/lib/skylight/core/probes/excon/middleware.rb +72 -0
  50. data/lib/skylight/core/probes/excon.rb +26 -0
  51. data/lib/skylight/core/probes/faraday.rb +22 -0
  52. data/lib/skylight/core/probes/grape.rb +80 -0
  53. data/lib/skylight/core/probes/httpclient.rb +46 -0
  54. data/lib/skylight/core/probes/middleware.rb +58 -0
  55. data/lib/skylight/core/probes/mongo.rb +171 -0
  56. data/lib/skylight/core/probes/mongoid.rb +21 -0
  57. data/lib/skylight/core/probes/moped.rb +39 -0
  58. data/lib/skylight/core/probes/net_http.rb +64 -0
  59. data/lib/skylight/core/probes/redis.rb +71 -0
  60. data/lib/skylight/core/probes/sequel.rb +33 -0
  61. data/lib/skylight/core/probes/sinatra.rb +69 -0
  62. data/lib/skylight/core/probes/tilt.rb +27 -0
  63. data/lib/skylight/core/probes.rb +129 -0
  64. data/lib/skylight/core/railtie.rb +166 -0
  65. data/lib/skylight/core/subscriber.rb +124 -0
  66. data/lib/skylight/core/test.rb +98 -0
  67. data/lib/skylight/core/trace.rb +190 -0
  68. data/lib/skylight/core/user_config.rb +61 -0
  69. data/lib/skylight/core/util/allocation_free.rb +26 -0
  70. data/lib/skylight/core/util/clock.rb +56 -0
  71. data/lib/skylight/core/util/deploy.rb +132 -0
  72. data/lib/skylight/core/util/gzip.rb +21 -0
  73. data/lib/skylight/core/util/inflector.rb +112 -0
  74. data/lib/skylight/core/util/logging.rb +127 -0
  75. data/lib/skylight/core/util/platform.rb +77 -0
  76. data/lib/skylight/core/util/proxy.rb +13 -0
  77. data/lib/skylight/core/util.rb +14 -0
  78. data/lib/skylight/core/vendor/active_support/notifications.rb +207 -0
  79. data/lib/skylight/core/vendor/active_support/per_thread_registry.rb +52 -0
  80. data/lib/skylight/core/vendor/thread_safe/non_concurrent_cache_backend.rb +133 -0
  81. data/lib/skylight/core/vendor/thread_safe/synchronized_cache_backend.rb +76 -0
  82. data/lib/skylight/core/vendor/thread_safe.rb +126 -0
  83. data/lib/skylight/core/version.rb +6 -0
  84. data/lib/skylight/core/vm/gc.rb +70 -0
  85. data/lib/skylight/core.rb +99 -0
  86. metadata +254 -0
@@ -0,0 +1,99 @@
1
+ require 'skylight/core/version'
2
+
3
+ module Skylight
4
+ module Core
5
+ # Is this autoload even useful?
6
+ autoload :Normalizers, 'skylight/core/normalizers'
7
+ end
8
+
9
+ # @api private
10
+ TRACE_ENV_KEY = 'SKYLIGHT_ENABLE_TRACE_LOGS'.freeze
11
+
12
+ # Some methods exepected to be defined by the native code (OUTDATED)
13
+ #
14
+ # * Skylight::Core::Util::Clock#native_hrtime
15
+ # - returns current time in nanoseconds
16
+ # * Skylight::Core::Trace#native_new(start, uuid, endpoint)
17
+ # - start is milliseconds
18
+ # - uuid is currently unused
19
+ # - endpoint is the endpoint name
20
+ # - returns an instance of Trace
21
+ # * Skylight::Core::Trace#native_get_started_at
22
+ # - returns the start time
23
+ # * Skylight::Core::Trace#native_get_endpoint
24
+ # - returns the endpoint name
25
+ # * Skylight::Core::Trace#native_set_endpoint(endpoint)
26
+ # - returns nil
27
+ # * Skylight::Core::Trace#native_get_uuid
28
+ # - returns the uuid
29
+ # * Skylight::Core::Trace#native_start_span(time, category)
30
+ # - time is milliseconds
31
+ # - category is a string
32
+ # - returns a numeric span id
33
+ # * Skylight::Core::Trace#native_stop_span(span, time)
34
+ # - span is the span id
35
+ # - time is milliseconds
36
+ # - returns nil
37
+ # * Skylight::Core::Trace#native_span_set_title(span, title)
38
+ # - span is the span id
39
+ # - title is a string
40
+ # - returns nil
41
+ # * Skylight::Core::Trace#native_span_set_description(span, desc)
42
+ # - span is the span id
43
+ # - desc is a string
44
+ # - returns nil
45
+ # * Skylight::Core::Instrumenter#native_new(env)
46
+ # - env is the config converted to a flattened array of ENV style values
47
+ # e.g. `["SKYLIGHT_AUTHENTICATION", "abc123", ...]
48
+ # - returns a new Instrumenter instance
49
+ # * Skylight::Core::Instrumenter#native_start()
50
+ # - returns a truthy value if successful
51
+ # * Skylight::Core::Instrumenter#native_stop()
52
+ # - returns nil
53
+ # * Skylight::Core::Instrumenter#native_submit_trace(trace)
54
+ # - trace is a Trace instance
55
+ # - returns nil
56
+ # * Skylight::Core::Instrumenter#native_track_desc(endpoint, description)
57
+ # - endpoint is a string
58
+ # - description is a string
59
+ # - returns truthy unless uniqueness cap exceeded
60
+
61
+ require 'active_support/notifications'
62
+
63
+ require 'skylight/core/config'
64
+ require 'skylight/core/user_config'
65
+ require 'skylight/core/gc'
66
+ require 'skylight/core/instrumenter'
67
+ require 'skylight/core/fanout'
68
+ require 'skylight/core/trace'
69
+ require 'skylight/core/vm/gc'
70
+ require 'skylight/core/util'
71
+ require 'skylight/core/middleware'
72
+ require 'skylight/core/subscriber'
73
+ require 'skylight/core/instrumentable'
74
+
75
+ require 'skylight/core/probes'
76
+
77
+ # @api private
78
+ TIERS = %w(
79
+ rack
80
+ api
81
+ app
82
+ view
83
+ db
84
+ noise
85
+ other)
86
+
87
+ # @api private
88
+ TIER_REGEX = /^(?:#{TIERS.join('|')})(?:\.|$)/u
89
+
90
+ # @api private
91
+ CATEGORY_REGEX = /^[a-z0-9_-]+(?:\.[a-z0-9_-]+)*$/iu
92
+
93
+ # @api private
94
+ DEFAULT_CATEGORY = "app.block".freeze
95
+
96
+ # @api private
97
+ DEFAULT_OPTIONS = { category: DEFAULT_CATEGORY }
98
+
99
+ end
metadata ADDED
@@ -0,0 +1,254 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: skylight-core
3
+ version: !ruby/object:Gem::Version
4
+ version: 2.0.0.beta1
5
+ platform: ruby
6
+ authors:
7
+ - Tilde, Inc.
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2018-02-05 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: activesupport
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 4.2.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: 4.2.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.15'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.15'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '10.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '10.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '3.7'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '3.7'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec-collection_matchers
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '1.1'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '1.1'
83
+ - !ruby/object:Gem::Dependency
84
+ name: beefcake
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "<"
88
+ - !ruby/object:Gem::Version
89
+ version: '1.0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "<"
95
+ - !ruby/object:Gem::Version
96
+ version: '1.0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: webmock
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: rack
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: rack-test
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ description:
140
+ email:
141
+ - engineering@tilde.io
142
+ executables: []
143
+ extensions: []
144
+ extra_rdoc_files: []
145
+ files:
146
+ - lib/skylight/core.rb
147
+ - lib/skylight/core/config.rb
148
+ - lib/skylight/core/errors.rb
149
+ - lib/skylight/core/fanout.rb
150
+ - lib/skylight/core/formatters/http.rb
151
+ - lib/skylight/core/gc.rb
152
+ - lib/skylight/core/instrumentable.rb
153
+ - lib/skylight/core/instrumenter.rb
154
+ - lib/skylight/core/middleware.rb
155
+ - lib/skylight/core/normalizers.rb
156
+ - lib/skylight/core/normalizers/action_controller/process_action.rb
157
+ - lib/skylight/core/normalizers/action_controller/send_file.rb
158
+ - lib/skylight/core/normalizers/action_view/render_collection.rb
159
+ - lib/skylight/core/normalizers/action_view/render_partial.rb
160
+ - lib/skylight/core/normalizers/action_view/render_template.rb
161
+ - lib/skylight/core/normalizers/active_job/enqueue_at.rb
162
+ - lib/skylight/core/normalizers/active_model_serializers/render.rb
163
+ - lib/skylight/core/normalizers/active_record/instantiation.rb
164
+ - lib/skylight/core/normalizers/active_record/sql.rb
165
+ - lib/skylight/core/normalizers/active_support/cache.rb
166
+ - lib/skylight/core/normalizers/active_support/cache_clear.rb
167
+ - lib/skylight/core/normalizers/active_support/cache_decrement.rb
168
+ - lib/skylight/core/normalizers/active_support/cache_delete.rb
169
+ - lib/skylight/core/normalizers/active_support/cache_exist.rb
170
+ - lib/skylight/core/normalizers/active_support/cache_fetch_hit.rb
171
+ - lib/skylight/core/normalizers/active_support/cache_generate.rb
172
+ - lib/skylight/core/normalizers/active_support/cache_increment.rb
173
+ - lib/skylight/core/normalizers/active_support/cache_read.rb
174
+ - lib/skylight/core/normalizers/active_support/cache_read_multi.rb
175
+ - lib/skylight/core/normalizers/active_support/cache_write.rb
176
+ - lib/skylight/core/normalizers/coach/handler_finish.rb
177
+ - lib/skylight/core/normalizers/coach/middleware_finish.rb
178
+ - lib/skylight/core/normalizers/couch_potato/query.rb
179
+ - lib/skylight/core/normalizers/data_mapper/sql.rb
180
+ - lib/skylight/core/normalizers/default.rb
181
+ - lib/skylight/core/normalizers/elasticsearch/request.rb
182
+ - lib/skylight/core/normalizers/faraday/request.rb
183
+ - lib/skylight/core/normalizers/grape/endpoint.rb
184
+ - lib/skylight/core/normalizers/grape/endpoint_render.rb
185
+ - lib/skylight/core/normalizers/grape/endpoint_run.rb
186
+ - lib/skylight/core/normalizers/grape/endpoint_run_filters.rb
187
+ - lib/skylight/core/normalizers/moped/query.rb
188
+ - lib/skylight/core/normalizers/sequel/sql.rb
189
+ - lib/skylight/core/normalizers/sql.rb
190
+ - lib/skylight/core/probes.rb
191
+ - lib/skylight/core/probes/action_controller.rb
192
+ - lib/skylight/core/probes/action_view.rb
193
+ - lib/skylight/core/probes/active_model_serializers.rb
194
+ - lib/skylight/core/probes/elasticsearch.rb
195
+ - lib/skylight/core/probes/excon.rb
196
+ - lib/skylight/core/probes/excon/middleware.rb
197
+ - lib/skylight/core/probes/faraday.rb
198
+ - lib/skylight/core/probes/grape.rb
199
+ - lib/skylight/core/probes/httpclient.rb
200
+ - lib/skylight/core/probes/middleware.rb
201
+ - lib/skylight/core/probes/mongo.rb
202
+ - lib/skylight/core/probes/mongoid.rb
203
+ - lib/skylight/core/probes/moped.rb
204
+ - lib/skylight/core/probes/net_http.rb
205
+ - lib/skylight/core/probes/redis.rb
206
+ - lib/skylight/core/probes/sequel.rb
207
+ - lib/skylight/core/probes/sinatra.rb
208
+ - lib/skylight/core/probes/tilt.rb
209
+ - lib/skylight/core/railtie.rb
210
+ - lib/skylight/core/subscriber.rb
211
+ - lib/skylight/core/test.rb
212
+ - lib/skylight/core/trace.rb
213
+ - lib/skylight/core/user_config.rb
214
+ - lib/skylight/core/util.rb
215
+ - lib/skylight/core/util/allocation_free.rb
216
+ - lib/skylight/core/util/clock.rb
217
+ - lib/skylight/core/util/deploy.rb
218
+ - lib/skylight/core/util/gzip.rb
219
+ - lib/skylight/core/util/inflector.rb
220
+ - lib/skylight/core/util/logging.rb
221
+ - lib/skylight/core/util/platform.rb
222
+ - lib/skylight/core/util/proxy.rb
223
+ - lib/skylight/core/vendor/active_support/notifications.rb
224
+ - lib/skylight/core/vendor/active_support/per_thread_registry.rb
225
+ - lib/skylight/core/vendor/thread_safe.rb
226
+ - lib/skylight/core/vendor/thread_safe/non_concurrent_cache_backend.rb
227
+ - lib/skylight/core/vendor/thread_safe/synchronized_cache_backend.rb
228
+ - lib/skylight/core/version.rb
229
+ - lib/skylight/core/vm/gc.rb
230
+ homepage: http://www.skylight.io
231
+ licenses:
232
+ - Nonstandard
233
+ metadata: {}
234
+ post_install_message:
235
+ rdoc_options: []
236
+ require_paths:
237
+ - lib
238
+ required_ruby_version: !ruby/object:Gem::Requirement
239
+ requirements:
240
+ - - ">="
241
+ - !ruby/object:Gem::Version
242
+ version: 2.2.7
243
+ required_rubygems_version: !ruby/object:Gem::Requirement
244
+ requirements:
245
+ - - ">"
246
+ - !ruby/object:Gem::Version
247
+ version: 1.3.1
248
+ requirements: []
249
+ rubyforge_project:
250
+ rubygems_version: 2.7.3
251
+ signing_key:
252
+ specification_version: 4
253
+ summary: The core methods of the Skylight profiler.
254
+ test_files: []