statsd-default_instrumentation 0.3.1 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +3 -3
- data/lib/statsd-default_instrumentation.rb +4 -1
- data/lib/statsd/default_instrumentation.rb +2 -0
- data/lib/statsd/default_instrumentation/action_controller.rb +1 -3
- data/lib/statsd/default_instrumentation/railtie.rb +13 -0
- data/lib/statsd/default_instrumentation/version.rb +2 -2
- metadata +6 -5
data/README.md
CHANGED
@@ -6,18 +6,18 @@ A set of instrumentation for Rails and common libraries.
|
|
6
6
|
Configuration
|
7
7
|
---
|
8
8
|
|
9
|
-
|
9
|
+
Rails 3 works out of the box. Other frameworks must run `StatsD::DefaultInstrumentation.detect!` after loading the app's libraries.
|
10
10
|
|
11
11
|
The following options are supported and are configured with `StatsD::DefaultInstrumentation.option = value`
|
12
12
|
|
13
|
-
* prefix: Sets the stat name prefix string. By default this
|
13
|
+
* prefix: Sets the stat name prefix string. By default this "rails_env.your_app_name" in Rails 3, or "default_instrumentation" in other frameworks.
|
14
14
|
|
15
15
|
Instrumentation
|
16
16
|
---
|
17
17
|
|
18
18
|
**ActionController**
|
19
19
|
|
20
|
-
* Count of
|
20
|
+
* Count of requests grouped by response code. Example: requests.200
|
21
21
|
|
22
22
|
**MemCache**
|
23
23
|
|
@@ -4,8 +4,6 @@ ActionController::Base.around_filter do |controller, action|
|
|
4
4
|
# Record requests per response code
|
5
5
|
StatsD.increment(
|
6
6
|
[StatsD::DefaultInstrumentation.prefix,
|
7
|
-
'
|
8
|
-
controller.params[:controller],
|
9
|
-
controller.params[:action],
|
7
|
+
'requests',
|
10
8
|
controller.response.status.to_i].join('.'))
|
11
9
|
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module StatsD
|
2
|
+
module DefaultInstrumentation
|
3
|
+
class Railtie < Rails::Railtie
|
4
|
+
initializer "default_instrumentation.detect" do
|
5
|
+
# Convert the application class name to a prefix.
|
6
|
+
# MyApp::Application -> my_app
|
7
|
+
StatsD::DefaultInstrumentation.prefix = Rails.env + "." + Rails.application.class.name.split('::').first.underscore
|
8
|
+
|
9
|
+
StatsD::DefaultInstrumentation.detect!
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: statsd-default_instrumentation
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 15
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 0.
|
8
|
+
- 4
|
9
|
+
- 0
|
10
|
+
version: 0.4.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Matt Griffin
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date:
|
18
|
+
date: 2012-02-29 00:00:00 -05:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -48,6 +48,7 @@ files:
|
|
48
48
|
- lib/statsd/default_instrumentation/action_controller.rb
|
49
49
|
- lib/statsd/default_instrumentation/memcache-client.rb
|
50
50
|
- lib/statsd/default_instrumentation/memcached.rb
|
51
|
+
- lib/statsd/default_instrumentation/railtie.rb
|
51
52
|
- lib/statsd/default_instrumentation/redis.rb
|
52
53
|
- lib/statsd/default_instrumentation/version.rb
|
53
54
|
has_rdoc: true
|