alephant-logger-cloudwatch 1.0.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 81122f72cb26f4f21e45ee98bfbc281c2c2373f5
4
- data.tar.gz: 7367511b1243204d05c6192ca6ea794b0eca353f
3
+ metadata.gz: 0f769b58b65029c123878bdf032ff214241e7c99
4
+ data.tar.gz: 1462ccb150578b50aa37d32749d449b4146b7198
5
5
  SHA512:
6
- metadata.gz: 3784052f95209ae004993c6727d79b3583aff1fda82dc156f702ad7d09ac331a97183c461ceeb6a628a90773ca94f9739883e0f1b8948b3adada59d7fd8a03aa
7
- data.tar.gz: 4fb871e9b4828188b10e84351b43d9cdc413957e570a02e21347009571fbc97c77323b86974966d014421b72f9088354712017b641ed24e9a99cdf01caaa0a23
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
- send_metric(*opts.values_at(:name, :value, :unit, :dimensions))
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)|
@@ -1,7 +1,7 @@
1
1
  module Alephant
2
2
  module Logger
3
3
  module Cloudwatch
4
- VERSION = "1.0.0"
4
+ VERSION = "2.0.0"
5
5
  end
6
6
  end
7
7
  end
@@ -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: 1.0.0
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-30 00:00:00.000000000 Z
11
+ date: 2015-03-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler