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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 362981ee1367500f9298d282f89a4f9c92b376fe327cd9c084cdc9c1edfa4207
4
- data.tar.gz: aa2a87c9ae454173ccaddbc34186b2c2876453004f5d5c5b3c1ba8ef84b6c872
3
+ metadata.gz: de5e85aa75aec4ab2fbbfcb88ee043315c68b1a359d55d7821e081e399fc8fca
4
+ data.tar.gz: 9bef2e815f516ccce2ca3017314120f7ea55d30fa944adc457479d7c0d6c562e
5
5
  SHA512:
6
- metadata.gz: 48e5e7aa6dfc1b5bc05a1c266be867efb841c73e43c296518209748ea60fc1c0171df876b727ac49b02673e1238e022cb3dd7db5f5792992bbe366263dada05a
7
- data.tar.gz: 1e144be2509cae7300ea58c4404b780bd63925881791a98c3fe604d26117c6d452e3c3ee78370ff882b6817f26c67faec7669e603f0607f9d78d7dfa8f812397
6
+ metadata.gz: 13e7f05d932ffa9cc00da4ce3afbb772b44e257ef33649db33b45900cb8cbc355f7366beff569a92a1b8c3141fe701742734734234516cbad9943c6a99e0117e
7
+ data.tar.gz: dd09630835fcc9a23684398ca70515802973a96c48c640f910cb75e07ecef4b8f15a2b7291a58ae172fa0b45f383594352cbd5e071f6dd626f004896e4ddc5af
@@ -1 +1 @@
1
- ruby 2.6.2
1
+ ruby 2.6.5
@@ -1,5 +1,15 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.0.0.alpha6] - 2019-10-22
4
+
5
+ ### Added
6
+
7
+ - Added custom Appsignal/Sidekiq instrumentation
8
+
9
+ ### Fixed
10
+
11
+ - Reduced arity strictness of Appsignal/Que error handler
12
+
3
13
  ## [1.0.0.alpha5] - 2019-09-20
4
14
 
5
15
  ### 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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Snowpack
4
- VERSION = "1.0.0.alpha5"
4
+ VERSION = "1.0.0.alpha6"
5
5
  end
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.alpha5
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-09-22 00:00:00.000000000 Z
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