appsignal_extensions 0.0.4 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/appsignal_extensions.gemspec +1 -1
- data/lib/appsignal_extensions/middleware.rb +4 -10
- data/lib/appsignal_extensions/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f18be3c36e23af089dc619af64a436d5d1b41274a1e58f924c7339b1f49f6aa5
|
4
|
+
data.tar.gz: 1da626982aa82e1ebadf73bc57e8a779aeca4c8fe9228af26d31d97f0cc5eb30
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e87b205ec980467ad13c35e58cc7f5c8c6f74c2a58c82ec7d47a72d572a0499192b6d862675f513fa146d04cf65b3170b758b74888197d114c79e90d652c125d
|
7
|
+
data.tar.gz: f7fa9195392b9bcdb09162ab9d3cd74bd18e7f8a8448c897d6911ca4cd7c0daeb16b294517b9bf5497d92ec709f0681326e9e58e535e3a1e77d235fa33a4f695
|
@@ -24,7 +24,7 @@ Gem::Specification.new do |s|
|
|
24
24
|
s.rubygems_version = "2.2.2"
|
25
25
|
s.summary = "Suspend an Appsignal transaction for long responses"
|
26
26
|
s.specification_version = 4
|
27
|
-
s.add_runtime_dependency(%q<appsignal>, ["~>
|
27
|
+
s.add_runtime_dependency(%q<appsignal>, ["~> 2"])
|
28
28
|
s.add_development_dependency(%q<rake>, ["~> 10"])
|
29
29
|
s.add_development_dependency(%q<rack-test>, [">= 0"])
|
30
30
|
s.add_development_dependency(%q<rspec>, ["~> 3.2.0"])
|
@@ -5,20 +5,14 @@ require 'delegate'
|
|
5
5
|
# closes the transaction as soon as the response triplet gets returned,
|
6
6
|
# we need to keep the transaction open as long as the response is being read.
|
7
7
|
class AppsignalExtensions::Middleware
|
8
|
-
|
9
|
-
def self.appsignal_defined_and_active?
|
10
|
-
!!(defined?(Appsignal) && Appsignal.active?)
|
11
|
-
end
|
12
|
-
|
8
|
+
|
13
9
|
# Appsignal::Transaction has no #close method, you have to use a global
|
14
10
|
# function call instead. We wrap it with a simple proxy that provides
|
15
11
|
# close
|
16
12
|
class Close < SimpleDelegator
|
17
13
|
# Closes the current Appsignal transaction
|
18
14
|
def close
|
19
|
-
if
|
20
|
-
Appsignal::Transaction.complete_current!
|
21
|
-
end
|
15
|
+
Appsignal::Transaction.complete_current! if Appsignal.active?
|
22
16
|
end
|
23
17
|
end
|
24
18
|
|
@@ -78,7 +72,7 @@ class AppsignalExtensions::Middleware
|
|
78
72
|
def call(env)
|
79
73
|
request = ::Rack::Request.new(env)
|
80
74
|
env['action_dispatch.request_id'] ||= SecureRandom.uuid
|
81
|
-
if
|
75
|
+
if Appsignal.active?
|
82
76
|
call_with_appsignal(env, request)
|
83
77
|
else
|
84
78
|
call_with_null_transaction(env, request)
|
@@ -130,7 +124,7 @@ class AppsignalExtensions::Middleware
|
|
130
124
|
# Let the app do something to the appsignal transaction if it wants to
|
131
125
|
# Instrument a `process_action`, to set params/action name
|
132
126
|
transaction = Close.new(bare_transaction)
|
133
|
-
status, headers, body =
|
127
|
+
status, headers, body = Appsignal.instrument('process_action.rack') do
|
134
128
|
call_and_capture(env, transaction, request)
|
135
129
|
end
|
136
130
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: appsignal_extensions
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Julik Tarkhanov
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '2'
|
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: '
|
26
|
+
version: '2'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|