skylight 4.1.2 → 4.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -0
- data/ext/libskylight.yml +6 -6
- data/ext/skylight_native.c +30 -0
- data/lib/skylight/config.rb +14 -12
- data/lib/skylight/errors.rb +3 -0
- data/lib/skylight/instrumenter.rb +5 -0
- data/lib/skylight/railtie.rb +3 -9
- data/lib/skylight/trace.rb +15 -1
- data/lib/skylight/util/component.rb +18 -54
- data/lib/skylight/version.rb +1 -1
- metadata +6 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9ec54d064a7d0ee23b34d01446857ce5d5d01e70820d7b95d325065d7c34682e
|
4
|
+
data.tar.gz: 78b4328f0daa411f6927a48d81a23484e378ee9bdc56fd320c8bce502392c41b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7e91e0f540bb96cfb27255858839b0fb458a89b79558977bd71f0023eeef4eaf41423aa5f6ee4debfaf6b558936e0fd22d72ef5022cb6c1009332265f2ab6ca3
|
7
|
+
data.tar.gz: 37d172168416b3926627ddb481b2fdbf16131c38feb09fd401c0428cb1251cf36f1070a69c4334bc7c00d6fef09319922fd551221e3131fa1c2eebe438e4bba3
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,13 @@
|
|
1
|
+
## 4.2.0
|
2
|
+
* [FEATURE] Add GraphQL probe
|
3
|
+
* [FEATURE] Optionally add Rack mount point to Sinatra endpoint names
|
4
|
+
* [FEATURE] Add `Skylight.mute` and `Skylight.unmute` blocks to selectively disable and re-enable
|
5
|
+
* [IMPROVEMENT] Shut down the native instrumenter when the remote daemon is unreachable
|
6
|
+
instrumentation
|
7
|
+
* [IMPROVEMENT] Revise agent authorization strategy (fixes some issues related to activation for background jobs)
|
8
|
+
* [IMPROVEMENT] Fix Rails 6 deprecation warnings
|
9
|
+
* [BUGFIX] Skip the Sidekiq probe if Sidekiq is not present
|
10
|
+
|
1
11
|
## 4.1.2
|
2
12
|
* [BUGFIX] Correct an issue where the delayed_job probe may not be activated on startup
|
3
13
|
|
data/ext/libskylight.yml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
version: "4.
|
1
|
+
version: "4.1.0-46806f5"
|
2
2
|
checksums:
|
3
|
-
x86-linux: "
|
4
|
-
x86_64-linux: "
|
5
|
-
x86_64-linux-musl: "
|
6
|
-
x86_64-darwin: "
|
7
|
-
x86_64-freebsd: "
|
3
|
+
x86-linux: "4054632757516aa44e812860601fcb7f21c8c5d412b2d585868b46c7a8e3cae6"
|
4
|
+
x86_64-linux: "4675694fba4448ba14787551237bd4e388443895d5c9e5d8a71c550eccd203db"
|
5
|
+
x86_64-linux-musl: "7a81880830d0a409a6f0f39ff42f90a1422542b05384e2480ae05515f6b5f831"
|
6
|
+
x86_64-darwin: "84eef6c330818c2bad1628ff189b9cb88275c9d72a28afac88a0d054d8002230"
|
7
|
+
x86_64-freebsd: "a86a52203fab4f9a56ad91d5700e14823e6e997b4df1bcb3ae2d9e4296c50b1f"
|
data/ext/skylight_native.c
CHANGED
@@ -334,6 +334,34 @@ trace_set_endpoint(VALUE self, VALUE endpoint) {
|
|
334
334
|
return Qnil;
|
335
335
|
}
|
336
336
|
|
337
|
+
static VALUE
|
338
|
+
trace_get_component(VALUE self) {
|
339
|
+
sky_trace_t* trace;
|
340
|
+
sky_buf_t component;
|
341
|
+
|
342
|
+
My_Struct(trace, sky_trace_t, consumed_trace_msg);
|
343
|
+
|
344
|
+
CHECK_FFI(
|
345
|
+
sky_trace_component(trace, &component),
|
346
|
+
"Trace#native_get_component");
|
347
|
+
|
348
|
+
return BUF2STR(component);
|
349
|
+
}
|
350
|
+
|
351
|
+
static VALUE
|
352
|
+
trace_set_component(VALUE self, VALUE component) {
|
353
|
+
sky_trace_t* trace;
|
354
|
+
|
355
|
+
CHECK_TYPE(component, T_STRING);
|
356
|
+
My_Struct(trace, sky_trace_t, consumed_trace_msg);
|
357
|
+
|
358
|
+
CHECK_FFI(
|
359
|
+
sky_trace_set_component(trace, STR2BUF(component)),
|
360
|
+
"Trace#native_set_component");
|
361
|
+
|
362
|
+
return Qnil;
|
363
|
+
}
|
364
|
+
|
337
365
|
static VALUE
|
338
366
|
trace_use_pruning(VALUE self) {
|
339
367
|
sky_trace_t* trace;
|
@@ -569,6 +597,8 @@ void Init_skylight_native() {
|
|
569
597
|
rb_define_method(rb_cTrace, "native_get_started_at", trace_get_started_at, 0);
|
570
598
|
rb_define_method(rb_cTrace, "native_get_endpoint", trace_get_endpoint, 0);
|
571
599
|
rb_define_method(rb_cTrace, "native_set_endpoint", trace_set_endpoint, 1);
|
600
|
+
rb_define_method(rb_cTrace, "native_get_component", trace_get_component, 0);
|
601
|
+
rb_define_method(rb_cTrace, "native_set_component", trace_set_component, 1);
|
572
602
|
rb_define_method(rb_cTrace, "native_use_pruning", trace_use_pruning, 0);
|
573
603
|
rb_define_method(rb_cTrace, "native_set_exception", trace_set_exception, 1);
|
574
604
|
rb_define_method(rb_cTrace, "native_get_uuid", trace_get_uuid, 0);
|
data/lib/skylight/config.rb
CHANGED
@@ -276,7 +276,6 @@ module Skylight
|
|
276
276
|
if token
|
277
277
|
meta = {}
|
278
278
|
meta.merge!(deploy.to_query_hash) if deploy
|
279
|
-
meta[:component] = component.to_s if component
|
280
279
|
meta[:reporting_env] = true if reporting_env?
|
281
280
|
|
282
281
|
# A pipe should be a safe delimiter since it's not in the standard token
|
@@ -291,21 +290,24 @@ module Skylight
|
|
291
290
|
@deploy ||= Util::Deploy.build(self)
|
292
291
|
end
|
293
292
|
|
294
|
-
def
|
295
|
-
@
|
296
|
-
|
297
|
-
|
298
|
-
|
293
|
+
def components
|
294
|
+
@components ||= {
|
295
|
+
web: Util::Component.new(
|
296
|
+
get(:env),
|
297
|
+
Util::Component::DEFAULT_NAME
|
298
|
+
),
|
299
|
+
worker: Util::Component.new(
|
300
|
+
get(:env),
|
301
|
+
get(:component) || get(:worker_component),
|
302
|
+
force_worker: true
|
303
|
+
)
|
304
|
+
}
|
299
305
|
rescue ArgumentError => e
|
300
306
|
raise Core::ConfigError, e.message
|
301
307
|
end
|
302
308
|
|
303
|
-
def
|
304
|
-
|
305
|
-
end
|
306
|
-
|
307
|
-
def web_context?
|
308
|
-
component.web?
|
309
|
+
def component
|
310
|
+
components[:web]
|
309
311
|
end
|
310
312
|
|
311
313
|
def as_json(*)
|
data/lib/skylight/errors.rb
CHANGED
data/lib/skylight/railtie.rb
CHANGED
@@ -35,13 +35,12 @@ module Skylight
|
|
35
35
|
|
36
36
|
def activate?(sk_config)
|
37
37
|
return false unless super && sk_config
|
38
|
-
|
38
|
+
show_worker_activation_warning(sk_config)
|
39
|
+
true
|
39
40
|
end
|
40
41
|
|
41
42
|
# We must have an opt-in signal
|
42
|
-
def
|
43
|
-
return unless sk_config.worker_context?
|
44
|
-
|
43
|
+
def show_worker_activation_warning(sk_config)
|
45
44
|
reasons = []
|
46
45
|
reasons << "the 'active_job' probe is enabled" if sk_rails_config.probes.include?("active_job")
|
47
46
|
reasons << "the 'delayed_job' probe is enabled" if sk_rails_config.probes.include?("delayed_job")
|
@@ -50,11 +49,6 @@ module Skylight
|
|
50
49
|
return if reasons.empty?
|
51
50
|
|
52
51
|
sk_config.logger.warn("Activating Skylight for Background Jobs because #{reasons.to_sentence}")
|
53
|
-
true
|
54
|
-
end
|
55
|
-
|
56
|
-
def activate_for_web?(sk_config)
|
57
|
-
sk_config.web_context?
|
58
52
|
end
|
59
53
|
|
60
54
|
def development_warning
|
data/lib/skylight/trace.rb
CHANGED
@@ -1,7 +1,10 @@
|
|
1
1
|
module Skylight
|
2
2
|
class Trace < Core::Trace
|
3
|
-
|
3
|
+
attr_reader :component
|
4
|
+
|
5
|
+
def initialize(*, component: nil)
|
4
6
|
super
|
7
|
+
self.component = component if component
|
5
8
|
@too_many_spans = false
|
6
9
|
native_use_pruning if use_pruning?
|
7
10
|
end
|
@@ -51,5 +54,16 @@ module Skylight
|
|
51
54
|
def use_pruning?
|
52
55
|
config.get(:prune_large_traces)
|
53
56
|
end
|
57
|
+
|
58
|
+
def resolve_component(component)
|
59
|
+
config.components[component].to_encoded_s
|
60
|
+
end
|
61
|
+
|
62
|
+
def component=(component)
|
63
|
+
resolve_component(component).tap do |c|
|
64
|
+
@component = c
|
65
|
+
native_set_component(c)
|
66
|
+
end
|
67
|
+
end
|
54
68
|
end
|
55
69
|
end
|
@@ -1,35 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require "uri"
|
3
|
+
|
1
4
|
module Skylight
|
2
5
|
module Util
|
3
6
|
class Component
|
4
7
|
attr_accessor :environment, :name
|
5
8
|
|
6
9
|
NAME_FORMAT = /\A[a-zA-Z0-9_-]+\z/
|
7
|
-
DEFAULT_NAME = "web"
|
8
|
-
WORKER_NAME = "worker"
|
9
|
-
DEFAULT_ENVIRONMENT = "production"
|
10
|
-
|
11
|
-
WORKER_PROGRAM_MATCHER = Regexp.union [
|
12
|
-
/sidekiq$/i,
|
13
|
-
/backburner$/i,
|
14
|
-
/delayed_job$/i,
|
15
|
-
/que$/i,
|
16
|
-
/sneakers$/i,
|
17
|
-
/shoryuken$/i
|
18
|
-
]
|
19
|
-
|
20
|
-
WORKER_RAKE_MATCHER = Regexp.union [
|
21
|
-
/\Aresque:/,
|
22
|
-
/\Abackburner:/,
|
23
|
-
/\Ajobs:/, # DelayedJob. can also be `rake jobs:workoff`
|
24
|
-
/\Aqu:/,
|
25
|
-
/\Aque:/,
|
26
|
-
/\Aqc:/,
|
27
|
-
/\Asneakers:/
|
28
|
-
]
|
10
|
+
DEFAULT_NAME = "web"
|
11
|
+
WORKER_NAME = "worker"
|
12
|
+
DEFAULT_ENVIRONMENT = "production"
|
29
13
|
|
30
|
-
def initialize(environment, name)
|
14
|
+
def initialize(environment, name, force_worker: false)
|
31
15
|
@environment = environment || DEFAULT_ENVIRONMENT
|
32
|
-
@name = resolve_name(name)
|
16
|
+
@name = resolve_name(name, force_worker)
|
33
17
|
|
34
18
|
raise ArgumentError, "environment can't be blank" if @environment.empty?
|
35
19
|
validate_string!(@environment, "environment")
|
@@ -40,6 +24,10 @@ module Skylight
|
|
40
24
|
"#{name}:#{environment}"
|
41
25
|
end
|
42
26
|
|
27
|
+
def to_encoded_s
|
28
|
+
@to_encoded_s ||= URI.encode_www_form_component(to_s)
|
29
|
+
end
|
30
|
+
|
43
31
|
def web?
|
44
32
|
name == DEFAULT_NAME
|
45
33
|
end
|
@@ -66,42 +54,18 @@ module Skylight
|
|
66
54
|
ARGV
|
67
55
|
end
|
68
56
|
|
69
|
-
def resolve_name(given_name)
|
70
|
-
|
71
|
-
return
|
72
|
-
return
|
73
|
-
|
57
|
+
def resolve_name(given_name, force_worker)
|
58
|
+
# don't allow workers to be called 'web'
|
59
|
+
return WORKER_NAME if force_worker && (given_name.nil? || given_name == DEFAULT_NAME)
|
60
|
+
return DEFAULT_NAME if given_name.nil?
|
61
|
+
|
62
|
+
given_name
|
74
63
|
end
|
75
64
|
|
76
65
|
def validate_string!(string, kind)
|
77
66
|
return true if string =~ NAME_FORMAT
|
78
67
|
raise ArgumentError, "#{kind} can only contain lowercase letters, numbers, and dashes"
|
79
68
|
end
|
80
|
-
|
81
|
-
def known_web_context?
|
82
|
-
rails_server? || rack_server? || passenger? || unicorn?
|
83
|
-
end
|
84
|
-
|
85
|
-
def known_worker_context?
|
86
|
-
return true if program_name =~ WORKER_PROGRAM_MATCHER
|
87
|
-
program_name[/rake$/] && argv.any? { |arg| arg =~ WORKER_RAKE_MATCHER }
|
88
|
-
end
|
89
|
-
|
90
|
-
def rails_server?
|
91
|
-
defined?(Rails::Server)
|
92
|
-
end
|
93
|
-
|
94
|
-
def rack_server?
|
95
|
-
program_name[/(?<!\w)(falcon|puma|rackup|thin)$/]
|
96
|
-
end
|
97
|
-
|
98
|
-
def unicorn?
|
99
|
-
program_name[/\Aunicorn/]
|
100
|
-
end
|
101
|
-
|
102
|
-
def passenger?
|
103
|
-
program_name[/\APassenger AppPreloader/]
|
104
|
-
end
|
105
69
|
end
|
106
70
|
end
|
107
71
|
end
|
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: 4.
|
4
|
+
version: 4.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tilde, Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-10-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: skylight-core
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 4.
|
19
|
+
version: 4.2.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 4.
|
26
|
+
version: 4.2.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: beefcake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -269,7 +269,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
269
269
|
- !ruby/object:Gem::Version
|
270
270
|
version: '0'
|
271
271
|
requirements: []
|
272
|
-
|
272
|
+
rubyforge_project:
|
273
|
+
rubygems_version: 2.7.6
|
273
274
|
signing_key:
|
274
275
|
specification_version: 4
|
275
276
|
summary: Skylight is a smart profiler for Rails, Sinatra, and other Ruby apps.
|