metriks-dogstatsd 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +23 -0
- data/README.md +30 -0
- data/lib/metriks/reporter/dogstatsd.rb +4 -4
- data/lib/metriks/reporter/dogstatsd/version.rb +1 -1
- metadata +3 -1
data/LICENSE
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
Derived in part from metriks at https://github.com/eric/metriks
|
2
|
+
Copyright (c) 2012 Eric Lindvall
|
3
|
+
Used under conditions described by the MIT License in LICENSE
|
4
|
+
|
5
|
+
metriks-dogstatsd Copyright (c) 2012 Mavenlink, Inc.
|
6
|
+
|
7
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
8
|
+
this software and associated documentation files (the "Software"), to deal in the
|
9
|
+
Software without restriction, including without limitation the rights to use, copy,
|
10
|
+
modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
|
11
|
+
and to permit persons to whom the Software is furnished to do so, subject to the
|
12
|
+
following conditions:
|
13
|
+
|
14
|
+
The above copyright notice and this permission notice shall be included in all copies
|
15
|
+
or substantial portions of the Software.
|
16
|
+
|
17
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
18
|
+
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
19
|
+
PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
21
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
22
|
+
USE OR OTHER DEALINGS IN THE SOFTWARE.
|
23
|
+
|
data/README.md
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# Metriks DogStatsd Reporter
|
2
|
+
|
3
|
+
This reporter is used with the metriks gem to enable
|
4
|
+
reporting metriks statistics to DogStatsd.
|
5
|
+
|
6
|
+
# Installing
|
7
|
+
|
8
|
+
To install, add this to your `Gemfile`:
|
9
|
+
|
10
|
+
``` ruby
|
11
|
+
gem 'metriks-dogstatsd'
|
12
|
+
```
|
13
|
+
|
14
|
+
and re-run `bundle`.
|
15
|
+
|
16
|
+
# Usage
|
17
|
+
|
18
|
+
Initialize the DogStatsd reporter class:
|
19
|
+
|
20
|
+
``` ruby
|
21
|
+
reporter = Metriks::Reporter::DogStatsd.new 'localhost', 8125
|
22
|
+
reporter.start
|
23
|
+
```
|
24
|
+
|
25
|
+
Use metriks as normal:
|
26
|
+
|
27
|
+
``` ruby
|
28
|
+
counter = Metriks.counter('calls')
|
29
|
+
counter.increment
|
30
|
+
```
|
@@ -7,15 +7,15 @@ module Metriks::Reporter
|
|
7
7
|
|
8
8
|
attr_reader :client
|
9
9
|
|
10
|
-
def initialize host, port, options={}
|
10
|
+
def initialize host = 'localhost', port = 8125, options={}
|
11
11
|
|
12
12
|
@client = Statsd.new(host, port)
|
13
13
|
|
14
14
|
@prefix = options[:prefix]
|
15
15
|
|
16
16
|
@registry = options[:registry] || Metriks::Registry.default
|
17
|
-
@interval = options[:interval] ||
|
18
|
-
@timeout_seconds = options[:timeout_seconds] ||
|
17
|
+
@interval = options[:interval] || 5 # Seconds
|
18
|
+
@timeout_seconds = options[:timeout_seconds] || 4 # Seconds
|
19
19
|
@on_error = options[:on_error] || proc{|exception| } # by default, do nothing and just reconnect to the backend
|
20
20
|
Statsd.logger = options[:logger]
|
21
21
|
|
@@ -146,4 +146,4 @@ module Metriks::Reporter
|
|
146
146
|
end
|
147
147
|
end
|
148
148
|
|
149
|
-
require 'metriks/reporter/dogstatsd/version'
|
149
|
+
require 'metriks/reporter/dogstatsd/version'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: metriks-dogstatsd
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -86,6 +86,8 @@ files:
|
|
86
86
|
- .rvmrc
|
87
87
|
- Gemfile
|
88
88
|
- Gemfile.lock
|
89
|
+
- LICENSE
|
90
|
+
- README.md
|
89
91
|
- Rakefile
|
90
92
|
- lib/metriks-dogstatsd.rb
|
91
93
|
- lib/metriks/reporter/dogstatsd.rb
|