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 CHANGED
@@ -6,18 +6,18 @@ A set of instrumentation for Rails and common libraries.
6
6
  Configuration
7
7
  ---
8
8
 
9
- After loading your libraries run `StatsD::DefaultInstrumentation.detect!`. Rails apps should do this in an initializer.
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 is "default_instrumentation" but should be configured to something like "environment.application".
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 controller actions grouped by response code. Example: controllers.admin/users.create.200
20
+ * Count of requests grouped by response code. Example: requests.200
21
21
 
22
22
  **MemCache**
23
23
 
@@ -1 +1,4 @@
1
- require 'statsd/default_instrumentation'
1
+ require 'statsd/default_instrumentation'
2
+
3
+ # Rails 3 integration
4
+ require 'statsd/default_instrumentation/railtie' if defined?(::Rails) && defined?(::Rails::Railtie)
@@ -1,3 +1,5 @@
1
+ require 'statsd/instrument'
2
+
1
3
  module StatsD
2
4
  module DefaultInstrumentation
3
5
  class << self
@@ -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
- 'controllers',
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
@@ -2,8 +2,8 @@ module StatsD
2
2
  module DefaultInstrumentation
3
3
  module VERSION
4
4
  MAJOR = 0
5
- MINOR = 3
6
- PATCH = 1
5
+ MINOR = 4
6
+ PATCH = 0
7
7
 
8
8
  def self.to_s
9
9
  [MAJOR, MINOR, PATCH].join('.')
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: 17
4
+ hash: 15
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
- - 3
9
- - 1
10
- version: 0.3.1
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: 2011-11-10 00:00:00 -05:00
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