newrelic-grape 1.3.1 → 1.4.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3172a804df57e407393d92969bec41ce62a5bc3f
4
- data.tar.gz: 9f371aa6aef084cafa4f21c6f1eb9b154d199d8e
3
+ metadata.gz: c545d92d15495cb96292ad77d6974efd96ff166f
4
+ data.tar.gz: bc1329532adab8dc61c47c43e558281cb9888f46
5
5
  SHA512:
6
- metadata.gz: 3d03b55e6f73e2baa79e623619db643127333e82c43d6d5d7d6e0fb61cb262f3f39c386d8be57d6dbcbaf17ba651ac1615416b3fa2e607aa023381afc4d407a0
7
- data.tar.gz: 0bda6142e4db3e7d3e613e89c37c98c60cf6a172761175ec4193b27979103596e94939cfa40810df70bc1287ef320cab2b5410adf2fce8800dc2c0f760cc56f9
6
+ metadata.gz: 32085b97c249625e064489d56f40c4839dce1e20af04bb8306afee7e4f468f34c132a6e5927700ae76929a572d0fa1aa392df129d637df0d2253b2da0e46476e
7
+ data.tar.gz: 939339e1fa59c3ebc7f52a6263e45a922cedf65cd6df2020ffe7460b677bd033ba1125b0cdc82201dbb428ea322f03260d59b3c4ec400a48966c74cd18cbe31d
data/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # Next Release
2
2
 
3
+ ## 1.4.1 (07/04/2014)
4
+
5
+ * Fix "uninitialized constant NewRelic::MetricSpec (NameError)" with
6
+ newrelic_rpm 3.8.1.221
7
+ * Fix "uninitialized constant Grape"
8
+
9
+ ## 1.4.0 (05/09/2014)
10
+
11
+ * Add version to request path [@donbobka](https://github.com/donbobka)
12
+
3
13
  ## 1.3.1 (06/08/2013)
4
14
 
5
15
  * Remove explicit newrelic_rpm require [@rymai](https://github.com/rymai)
@@ -1,4 +1,6 @@
1
+ require 'new_relic/agent/instrumentation'
1
2
  require 'new_relic/agent/instrumentation/controller_instrumentation'
3
+ require 'grape'
2
4
 
3
5
  module NewRelic
4
6
  module Agent
@@ -20,14 +22,21 @@ module NewRelic
20
22
  end
21
23
  end
22
24
 
25
+ def route
26
+ env['api.endpoint'].routes.first
27
+ end
28
+
23
29
  def request_path
24
- env['api.endpoint'].routes.first.route_path[1..-1].gsub("/", "-").sub(/\(\.:format\)\z/, "")
30
+ path = route.route_path[1..-1].gsub('/', '-')
31
+ path.sub!(/\(\.:format\)\z/, '')
32
+ route.route_version && path.sub!(':version', route.route_version)
33
+
34
+ path
25
35
  end
26
36
 
27
37
  def request_method
28
38
  @newrelic_request.request_method
29
39
  end
30
-
31
40
  end
32
41
  end
33
42
  end
@@ -1,5 +1,5 @@
1
1
  module NewRelic
2
2
  module Grape
3
- VERSION = "1.3.1"
3
+ VERSION = "1.4.1"
4
4
  end
5
5
  end
@@ -8,19 +8,47 @@ describe NewRelic::Agent::Instrumentation::Grape do
8
8
  subject
9
9
  end
10
10
 
11
- before do
12
- subject.get :hello do
13
- "Hello World"
11
+ context 'api without version' do
12
+ before do
13
+ subject.get :hello do
14
+ 'Hello World'
15
+ end
14
16
  end
15
- end
16
17
 
17
- it "perform_action_with_newrelic_trace" do
18
- NewRelic::Agent::Instrumentation::Grape.any_instance.should_receive(:perform_action_with_newrelic_trace).and_yield
19
- get "/hello"
20
- last_response.status.should == 200
21
- last_response.body.should == "Hello World"
18
+ it 'perform_action_with_newrelic_trace' do
19
+ NewRelic::Agent::Instrumentation::Grape.any_instance
20
+ .should_receive(:perform_action_with_newrelic_trace)
21
+ .with(hash_including(path: 'GET hello'))
22
+ .and_yield
23
+
24
+ get '/hello'
25
+ expect(last_response.status).to eq 200
26
+ expect(last_response.body).to eq 'Hello World'
27
+ end
22
28
  end
23
29
 
24
- end
30
+ context 'api with version' do
31
+ context 'in path' do
32
+ before do
33
+ subject.version 'v1', using: :path
34
+
35
+ subject.get :hello do
36
+ 'Hello World'
37
+ end
38
+ end
25
39
 
40
+ it 'perform_action_with_newrelic_trace' do
41
+ NewRelic::Agent::Instrumentation::Grape.any_instance
42
+ .should_receive(:perform_action_with_newrelic_trace)
43
+ .with(hash_including(path: 'GET v1-hello'))
44
+ .and_yield
26
45
 
46
+ get '/v1/hello'
47
+
48
+ expect(last_response.status).to eq 200
49
+ expect(last_response.body).to eq 'Hello World'
50
+ end
51
+ end
52
+ end
53
+
54
+ end
metadata CHANGED
@@ -1,41 +1,41 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: newrelic-grape
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.1
4
+ version: 1.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Richard Huang
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-06-08 00:00:00.000000000 Z
11
+ date: 2014-07-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: grape
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
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
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: newrelic_rpm
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  description: newrelic instrument for grape
@@ -45,8 +45,8 @@ executables: []
45
45
  extensions: []
46
46
  extra_rdoc_files: []
47
47
  files:
48
- - .gitignore
49
- - .rspec
48
+ - ".gitignore"
49
+ - ".rspec"
50
50
  - CHANGELOG.md
51
51
  - Gemfile
52
52
  - LICENSE.txt
@@ -69,17 +69,17 @@ require_paths:
69
69
  - lib
70
70
  required_ruby_version: !ruby/object:Gem::Requirement
71
71
  requirements:
72
- - - '>='
72
+ - - ">="
73
73
  - !ruby/object:Gem::Version
74
74
  version: '0'
75
75
  required_rubygems_version: !ruby/object:Gem::Requirement
76
76
  requirements:
77
- - - '>='
77
+ - - ">="
78
78
  - !ruby/object:Gem::Version
79
79
  version: '0'
80
80
  requirements: []
81
81
  rubyforge_project:
82
- rubygems_version: 2.0.3
82
+ rubygems_version: 2.2.2
83
83
  signing_key:
84
84
  specification_version: 4
85
85
  summary: newrelic instrument for grape