alephant-logger-cloudwatch 1.0.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +18 -1
- data/lib/alephant/logger/cloudwatch.rb +4 -3
- data/lib/alephant/logger/cloudwatch/version.rb +1 -1
- data/spec/cloudwatch_spec.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0f769b58b65029c123878bdf032ff214241e7c99
|
4
|
+
data.tar.gz: 1462ccb150578b50aa37d32749d449b4146b7198
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 97285b71ffe34aae92ca3e8902d120f3848a49d5885dbe8dd426930b8500e917422f0dec11ce6719dc4488e0420050cabe56ae44c098d5cafb7f657c254bdc04
|
7
|
+
data.tar.gz: 0e48608a860720df121f666df5d57b7b80aceb04fdab7a841332e0c1464f5d54dbbee40fb0da4be6c3a6ca1a16c9b7bd0943dbb1c51cd864a996b67490575349
|
data/README.md
CHANGED
@@ -28,7 +28,24 @@ $ gem install alephant-logger-cloudwatch
|
|
28
28
|
require "alephant/logger"
|
29
29
|
require "alephant/logger/cloudwatch"
|
30
30
|
|
31
|
-
cloudwatch_driver = Alephant::Logger::CloudWatch.new "my_namespace"
|
31
|
+
cloudwatch_driver = Alephant::Logger::CloudWatch.new(:namespace => "my_namespace")
|
32
|
+
|
33
|
+
logger = Alephant::Logger.setup cloudwatch_driver
|
34
|
+
logger.metric(:name => "FooBar", :unit => "Count", :value => 1)
|
35
|
+
```
|
36
|
+
|
37
|
+
You can also prefill in certain values:
|
38
|
+
|
39
|
+
```ruby
|
40
|
+
require "alephant/logger"
|
41
|
+
require "alephant/logger/cloudwatch"
|
42
|
+
|
43
|
+
cloudwatch_driver = Alephant::Logger::CloudWatch.new(
|
44
|
+
:namespace => "my_namespace",
|
45
|
+
:unit => "Count",
|
46
|
+
:value => 1,
|
47
|
+
:dimensions => { :foo => "bar" }
|
48
|
+
)
|
32
49
|
|
33
50
|
logger = Alephant::Logger.setup cloudwatch_driver
|
34
51
|
logger.metric(:name => "FooBar", :unit => "Count", :value => 1)
|
@@ -8,13 +8,14 @@ module Alephant
|
|
8
8
|
@defaults = process_defaults opts
|
9
9
|
end
|
10
10
|
|
11
|
-
def metric(opts)
|
12
|
-
|
11
|
+
def metric(name, opts)
|
12
|
+
signature = [name] + opts.values_at(:value, :unit, :dimensions)
|
13
|
+
send_metric(*signature)
|
13
14
|
end
|
14
15
|
|
15
16
|
private
|
16
17
|
|
17
|
-
attr_reader :cloudwatch, :defaults
|
18
|
+
attr_reader :cloudwatch, :namespace, :defaults
|
18
19
|
|
19
20
|
def process_defaults(opts)
|
20
21
|
preset_defaults.reduce({}) do |acc, (key, value)|
|
data/spec/cloudwatch_spec.rb
CHANGED
@@ -3,12 +3,12 @@ require "alephant/logger/cloudwatch"
|
|
3
3
|
describe Alephant::Logger::CloudWatch do
|
4
4
|
subject { described_class.new(:namespace => "namespace") }
|
5
5
|
|
6
|
+
let(:name) { "a" }
|
6
7
|
let(:namespace) { "namespace" }
|
7
8
|
|
8
9
|
describe "#metric" do
|
9
10
|
let(:opts) do
|
10
11
|
{
|
11
|
-
:name => "a",
|
12
12
|
:value => "b",
|
13
13
|
:unit => "c",
|
14
14
|
:dimensions => {
|
@@ -39,7 +39,7 @@ describe Alephant::Logger::CloudWatch do
|
|
39
39
|
:metric_data => [metric_data]
|
40
40
|
)
|
41
41
|
|
42
|
-
subject.metric(opts).join
|
42
|
+
subject.metric(name, opts).join
|
43
43
|
end
|
44
44
|
end
|
45
45
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: alephant-logger-cloudwatch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- BBC News
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-03-
|
11
|
+
date: 2015-03-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|