metriks-addons 3.1.1 → 3.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +15 -0
- data/NOTICE +2 -0
- data/README.md +46 -14
- data/Rakefile +15 -0
- data/lib/metriks-addons.rb +16 -1
- data/lib/metriks-addons/base_reporter.rb +14 -0
- data/lib/metriks-addons/cloudwatch_reporter.rb +15 -0
- data/lib/metriks-addons/opentsdb_reporter.rb +15 -0
- data/lib/metriks-addons/signalfx_reporter.rb +16 -1
- data/metriks-addons.gemspec +19 -3
- data/spec/cloudwatch_spec.rb +15 -0
- data/spec/opentsdb_spec.rb +15 -0
- data/spec/signalfx_spec.rb +20 -5
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2285af2f22ebdaf11723b9540d1068f3e7af7f27
|
4
|
+
data.tar.gz: 7e7091d57a8824e73b3d4f6b8dd350496cbe9dd6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 57eea536cb3094f49d38e83dd17291068c7ef228928c8cedbcaf203c26f25d201526e337025fa69492e9e7578d86db0b63691c1ded1f244a1a2d16d1fd9fdcb2
|
7
|
+
data.tar.gz: 1218d9cb65f11b3664b0988fe4017e934c02ea05b27d1326b44e6407bc61351960bc243bc96dd1de4808050c0c48bcb8bf12d5f0567a160d399a8dd2ddc8807d
|
data/Gemfile
CHANGED
@@ -1,3 +1,18 @@
|
|
1
|
+
##
|
2
|
+
# Copyright (c) 2015. Qubole Inc
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
#
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
14
|
+
##
|
15
|
+
|
1
16
|
source 'https://rubygems.org'
|
2
17
|
|
3
18
|
gemspec
|
data/NOTICE
ADDED
data/README.md
CHANGED
@@ -1,26 +1,58 @@
|
|
1
|
-
#
|
1
|
+
# Utilities for collecting metrics in a Rails Application
|
2
2
|
|
3
|
-
[![Build Status](https://travis-ci.org/
|
3
|
+
[![Build Status](https://travis-ci.org/qubole/metriks-addons.svg)](https://travis-ci.org/qubole/metriks-addons)
|
4
4
|
|
5
|
-
This
|
6
|
-
|
7
|
-
|
8
|
-
|
5
|
+
This gem provides utilities for collecting and reporting metrics
|
6
|
+
in a Rails Application. This gem uses [metriks](https://github.com/eric/metriks).
|
7
|
+
|
8
|
+
The first category of utilities is Reporters.
|
9
9
|
|
10
|
-
##
|
10
|
+
## Reporters
|
11
|
+
Reporters are available for OpenTSDB, SignalFX and AWS Cloudwatch.
|
12
|
+
The design is heavily inspired by
|
13
|
+
[Librato Reporter] (https://github.com/eric/metriks-librato_metrics)
|
11
14
|
|
12
|
-
|
15
|
+
### OpenTSDBReporter
|
13
16
|
|
14
17
|
``` ruby
|
15
|
-
reporter = Metriks::OpenTSDBReporter.new(host,
|
18
|
+
reporter = Metriks::OpenTSDBReporter.new(host, tags, options)
|
16
19
|
reporter.start
|
17
20
|
```
|
18
21
|
1. host: hostname of OpenTSDB
|
19
|
-
2.
|
20
|
-
3.
|
22
|
+
2. tags: A hash of tags that should be associated with every metric.
|
23
|
+
3. options: A hash to control behavior of the reporter. Valid options are:
|
24
|
+
|
25
|
+
### SignalFXReporter
|
26
|
+
|
27
|
+
``` ruby
|
28
|
+
reporter = Metriks::SignalFXReporter.new(token, tags, options = {})
|
29
|
+
reporter.start
|
30
|
+
```
|
31
|
+
|
32
|
+
1. token: Token provided by SignalFX
|
33
|
+
2. tags: A hash of tags that should be associated with every metric.
|
34
|
+
|
35
|
+
### CloudWatchReporter
|
36
|
+
|
37
|
+
``` ruby
|
38
|
+
reporter = Metriks::CloudWatchReporter.new((access_key, secret_key, namespace, tags, options = {}))
|
39
|
+
reporter.start
|
40
|
+
```
|
41
|
+
|
42
|
+
1. access_key: Access Key provided by AWS
|
43
|
+
2. secret_key: Secret Key provided by AWS
|
44
|
+
3. namespace: AWS CloudWatch namespace of the metric
|
45
|
+
4. tags: A hash of tags that should be associated with every metric.
|
21
46
|
|
22
|
-
|
47
|
+
### Options
|
23
48
|
|
24
|
-
|
49
|
+
All reporters accept a hash of options. Options are used to control the behavior
|
50
|
+
of the reporter.
|
25
51
|
|
26
|
-
|
52
|
+
| Option | Description (Default)|
|
53
|
+
---------|----------------------|
|
54
|
+
| prefix | Add a prefix to the metric name ()|
|
55
|
+
| batch_size | Number of metrics to report in a API call (50)|
|
56
|
+
| logger | Logger for debug and info messages (nil) |
|
57
|
+
| registry | Metriks::Registry to use. (Metriks::Registry.default) |
|
58
|
+
| interval | Interval between two runs (60 secs) |
|
data/Rakefile
CHANGED
@@ -1,3 +1,18 @@
|
|
1
|
+
##
|
2
|
+
# Copyright (c) 2015. Qubole Inc
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
#
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
14
|
+
##
|
15
|
+
|
1
16
|
require 'rubygems'
|
2
17
|
require 'rake'
|
3
18
|
require 'date'
|
data/lib/metriks-addons.rb
CHANGED
@@ -1,7 +1,22 @@
|
|
1
|
+
##
|
2
|
+
# Copyright (c) 2015. Qubole Inc
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
#
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
14
|
+
##
|
15
|
+
|
1
16
|
require_relative 'metriks-addons/opentsdb_reporter'
|
2
17
|
require_relative 'metriks-addons/signalfx_reporter'
|
3
18
|
require_relative 'metriks-addons/cloudwatch_reporter'
|
4
19
|
|
5
20
|
module MetriksAddons
|
6
|
-
VERSION = '3.1.
|
21
|
+
VERSION = '3.1.2'
|
7
22
|
end
|
@@ -1,3 +1,17 @@
|
|
1
|
+
##
|
2
|
+
# Copyright (c) 2015. Qubole Inc
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
#
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
14
|
+
##
|
1
15
|
module MetriksAddons
|
2
16
|
class BaseReporter
|
3
17
|
def initialize(options = {})
|
@@ -1,3 +1,18 @@
|
|
1
|
+
##
|
2
|
+
# Copyright (c) 2015. Qubole Inc
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
#
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
14
|
+
##
|
15
|
+
|
1
16
|
require 'metriks/time_tracker'
|
2
17
|
require 'logger'
|
3
18
|
require 'aws'
|
@@ -1,3 +1,18 @@
|
|
1
|
+
##
|
2
|
+
# Copyright (c) 2015. Qubole Inc
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
#
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
14
|
+
##
|
15
|
+
|
1
16
|
require 'metriks/time_tracker'
|
2
17
|
require 'rest-client'
|
3
18
|
require 'logger'
|
@@ -1,3 +1,18 @@
|
|
1
|
+
##
|
2
|
+
# Copyright (c) 2015. Qubole Inc
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
#
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
14
|
+
##
|
15
|
+
|
1
16
|
require 'metriks/time_tracker'
|
2
17
|
require 'logger'
|
3
18
|
require 'signalfx'
|
@@ -49,7 +64,7 @@ module MetriksAddons
|
|
49
64
|
:count
|
50
65
|
]
|
51
66
|
when Metriks::Counter
|
52
|
-
|
67
|
+
gauge |= create_datapoints name, metric, time, [
|
53
68
|
:count
|
54
69
|
]
|
55
70
|
when Metriks::Gauge
|
data/metriks-addons.gemspec
CHANGED
@@ -1,3 +1,18 @@
|
|
1
|
+
##
|
2
|
+
# Copyright (c) 2015. Qubole Inc
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
#
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
14
|
+
##
|
15
|
+
|
1
16
|
## This is the rakegem gemspec template. Make sure you read and understand
|
2
17
|
## all of the comments. Some sections require modification, and others can
|
3
18
|
## be deleted if you don't need them. Once you understand the contents of
|
@@ -13,8 +28,8 @@ Gem::Specification.new do |s|
|
|
13
28
|
## If your rubyforge_project name is different, then edit it and comment out
|
14
29
|
## the sub! line in the Rakefile
|
15
30
|
s.name = 'metriks-addons'
|
16
|
-
s.version = '3.1.
|
17
|
-
s.date = '2015-
|
31
|
+
s.version = '3.1.2'
|
32
|
+
s.date = '2015-12-23'
|
18
33
|
|
19
34
|
## Make sure your summary is short. The description may be as long
|
20
35
|
## as you like.
|
@@ -49,7 +64,7 @@ Gem::Specification.new do |s|
|
|
49
64
|
s.add_runtime_dependency 'metriks', '~> 0.9', '>= 0.9.9.7'
|
50
65
|
s.add_runtime_dependency 'rest-client', '>= 1.6.7'
|
51
66
|
s.add_runtime_dependency 'signalfx', '>= 0.1.0'
|
52
|
-
|
67
|
+
|
53
68
|
## List your development dependencies here. Development dependencies are
|
54
69
|
## those that are only needed during development
|
55
70
|
s.add_development_dependency('mocha', ['~> 0.10'])
|
@@ -61,6 +76,7 @@ Gem::Specification.new do |s|
|
|
61
76
|
s.files = %w[
|
62
77
|
Gemfile
|
63
78
|
LICENSE
|
79
|
+
NOTICE
|
64
80
|
README.md
|
65
81
|
Rakefile
|
66
82
|
lib/metriks-addons.rb
|
data/spec/cloudwatch_spec.rb
CHANGED
@@ -1,3 +1,18 @@
|
|
1
|
+
##
|
2
|
+
# Copyright (c) 2015. Qubole Inc
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
#
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
14
|
+
##
|
15
|
+
|
1
16
|
require 'webmock/rspec'
|
2
17
|
require 'metriks'
|
3
18
|
require 'metriks-addons/cloudwatch_reporter'
|
data/spec/opentsdb_spec.rb
CHANGED
@@ -1,3 +1,18 @@
|
|
1
|
+
##
|
2
|
+
# Copyright (c) 2015. Qubole Inc
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
#
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
14
|
+
##
|
15
|
+
|
1
16
|
require 'webmock/rspec'
|
2
17
|
require 'metriks'
|
3
18
|
require 'metriks-addons/opentsdb_reporter'
|
data/spec/signalfx_spec.rb
CHANGED
@@ -1,3 +1,18 @@
|
|
1
|
+
##
|
2
|
+
# Copyright (c) 2015. Qubole Inc
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
#
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
14
|
+
##
|
15
|
+
|
1
16
|
require 'webmock/rspec'
|
2
17
|
require 'metriks'
|
3
18
|
require 'metriks-addons/signalfx_reporter'
|
@@ -33,11 +48,11 @@ describe "Smoke test" do
|
|
33
48
|
it "counters" do
|
34
49
|
@registry.counter('counter.testing').increment
|
35
50
|
datapoints = @reporter.get_datapoints
|
36
|
-
expect(datapoints[:
|
37
|
-
expect(datapoints[:
|
38
|
-
expect(datapoints[:
|
39
|
-
expect(datapoints[:
|
40
|
-
expect(datapoints[:
|
51
|
+
expect(datapoints[:gauges].size).to eql(1)
|
52
|
+
expect(datapoints[:gauges][0][:metric]).to eql("counter.testing.count")
|
53
|
+
expect(datapoints[:gauges][0][:value]).to eql(1)
|
54
|
+
expect(datapoints[:gauges][0][:dimensions]).to include(:env => "test")
|
55
|
+
expect(datapoints[:gauges][0][:timestamp]).not_to be_nil
|
41
56
|
end
|
42
57
|
|
43
58
|
it "timer" do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: metriks-addons
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.1.
|
4
|
+
version: 3.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rajat Venkatesh
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-12-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: metriks
|
@@ -82,6 +82,7 @@ extra_rdoc_files:
|
|
82
82
|
files:
|
83
83
|
- Gemfile
|
84
84
|
- LICENSE
|
85
|
+
- NOTICE
|
85
86
|
- README.md
|
86
87
|
- Rakefile
|
87
88
|
- lib/metriks-addons.rb
|
@@ -113,7 +114,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
113
114
|
version: '0'
|
114
115
|
requirements: []
|
115
116
|
rubyforge_project:
|
116
|
-
rubygems_version: 2.4.
|
117
|
+
rubygems_version: 2.4.6
|
117
118
|
signing_key:
|
118
119
|
specification_version: 2
|
119
120
|
summary: Reporters for Metriks.
|