datadoge 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +22 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +16 -0
- data/README.md +29 -0
- data/Rakefile +2 -0
- data/datadoge.gemspec +25 -0
- data/lib/datadoge.rb +42 -0
- data/lib/datadoge/version.rb +3 -0
- metadata +95 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 7b9b954be7e251cc96214f6eb4bb9955c7736fb9
|
4
|
+
data.tar.gz: 7d4ed01c321a0aeb3c2e57fb9d5ca542c415284e
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 00be0831cdc1b0304780d5a08b8c6a6b7ea9b57d5a4b18b33b15bffc2eaf41f28a692a44dbc0d351526d85b10d1848bb780c9380f7a21b22930bb76fcad410ef
|
7
|
+
data.tar.gz: f6a8fae2cb4934765990a3a81aa1d9ec8bf5a7f5cb733c7bcb81f5b241abd666e6ff486dc74332587ca6e8d820f63b0ad5acfa3618d29ca969aa6c510204f8a7
|
data/.gitignore
ADDED
@@ -0,0 +1,22 @@
|
|
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
|
18
|
+
*.bundle
|
19
|
+
*.so
|
20
|
+
*.o
|
21
|
+
*.a
|
22
|
+
mkmf.log
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
Copyright 2014 Metova, Inc.
|
2
|
+
|
3
|
+
This product includes software developed at
|
4
|
+
Metova, Inc. (http://www.metova.com/).
|
5
|
+
|
6
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
+
you may not use this file except in compliance with the License.
|
8
|
+
You may obtain a copy of the License at
|
9
|
+
|
10
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
|
12
|
+
Unless required by applicable law or agreed to in writing, software
|
13
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
See the License for the specific language governing permissions and
|
16
|
+
limitations under the License.
|
data/README.md
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# Datadoge
|
2
|
+
|
3
|
+
TODO: Write a gem description
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'datadoge'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install datadoge
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
TODO: Write usage instructions here
|
22
|
+
|
23
|
+
## Contributing
|
24
|
+
|
25
|
+
1. Fork it ( https://github.com/[my-github-username]/datadoge/fork )
|
26
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
27
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
28
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
29
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
data/datadoge.gemspec
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'datadoge/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'datadoge'
|
8
|
+
spec.version = Datadoge::VERSION
|
9
|
+
spec.authors = ['Dave Lane']
|
10
|
+
spec.email = ['dave.lane@metova.com']
|
11
|
+
spec.summary = 'A simple integration of DataDog to report on Rails app performance.'
|
12
|
+
spec.description = 'This gem is notified of basic performance metrics for a Rails application, and sends the measurements to DataDog.'
|
13
|
+
spec.homepage = ''
|
14
|
+
spec.license = 'Apache'
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
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_development_dependency 'bundler', '~> 1.6'
|
22
|
+
spec.add_development_dependency 'rake', '~> 0'
|
23
|
+
|
24
|
+
spec.add_runtime_dependency 'dogstatsd-ruby', '~> 0'
|
25
|
+
end
|
data/lib/datadoge.rb
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
require "datadoge/version"
|
2
|
+
require "statsd"
|
3
|
+
|
4
|
+
module Datadoge
|
5
|
+
class Railtie < Rails::Railtie
|
6
|
+
initializer "datadoge.configure_rails_initialization" do |app|
|
7
|
+
$statsd = Statsd.new
|
8
|
+
|
9
|
+
ActiveSupport::Notifications.subscribe /process_action.action_controller/ do |*args|
|
10
|
+
event = ActiveSupport::Notifications::Event.new(*args)
|
11
|
+
controller = "controller:#{event.payload[:controller]}"
|
12
|
+
action = "action:#{event.payload[:action]}"
|
13
|
+
format = "format:#{event.payload[:format] || 'all'}"
|
14
|
+
format = "format:all" if format == "format:*/*"
|
15
|
+
host = "host:#{ENV['INSTRUMENTATION_HOSTNAME']}"
|
16
|
+
status = event.payload[:status]
|
17
|
+
tags = [controller, action, format, host]
|
18
|
+
ActiveSupport::Notifications.instrument :performance, :action => :timing, :tags => tags, :measurement => "request.total_duration", :value => event.duration
|
19
|
+
ActiveSupport::Notifications.instrument :performance, :action => :timing, :tags => tags, :measurement => "database.query.time", :value => event.payload[:db_runtime]
|
20
|
+
ActiveSupport::Notifications.instrument :performance, :action => :timing, :tags => tags, :measurement => "web.view.time", :value => event.payload[:view_runtime]
|
21
|
+
ActiveSupport::Notifications.instrument :performance, :tags => tags, :measurement => "request.status.#{status}"
|
22
|
+
end
|
23
|
+
|
24
|
+
ActiveSupport::Notifications.subscribe /performance/ do |name, start, finish, id, payload|
|
25
|
+
send_event_to_statsd(name, payload) if Rails.env == 'production'
|
26
|
+
end
|
27
|
+
|
28
|
+
def send_event_to_statsd(name, payload)
|
29
|
+
action = payload[:action] || :increment
|
30
|
+
measurement = payload[:measurement]
|
31
|
+
value = payload[:value]
|
32
|
+
tags = payload[:tags]
|
33
|
+
key_name = "#{name.to_s.capitalize}.#{measurement}"
|
34
|
+
if action == :increment
|
35
|
+
$statsd.increment key_name, :tags => tags
|
36
|
+
else
|
37
|
+
$statsd.histogram key_name, value, :tags => tags
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
metadata
ADDED
@@ -0,0 +1,95 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: datadoge
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Dave Lane
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-07-01 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.6'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.6'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: dogstatsd-ruby
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
description: This gem is notified of basic performance metrics for a Rails application,
|
56
|
+
and sends the measurements to DataDog.
|
57
|
+
email:
|
58
|
+
- dave.lane@metova.com
|
59
|
+
executables: []
|
60
|
+
extensions: []
|
61
|
+
extra_rdoc_files: []
|
62
|
+
files:
|
63
|
+
- ".gitignore"
|
64
|
+
- Gemfile
|
65
|
+
- LICENSE.txt
|
66
|
+
- README.md
|
67
|
+
- Rakefile
|
68
|
+
- datadoge.gemspec
|
69
|
+
- lib/datadoge.rb
|
70
|
+
- lib/datadoge/version.rb
|
71
|
+
homepage: ''
|
72
|
+
licenses:
|
73
|
+
- Apache
|
74
|
+
metadata: {}
|
75
|
+
post_install_message:
|
76
|
+
rdoc_options: []
|
77
|
+
require_paths:
|
78
|
+
- lib
|
79
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - ">="
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '0'
|
84
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - ">="
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '0'
|
89
|
+
requirements: []
|
90
|
+
rubyforge_project:
|
91
|
+
rubygems_version: 2.2.0
|
92
|
+
signing_key:
|
93
|
+
specification_version: 4
|
94
|
+
summary: A simple integration of DataDog to report on Rails app performance.
|
95
|
+
test_files: []
|