roda-appsignal 1.1.1 → 2.0.0

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: b6075c68269da159068b134fa54144a4c3f9967ab89401ed4c389d73e470a7f2
4
- data.tar.gz: e4af564d026fad7c195206ded5a0b86a82f2c5daad8e5e72b75e82916b110168
3
+ metadata.gz: b785dd30fbb7e49462f88516a4054f34e24e7d0fc63e1b413fff111836e8766d
4
+ data.tar.gz: ff1eb89cfc729a56a89e2030fd7ad0f7074b43ce7196b551032eb6d298ef2acf
5
5
  SHA512:
6
- metadata.gz: 38b295d5c519fd010c9f4a399854cf846a72b7bca69dcc7bbbcb48a82b40ccb08cee4b4e7c0ec6e54e7809a8f44f3b4a4b08a1ee299ede65bd609decd8c13a8d
7
- data.tar.gz: 596bf6cf4a85022a2a2dd3fedf858169f5074fac54008df57cc4f99a25b01edae4ec3d9f876341eb3a9e2d0158f6196709ac79e3cd80c5ef99a8b5478151d209
6
+ metadata.gz: ae22403ba5f2e7551611956c035180179af5d2b2390ecfe3385a2cd813b7fd0d293ee794229158e9a6578a507348728b82547b1d0f07eea0d8e56d2fec889282
7
+ data.tar.gz: 67de01d813c2225cd2a8f9426aa03858419582857e9766ee0dc25041b335a2cd5743887c60112fd54009de22035cc52352eb56cd6315d9c8c708b83bd56bd5aa
data/CHANGELOG.md CHANGED
@@ -14,6 +14,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
14
14
 
15
15
  ---
16
16
 
17
+ ## [2.0.0] - 2019-10-23
18
+ ### Added
19
+ - Support custom namespaces
20
+ ### Changed
21
+ - Switch to named/hash params
22
+
17
23
  ## [1.1.1] - 2019-10-18
18
24
  ### Fixed
19
25
  - Prevent modification of frozen strings.
data/README.md CHANGED
@@ -49,7 +49,7 @@ You can also sanitize the action name via a proc argument:
49
49
  ```ruby
50
50
  class App < Roda
51
51
 
52
- plugin :appsignal, proc { |name| name.gsub!(/\d+/, ':id') }
52
+ plugin :appsignal, sanitize: proc { |name| name.gsub!(/\d+/, ':id') }
53
53
 
54
54
  route do |r|
55
55
  r.is 'foo' do
@@ -62,6 +62,24 @@ class App < Roda
62
62
  end
63
63
  ```
64
64
 
65
+ You can also customize the transaction namespace:
66
+
67
+ ```ruby
68
+ class App < Roda
69
+
70
+ plugin :appsignal, namespace: 'custom_namespace'
71
+
72
+ route do |r|
73
+ r.is 'foo' do
74
+ r.is Integer do
75
+ # will be named/instrumented under custom_namespace
76
+ 'hello world'
77
+ end
78
+ end
79
+ end
80
+ end
81
+ ```
82
+
65
83
  ## Development
66
84
 
67
85
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
@@ -3,7 +3,7 @@
3
3
  class Roda
4
4
  module RodaPlugins
5
5
  module Appsignal
6
- VERSION = '1.1.1'
6
+ VERSION = '2.0.0'
7
7
  end
8
8
  end
9
9
  end
@@ -1,24 +1,29 @@
1
1
  # frozen-string-literal: true
2
2
 
3
3
  class Roda
4
+ # Plugin implementation
4
5
  module RodaPlugins
5
6
  # The appsignal plugin starts and sets APM instrumentation via Appsignal
6
7
  #
7
8
  # Example:
8
9
  #
9
10
  # plugin :appsignal
10
- # plugin :appsignal, proc { |action_name| action_name.gsub(/\d+\/, '') }
11
+ # plugin :appsignal, sanitize: proc { |action_name| action_name.gsub(/\d+\/, '') }
12
+ # plugin :appsignal, namespeace: 'custom_namespace'
11
13
  #
12
14
  module Appsignal
13
- def self.configure(app, sanitize = proc { |name| name })
15
+ def self.configure(app, namespeace: 'web', sanitize: proc { |name| name })
14
16
  app.opts[:appsignal_sanitize] = sanitize
17
+ app.opts[:appsignal_namespace] = namespeace
15
18
  app.use ::Appsignal::Rack::GenericInstrumentation
16
19
  end
17
20
 
21
+ # Instance method overrides
18
22
  module InstanceMethods
19
23
  private
20
24
 
21
25
  def _roda_before_10__appsignal
26
+ ::Appsignal.set_namespace(opts[:appsignal_namespace])
22
27
  ::Appsignal.set_action(
23
28
  opts[:appsignal_sanitize].call(request.inspect.gsub(/#|<|>/, ''))
24
29
  )
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: roda-appsignal
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - andjosh
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-10-18 00:00:00.000000000 Z
11
+ date: 2019-10-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: roda