skylight 4.1.2 → 4.2.0.beta
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/ext/libskylight.yml +6 -6
- data/ext/skylight_native.c +30 -0
- data/lib/skylight/config.rb +14 -12
- 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 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d91b4f08958f93027e62e1d08cc6047462c39c9df2c98de8e27f3dcb4d4f10ce
|
4
|
+
data.tar.gz: 3a35d4f4c300d77dd911d964f405d42a026c447d6dc8d1a0d69a1301f0ec5d3d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eb320617e3176912f281b45ee47f7a09b3ac7f71d2acea26505beed0c3d05910249f6ced4e4c304addfa56a9cf1cf66ef199f0af1d0e378892ef4141e4830860
|
7
|
+
data.tar.gz: 3a86a8b24adda0054a4c3a8945df3f97559b44a42dfab2c954a6d361cd7e2a4c23407bd6a2db01480915a690e2ba60e4c47d706c99751810879973f699054247
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
## 4.2.0-beta
|
2
|
+
* [FEATURE] Add `Skylight.mute` and `Skylight.unmute` blocks to selectively disable and re-enable instrumentation
|
3
|
+
* [IMPROVEMENT] Revise agent authorization strategy (fixes some issues related to activation for background jobs)
|
4
|
+
* [IMPROVEMENT] Fix Rails 6 deprecation warnings
|
5
|
+
|
1
6
|
## 4.1.2
|
2
7
|
* [BUGFIX] Correct an issue where the delayed_job probe may not be activated on startup
|
3
8
|
|
data/ext/libskylight.yml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
version: "4.0.0-
|
1
|
+
version: "4.0.0-d262d98"
|
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: "2b104d93829722c841202dc770a43d65db2a96083638aea6f68310f74e051ace"
|
4
|
+
x86_64-linux: "9573011a562944b869acdb8fa464108c2dff31d663ca182240377c22681c4f1e"
|
5
|
+
x86_64-linux-musl: "aeb0e7aaef0b6f113b80d3ee458a815e70d047e4f4722a1f57d21f292a4d11ab"
|
6
|
+
x86_64-darwin: "3de86542427fa7e47a0c1d0ec44f71b2851ecb6aef9d26875d6f7dd8c536194b"
|
7
|
+
x86_64-freebsd: "871c12ea4a5abada8e8ca005362ca0d2870e7d0f839b542f4780abeee042b6d1"
|
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/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.beta
|
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-08-19 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.beta
|
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.beta
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: beefcake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -265,9 +265,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
265
265
|
version: '2.3'
|
266
266
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
267
267
|
requirements:
|
268
|
-
- - "
|
268
|
+
- - ">"
|
269
269
|
- !ruby/object:Gem::Version
|
270
|
-
version:
|
270
|
+
version: 1.3.1
|
271
271
|
requirements: []
|
272
272
|
rubygems_version: 3.0.3
|
273
273
|
signing_key:
|