newrelic-grape 1.1.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 02f6a2ada60979c5610586cd9dc8e7487a01fb01
4
+ data.tar.gz: e51601ed2e8e904737617023448400471ac698dc
5
+ SHA512:
6
+ metadata.gz: 80806f481231de638c008d62036d50476114d81d1abfafa87d21a3e8aa2c8132932d536b1e1b147b38ded2a14cb2ff8638b63b4980f6f04c31981252b5b131f0
7
+ data.tar.gz: c48802c2dd88c985675036c41b46d3f91426eb8ed55e3987b8942e90b11439740e64e3c728bfabdd7ddf5ecd3c431f64bb8a9a8bb9277319ab9203a04d950b2a
data/CHANGELOG.md CHANGED
@@ -1,10 +1,15 @@
1
- Next Release
2
- ============
1
+ # Next Release
2
+
3
+ ## 1.2.0 (02/27/2012)
4
+
5
+ * Use newrelic-grape middleware before `Grape::Middleware::Error`
6
+ * Better Readme
7
+
8
+ ## 1.1.0 (12/28/2012)
3
9
 
4
10
  * Changed namespace from `Newrelic` to `NewRelic` to be consistent with the RPM gem - [@dblock](https://github.com/dblock).
5
11
  * Set `DISABLE_NEW_RELIC_GRAPE` to disable instrumentation - [@dblock](https://github.com/dblock).
6
12
 
7
- 1.0.0 (12/18/2012)
8
- ==================
13
+ ## 1.0.0 (12/18/2012)
9
14
 
10
15
  * Initial public release - [@flyerhzm](https://github.com/flyerhzm).
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # NewRelic::Grape
2
2
 
3
- NewRelic instrument for [grape][0], this is inspired from this [blog post][1].
3
+ NewRelic instrumentation for the [Grape API DSL][0], inspired by [this blog post][1].
4
4
 
5
5
  ## Installation
6
6
 
@@ -18,12 +18,37 @@ Or install it yourself as:
18
18
 
19
19
  ## Usage
20
20
 
21
- That's it.
21
+ Ensure that you have working NewRelic instrumentation. Add the `newrelic-grape` gem. That's it.
22
22
 
23
23
  ## Disabling Instrumentation
24
24
 
25
25
  Set `disable_grape` in `newrelic.yml` or `ENV['DISABLE_NEW_RELIC_GRAPE']` to disable instrumentation.
26
26
 
27
+ ## Testing
28
+
29
+ This gem naturally works in NewRelic developer mode. For more information see the [NewRelic Developer Documentation][2].
30
+
31
+ To ensure instrumentation in tests, check that `perform_action_with_newrelic_trace` is invoked on an instance of `NewRelic::Agent::Instrumentation::Grape` when calling your API.
32
+
33
+ ### RSpec
34
+
35
+ ``` ruby
36
+ describe NewRelic::Agent::Instrumentation::Grape do
37
+ it "traces" do
38
+ NewRelic::Agent::Instrumentation::Grape
39
+ .any_instance
40
+ .should_receive(:perform_action_with_newrelic_trace)
41
+ .and_yield
42
+ get "/ping"
43
+ response.status.should == 200
44
+ end
45
+ end
46
+ ```
47
+
48
+ ## Demos
49
+
50
+ * [Grape on Rack w/ NewRelic Instrumentation Enabled][3]
51
+
27
52
  ## Contributing
28
53
 
29
54
  1. Fork it
@@ -34,4 +59,6 @@ Set `disable_grape` in `newrelic.yml` or `ENV['DISABLE_NEW_RELIC_GRAPE']` to dis
34
59
  6. Create new Pull Request
35
60
 
36
61
  [0]: https://github.com/intridea/grape
37
- [1]: http://artsy.github.com/blog/2012/11/29/measuring-performance-in-grape-apis-with-new-relic/
62
+ [1]: http://artsy.github.com/blog/2012/11/29/measuring-performance-in-grape-apis-with-new-relic
63
+ [2]: https://newrelic.com/docs/ruby/developer-mode
64
+ [3]: https://github.com/dblock/grape-on-rack
@@ -30,7 +30,7 @@ module NewRelic
30
30
  end
31
31
  end
32
32
 
33
- DependencyDetection.defer do
33
+ DependencyDetection.defer do
34
34
  @name = :grape
35
35
 
36
36
  depends_on do
@@ -42,13 +42,14 @@ DependencyDetection.defer do
42
42
  end
43
43
 
44
44
  executes do
45
- ::Grape::Endpoint.class_eval do
46
- alias_method :grape_build_middleware, :build_middleware
45
+ ::Rack::Builder.class_eval do
46
+ alias_method :origin_use, :use
47
47
 
48
- def build_middleware
49
- builder = grape_build_middleware
50
- builder.use ::NewRelic::Agent::Instrumentation::Grape
51
- builder
48
+ def use(middleware, *args, &block)
49
+ if middleware == Grape::Middleware::Error
50
+ use ::NewRelic::Agent::Instrumentation::Grape
51
+ end
52
+ origin_use(middleware, *args, &block)
52
53
  end
53
54
  end
54
55
  end
@@ -1,5 +1,5 @@
1
1
  module NewRelic
2
2
  module Grape
3
- VERSION = "1.1.0"
3
+ VERSION = "1.2.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,46 +1,41 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: newrelic-grape
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
5
- prerelease:
4
+ version: 1.2.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Richard Huang
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2012-12-28 00:00:00.000000000 Z
11
+ date: 2013-02-27 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: grape
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - '>='
20
18
  - !ruby/object:Gem::Version
21
19
  version: '0'
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - '>='
28
25
  - !ruby/object:Gem::Version
29
26
  version: '0'
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: newrelic_rpm
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - '>='
36
32
  - !ruby/object:Gem::Version
37
33
  version: '0'
38
34
  type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - '>='
44
39
  - !ruby/object:Gem::Version
45
40
  version: '0'
46
41
  description: newrelic instrument for grape
@@ -67,33 +62,26 @@ files:
67
62
  - spec/spec_helper.rb
68
63
  homepage: https://github.com/flyerhzm/newrelic-grape
69
64
  licenses: []
65
+ metadata: {}
70
66
  post_install_message:
71
67
  rdoc_options: []
72
68
  require_paths:
73
69
  - lib
74
70
  required_ruby_version: !ruby/object:Gem::Requirement
75
- none: false
76
71
  requirements:
77
- - - ! '>='
72
+ - - '>='
78
73
  - !ruby/object:Gem::Version
79
74
  version: '0'
80
- segments:
81
- - 0
82
- hash: 240126321961022721
83
75
  required_rubygems_version: !ruby/object:Gem::Requirement
84
- none: false
85
76
  requirements:
86
- - - ! '>='
77
+ - - '>='
87
78
  - !ruby/object:Gem::Version
88
79
  version: '0'
89
- segments:
90
- - 0
91
- hash: 240126321961022721
92
80
  requirements: []
93
81
  rubyforge_project:
94
- rubygems_version: 1.8.24
82
+ rubygems_version: 2.0.0
95
83
  signing_key:
96
- specification_version: 3
84
+ specification_version: 4
97
85
  summary: newrelic instrument for grape
98
86
  test_files:
99
87
  - spec/newrelic-grape/instrumenter_spec.rb