skylight-core 3.1.0.beta → 3.1.0.beta2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/skylight/core/normalizers/active_job/perform.rb +35 -0
- data/lib/skylight/core/normalizers.rb +1 -0
- data/lib/skylight/core/probes/active_job.rb +21 -0
- data/lib/skylight/core/probes/mongo.rb +5 -2
- data/lib/skylight/core/sidekiq.rb +1 -1
- data/lib/skylight/core/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 59e92f03b6e19af50c182dee290299e10b4bb05225aec38c918512542e3152e3
|
4
|
+
data.tar.gz: 76b0193a7075b9a1e7ff8c4999bd9c554801c83b6a7eeeb8508c70deebbdaf24
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cca82836c6ee0aae77e9959db514f266e3ed608909c71ada1135c62d4e8caf2f8ce246d4e7b673838f63978fe85ecf3dbb1d8e249185de646a1102be9ed67f32
|
7
|
+
data.tar.gz: 282bb8f0efb7ec70d81f74916ed0b9213258f1a4e819e35b3065eebe5cdc4f58f2b93365f9e61b63626c4094cb8653c5feb3e4bb5635be511cd720ef409bf065
|
@@ -0,0 +1,35 @@
|
|
1
|
+
module Skylight::Core
|
2
|
+
module Normalizers
|
3
|
+
module ActiveJob
|
4
|
+
class Perform < Normalizer
|
5
|
+
register "perform.active_job"
|
6
|
+
|
7
|
+
CAT = "app.job.perform".freeze
|
8
|
+
|
9
|
+
def normalize(trace, _name, payload)
|
10
|
+
title = "#{payload[:job].class}"
|
11
|
+
adapter_name = normalize_adapter_name(payload[:adapter])
|
12
|
+
desc = "{ adapter: '#{adapter_name}', queue: '#{payload[:job].queue_name}' }"
|
13
|
+
|
14
|
+
trace.endpoint = title
|
15
|
+
|
16
|
+
[ CAT, title, desc ]
|
17
|
+
end
|
18
|
+
|
19
|
+
def normalize_after(trace, _span, _name, payload)
|
20
|
+
return unless config.enable_segments?
|
21
|
+
trace.endpoint += "<sk-segment>#{payload[:job].queue_name}</sk-segment>"
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
def normalize_adapter_name(adapter)
|
27
|
+
adapter_string = adapter.is_a?(Class) ? adapter.to_s : adapter.class.to_s
|
28
|
+
adapter_string[/ActiveJob::QueueAdapters::(\w+)Adapter/, 1].underscore
|
29
|
+
rescue
|
30
|
+
'active_job'
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Skylight::Core
|
2
|
+
module Probes
|
3
|
+
module ActiveJob
|
4
|
+
class Probe
|
5
|
+
def install
|
6
|
+
::ActiveJob::Base.instance_eval do
|
7
|
+
alias execute_without_sk execute
|
8
|
+
|
9
|
+
def execute(*args)
|
10
|
+
Skylight.trace('ActiveJob.execute', 'app.job.execute') do
|
11
|
+
execute_without_sk(*args)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
register(:active_job, "ActiveJob::Base", "active_job/base", ActiveJob::Probe.new)
|
20
|
+
end
|
21
|
+
end
|
@@ -12,7 +12,7 @@ module Skylight::Core
|
|
12
12
|
class Subscriber
|
13
13
|
include Util::Logging
|
14
14
|
|
15
|
-
COMMANDS = [:insert, :find, :count, :distinct, :update, :findandmodify, :delete].freeze
|
15
|
+
COMMANDS = [:insert, :find, :count, :distinct, :update, :findandmodify, :delete, :aggregate].freeze
|
16
16
|
|
17
17
|
COMMAND_NAMES = {
|
18
18
|
findandmodify: 'findAndModify'.freeze
|
@@ -108,6 +108,9 @@ module Skylight::Core
|
|
108
108
|
end
|
109
109
|
end
|
110
110
|
|
111
|
+
if (pipeline = command['pipeline'.freeze])
|
112
|
+
payload['pipeline'.freeze] = pipeline.map { |segment| extract_binds(segment) }
|
113
|
+
end
|
111
114
|
|
112
115
|
# We're ignoring documents from insert because they could have completely inconsistent
|
113
116
|
# format which would make it hard to merge.
|
@@ -168,4 +171,4 @@ module Skylight::Core
|
|
168
171
|
|
169
172
|
register(:mongo, "Mongo", "mongo", Mongo::Probe.new)
|
170
173
|
end
|
171
|
-
end
|
174
|
+
end
|
@@ -23,7 +23,7 @@ module Skylight
|
|
23
23
|
t { "Sidekiq middleware beginning trace" }
|
24
24
|
job_class = job['wrapped'] || job['class']
|
25
25
|
title = "#{job_class}#perform"
|
26
|
-
segment =
|
26
|
+
segment = "<sk-segment>#{queue}</sk-segment>"
|
27
27
|
@instrumentable.trace("#{title}#{segment}", 'app.sidekiq.worker', title) do
|
28
28
|
yield
|
29
29
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: skylight-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.1.0.
|
4
|
+
version: 3.1.0.beta2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tilde, Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-09-
|
11
|
+
date: 2018-09-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -173,6 +173,7 @@ files:
|
|
173
173
|
- lib/skylight/core/normalizers/action_view/render_collection.rb
|
174
174
|
- lib/skylight/core/normalizers/action_view/render_partial.rb
|
175
175
|
- lib/skylight/core/normalizers/action_view/render_template.rb
|
176
|
+
- lib/skylight/core/normalizers/active_job/perform.rb
|
176
177
|
- lib/skylight/core/normalizers/active_model_serializers/render.rb
|
177
178
|
- lib/skylight/core/normalizers/active_record/instantiation.rb
|
178
179
|
- lib/skylight/core/normalizers/active_record/sql.rb
|
@@ -208,6 +209,7 @@ files:
|
|
208
209
|
- lib/skylight/core/probes/action_dispatch/request_id.rb
|
209
210
|
- lib/skylight/core/probes/action_dispatch/routing/route_set.rb
|
210
211
|
- lib/skylight/core/probes/action_view.rb
|
212
|
+
- lib/skylight/core/probes/active_job.rb
|
211
213
|
- lib/skylight/core/probes/active_job_enqueue.rb
|
212
214
|
- lib/skylight/core/probes/active_model_serializers.rb
|
213
215
|
- lib/skylight/core/probes/elasticsearch.rb
|