snowpack 1.0.0.alpha5 → 1.0.0.alpha6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.tool-versions +1 -1
- data/CHANGELOG.md +10 -0
- data/lib/snowpack/instrumentation/appsignal/que.rb +2 -4
- data/lib/snowpack/instrumentation/appsignal/sidekiq.rb +72 -0
- data/lib/snowpack/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: de5e85aa75aec4ab2fbbfcb88ee043315c68b1a359d55d7821e081e399fc8fca
|
4
|
+
data.tar.gz: 9bef2e815f516ccce2ca3017314120f7ea55d30fa944adc457479d7c0d6c562e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 13e7f05d932ffa9cc00da4ce3afbb772b44e257ef33649db33b45900cb8cbc355f7366beff569a92a1b8c3141fe701742734734234516cbad9943c6a99e0117e
|
7
|
+
data.tar.gz: dd09630835fcc9a23684398ca70515802973a96c48c640f910cb75e07ecef4b8f15a2b7291a58ae172fa0b45f383594352cbd5e071f6dd626f004896e4ddc5af
|
data/.tool-versions
CHANGED
@@ -1 +1 @@
|
|
1
|
-
ruby 2.6.
|
1
|
+
ruby 2.6.5
|
data/CHANGELOG.md
CHANGED
@@ -15,11 +15,9 @@ module Snowpack
|
|
15
15
|
# Enable like so:
|
16
16
|
#
|
17
17
|
# Que.error_notifier = Snowpack::Instrumentation::Appsignal::Que::ErrorNotifier
|
18
|
-
|
19
|
-
# Actually, why is this even necessry?
|
20
|
-
ErrorNotifier = -> error, _job {
|
18
|
+
ErrorNotifier = proc do |error, _job|
|
21
19
|
::Appsignal::Transaction.current.set_error(error)
|
22
|
-
|
20
|
+
end
|
23
21
|
|
24
22
|
def self.included(base)
|
25
23
|
base.class_eval do
|
@@ -0,0 +1,72 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "appsignal"
|
4
|
+
require_relative "appsignal_ext"
|
5
|
+
|
6
|
+
# Remove Appsignal's own Sidekiq integration hook, so the Snowpack-hosted
|
7
|
+
# integration can be included manually.
|
8
|
+
Appsignal::Hooks.hooks.delete :sidekiq
|
9
|
+
|
10
|
+
module Snowpack
|
11
|
+
module Instrumentation
|
12
|
+
module Appsignal
|
13
|
+
module Sidekiq
|
14
|
+
def self.install
|
15
|
+
::Appsignal::Minutely.probes.register :sidekiq, ::Appsignal::Hooks::SidekiqProbe
|
16
|
+
|
17
|
+
::Sidekiq.configure_server do |config|
|
18
|
+
config.server_middleware do |chain|
|
19
|
+
chain.add Plugin
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
class Plugin < ::Appsignal::Hooks::SidekiqPlugin
|
25
|
+
# Copy over original method, add transaction.discard! behavior
|
26
|
+
def call(worker, item, _queue)
|
27
|
+
job_status = nil
|
28
|
+
transaction = ::Appsignal::Transaction.create(
|
29
|
+
SecureRandom.uuid,
|
30
|
+
::Appsignal::Transaction::BACKGROUND_JOB,
|
31
|
+
::Appsignal::Transaction::GenericRequest.new(
|
32
|
+
:queue_start => item["enqueued_at"]
|
33
|
+
)
|
34
|
+
)
|
35
|
+
|
36
|
+
# Add this behavior
|
37
|
+
transaction.discard! unless worker.instrument?
|
38
|
+
|
39
|
+
::Appsignal.instrument "perform_job.sidekiq" do
|
40
|
+
begin
|
41
|
+
yield
|
42
|
+
rescue Exception => exception # rubocop:disable Lint/RescueException
|
43
|
+
job_status = :failed
|
44
|
+
transaction.set_error(exception)
|
45
|
+
raise exception
|
46
|
+
end
|
47
|
+
end
|
48
|
+
ensure
|
49
|
+
if transaction
|
50
|
+
transaction.set_action_if_nil(formatted_action_name(item))
|
51
|
+
transaction.params = filtered_arguments(item)
|
52
|
+
formatted_metadata(item).each do |key, value|
|
53
|
+
transaction.set_metadata key, value
|
54
|
+
end
|
55
|
+
transaction.set_http_or_background_queue_start
|
56
|
+
::Appsignal::Transaction.complete_current!
|
57
|
+
queue = item["queue"] || "unknown"
|
58
|
+
if job_status
|
59
|
+
increment_counter "queue_job_count", 1,
|
60
|
+
:queue => queue,
|
61
|
+
:status => job_status
|
62
|
+
end
|
63
|
+
increment_counter "queue_job_count", 1,
|
64
|
+
:queue => queue,
|
65
|
+
:status => :processed
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
data/lib/snowpack/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: snowpack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0.
|
4
|
+
version: 1.0.0.alpha6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tim Riley
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2019-
|
12
|
+
date: 2019-10-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: dry-inflector
|
@@ -285,6 +285,7 @@ files:
|
|
285
285
|
- lib/snowpack/instrumentation/appsignal/appsignal_ext.rb
|
286
286
|
- lib/snowpack/instrumentation/appsignal/que.rb
|
287
287
|
- lib/snowpack/instrumentation/appsignal/rack.rb
|
288
|
+
- lib/snowpack/instrumentation/appsignal/sidekiq.rb
|
288
289
|
- lib/snowpack/roda/web.rb
|
289
290
|
- lib/snowpack/slice.rb
|
290
291
|
- lib/snowpack/test/suite.rb
|