grape-librato 1.0.0 → 1.1.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.
- data/.travis.yml +9 -0
- data/CHANGELOG.md +7 -0
- data/README.md +2 -0
- data/lib/grape-librato/middleware.rb +3 -1
- data/lib/grape-librato/version.rb +1 -1
- data/spec/grape-librato/middleware_spec.rb +3 -2
- metadata +19 -7
data/.travis.yml
ADDED
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -3,6 +3,8 @@
|
|
3
3
|
Librato tracking for [Grape][0], based on code from [this NewRelic
|
4
4
|
gem][1], using [librato-rack][2]
|
5
5
|
|
6
|
+
[](http://travis-ci.org/seanmoon/grape-librato)
|
7
|
+
|
6
8
|
## Installation
|
7
9
|
|
8
10
|
Add this line to your application's Gemfile:
|
@@ -11,7 +11,9 @@ module Librato
|
|
11
11
|
def call(env)
|
12
12
|
req = ::Rack::Request.new(env)
|
13
13
|
request_path = env['api.endpoint'].routes.first.route_path[1..-1].gsub("/", ".").sub(/\(\.:format\)\z/, "")
|
14
|
-
|
14
|
+
metric_name = "grape.#{req.request_method}.#{request_path}"
|
15
|
+
Librato.increment metric_name
|
16
|
+
Librato.timing "#{metric_name}.time" do
|
15
17
|
@app.call(env)
|
16
18
|
end
|
17
19
|
end
|
@@ -11,8 +11,9 @@ describe Librato::Grape::Middleware do
|
|
11
11
|
|
12
12
|
def app; TestAPI; end
|
13
13
|
|
14
|
-
it "should send
|
15
|
-
Librato.should_receive(:
|
14
|
+
it "should send an increment and timing event for each request" do
|
15
|
+
Librato.should_receive(:increment).with('grape.GET.hello.:name')
|
16
|
+
Librato.should_receive(:timing).with('grape.GET.hello.:name.time').and_yield
|
16
17
|
get "/hello/sean"
|
17
18
|
last_response.status.should == 200
|
18
19
|
last_response.body.should == "hello sean"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: grape-librato
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-04-
|
12
|
+
date: 2013-04-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: grape
|
16
|
-
requirement:
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,15 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements:
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
25
30
|
- !ruby/object:Gem::Dependency
|
26
31
|
name: librato-rack
|
27
|
-
requirement:
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
28
33
|
none: false
|
29
34
|
requirements:
|
30
35
|
- - ! '>='
|
@@ -32,7 +37,12 @@ dependencies:
|
|
32
37
|
version: '0'
|
33
38
|
type: :runtime
|
34
39
|
prerelease: false
|
35
|
-
version_requirements:
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
36
46
|
description: librato metrics for grape
|
37
47
|
email:
|
38
48
|
- ssamoon@ucla.edu
|
@@ -42,6 +52,7 @@ extra_rdoc_files: []
|
|
42
52
|
files:
|
43
53
|
- .gitignore
|
44
54
|
- .rspec
|
55
|
+
- .travis.yml
|
45
56
|
- CHANGELOG.md
|
46
57
|
- Gemfile
|
47
58
|
- LICENSE
|
@@ -74,7 +85,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
74
85
|
version: '0'
|
75
86
|
requirements: []
|
76
87
|
rubyforge_project:
|
77
|
-
rubygems_version: 1.8.
|
88
|
+
rubygems_version: 1.8.25
|
78
89
|
signing_key:
|
79
90
|
specification_version: 3
|
80
91
|
summary: librato metrics for grape
|
@@ -82,3 +93,4 @@ test_files:
|
|
82
93
|
- spec/grape-librato/middleware_spec.rb
|
83
94
|
- spec/grape-librato/version_spec.rb
|
84
95
|
- spec/spec_helper.rb
|
96
|
+
has_rdoc:
|