grape-appsignal 0.0.1

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: 74d7029f307e7d9eb52b8ede0e98e93dbb69af34
4
+ data.tar.gz: 4461a3183bea9ef7e851e52faf8607df62ddfac7
5
+ SHA512:
6
+ metadata.gz: 4f63417ba0863aeb138206a4a560945a86cfae7a20b23ef9393e2cc436f8f72aceda37ab47cc622933e9f465cb898555cd6ddae46c844f0cba8ea20c95adc8e0
7
+ data.tar.gz: e81f3a9916a2f862a8b5a2cd214eb4c5c5107b3ef173159aa855ac0615ce88be1cd3097e59e0008b129c8913e97493d2016958767d01a3a8cbcc10c241041586
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --color
2
+ --format=documentation
3
+
data/.travis.yml ADDED
@@ -0,0 +1,6 @@
1
+ rvm:
2
+ - 2.1.0
3
+ - 2.0.0
4
+ - 1.9.3
5
+ - jruby
6
+ - rbx
data/CHANGELOG.md ADDED
@@ -0,0 +1,4 @@
1
+ ## Changelog
2
+
3
+ ### Version 0.0.1
4
+ * First commit. Yeah!
data/Gemfile ADDED
@@ -0,0 +1,19 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
4
+
5
+ group :development, :test do
6
+ gem 'coolline'
7
+ gem 'guard'
8
+ gem 'guard-rspec'
9
+ gem 'guard-bundler'
10
+ gem 'rb-fsevent'
11
+ gem 'terminal-notifier-guard'
12
+ gem 'json'
13
+ gem 'rspec'
14
+ gem 'github-markup'
15
+ gem 'rack-test'
16
+ gem 'rspec-expectations', '~> 2.14.0'
17
+ gem 'rspec-mocks', '~> 2.14.0'
18
+ gem 'listen', '~> 2.1'
19
+ end
data/Guardfile ADDED
@@ -0,0 +1,15 @@
1
+ # A sample Guardfile
2
+ # More info at https://github.com/guard/guard#readme
3
+
4
+ guard 'rspec', cmd: 'bundle exec rspec' do
5
+ watch(%r{^spec/.+_spec\.rb$})
6
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
7
+ watch(%r{^spec/support/shared_versioning_examples.rb$}) { |m| "spec/" }
8
+ watch('spec/spec_helper.rb') { "spec/" }
9
+ end
10
+
11
+
12
+ guard 'bundler' do
13
+ watch('Gemfile')
14
+ watch(/^.+\.gemspec/)
15
+ end
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013-2014 Mark Madsen
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,39 @@
1
+ # Appsignal::Grape
2
+
3
+ AppSignal intergation for [Grape][0], based on code from these [NewRelic][1] and [Liberato][2] gems.
4
+
5
+ [![Build Status](https://travis-ci.org/aai/grape-appsignal.png?branch=master)](http://travis-ci.org/aai/grape-appsignal)
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ gem 'grape-appsignal'
12
+
13
+ Or install:
14
+
15
+ $ gem install grape-appsignal
16
+
17
+ Include it in your Grape API like this
18
+
19
+ class TestAPI < Grape::API
20
+ use Appsignal::Grape::Middleware
21
+
22
+ get 'hello' do
23
+ "Hello World"
24
+ end
25
+ end
26
+
27
+ *Make sure you have already setup AppSignal for your app!*
28
+
29
+ ## Contributing
30
+
31
+ 1. Fork it
32
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
33
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
34
+ 4. Push to the branch (`git push origin my-new-feature`)
35
+ 5. Make a pull request
36
+
37
+ [0]: https://github.com/intridea/grape
38
+ [1]: https://github.com/flyerhzm/newrelic-grape
39
+ [2]: https://github.com/seanmoon/grape-librato
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,28 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'grape-appsignal/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "grape-appsignal"
8
+ spec.version = Appsignal::Grape::VERSION
9
+ spec.authors = ["Mark Madsen"]
10
+ spec.email = ["growl@agileanimal.com"]
11
+ spec.description = %q{appsignal integration for grape}
12
+ spec.summary = %q{appsignal integration for grape}
13
+ spec.homepage = "https://github.com/aai/grape-appsignal"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_dependency 'appsignal', '> 0.7'
22
+ spec.add_dependency 'grape', '> 0.6'
23
+
24
+
25
+ spec.add_development_dependency "bundler", "~> 1.5"
26
+ spec.add_development_dependency "rake"
27
+ spec.add_development_dependency 'rspec', '~> 2.14'
28
+ end
@@ -0,0 +1,21 @@
1
+ require 'grape'
2
+ require 'active_support'
3
+
4
+ module Appsignal
5
+ module Grape
6
+ class Middleware < ::Grape::Middleware::Base
7
+ def initialize(app)
8
+ @app = app
9
+ end
10
+
11
+ def call(env)
12
+ req = ::Rack::Request.new(env)
13
+ request_path = env['api.endpoint'].routes.first.route_path[1..-1].gsub(/\(\.:format\)\z/, "")
14
+ metric_name = "grape.api"
15
+ ActiveSupport::Notifications.instrument(metric_name, method: req.request_method, path: request_path) do
16
+ @app.call(env)
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,5 @@
1
+ module Appsignal
2
+ module Grape
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
@@ -0,0 +1,2 @@
1
+ require "grape-appsignal/version"
2
+ require "grape-appsignal/middleware"
@@ -0,0 +1,38 @@
1
+ require 'spec_helper'
2
+
3
+ describe Appsignal::Grape::Middleware do
4
+
5
+ class TestAPI < Grape::API
6
+ use Appsignal::Grape::Middleware
7
+ get 'hello/:name' do
8
+ "hello #{params['name']}"
9
+ end
10
+ end
11
+
12
+ def app; TestAPI; end
13
+
14
+ let(:event) { @events.pop }
15
+ subject { event.payload }
16
+
17
+ before(:all) do
18
+ @events = []
19
+ ActiveSupport::Notifications.subscribe('grape.api') do |*args|
20
+ @events << ActiveSupport::Notifications::Event.new(*args)
21
+ end
22
+ end
23
+
24
+ before(:each) do
25
+ get "/hello/mark"
26
+ end
27
+
28
+ it do
29
+ should == { method: "GET" , path: "hello/:name"}
30
+ end
31
+
32
+ context "" do
33
+ subject{ last_response }
34
+
35
+ its(:body){ should == "hello mark" }
36
+ its(:status){ should == 200 }
37
+ end
38
+ end
@@ -0,0 +1,7 @@
1
+ require 'spec_helper'
2
+
3
+ describe Appsignal::Grape do
4
+ it "has a version" do
5
+ Appsignal::Grape::VERSION.should_not be_nil
6
+ end
7
+ end
@@ -0,0 +1,11 @@
1
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
3
+
4
+ require 'rack/test'
5
+
6
+ RSpec.configure do |config|
7
+ config.include Rack::Test::Methods
8
+ end
9
+
10
+ require 'grape'
11
+ require 'grape-appsignal'
metadata ADDED
@@ -0,0 +1,134 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: grape-appsignal
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Mark Madsen
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-03-02 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: appsignal
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">"
18
+ - !ruby/object:Gem::Version
19
+ version: '0.7'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">"
25
+ - !ruby/object:Gem::Version
26
+ version: '0.7'
27
+ - !ruby/object:Gem::Dependency
28
+ name: grape
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">"
32
+ - !ruby/object:Gem::Version
33
+ version: '0.6'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">"
39
+ - !ruby/object:Gem::Version
40
+ version: '0.6'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.5'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.5'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '2.14'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '2.14'
83
+ description: appsignal integration for grape
84
+ email:
85
+ - growl@agileanimal.com
86
+ executables: []
87
+ extensions: []
88
+ extra_rdoc_files: []
89
+ files:
90
+ - ".gitignore"
91
+ - ".rspec"
92
+ - ".travis.yml"
93
+ - CHANGELOG.md
94
+ - Gemfile
95
+ - Guardfile
96
+ - LICENSE
97
+ - README.md
98
+ - Rakefile
99
+ - grape-appsignal.gemspec
100
+ - lib/grape-appsignal.rb
101
+ - lib/grape-appsignal/middleware.rb
102
+ - lib/grape-appsignal/version.rb
103
+ - spec/grape-appsignal/middleware_spec.rb
104
+ - spec/grape-appsignal/version_spec.rb
105
+ - spec/spec_helper.rb
106
+ homepage: https://github.com/aai/grape-appsignal
107
+ licenses:
108
+ - MIT
109
+ metadata: {}
110
+ post_install_message:
111
+ rdoc_options: []
112
+ require_paths:
113
+ - lib
114
+ required_ruby_version: !ruby/object:Gem::Requirement
115
+ requirements:
116
+ - - ">="
117
+ - !ruby/object:Gem::Version
118
+ version: '0'
119
+ required_rubygems_version: !ruby/object:Gem::Requirement
120
+ requirements:
121
+ - - ">="
122
+ - !ruby/object:Gem::Version
123
+ version: '0'
124
+ requirements: []
125
+ rubyforge_project:
126
+ rubygems_version: 2.0.14
127
+ signing_key:
128
+ specification_version: 4
129
+ summary: appsignal integration for grape
130
+ test_files:
131
+ - spec/grape-appsignal/middleware_spec.rb
132
+ - spec/grape-appsignal/version_spec.rb
133
+ - spec/spec_helper.rb
134
+ has_rdoc: