fluent-plugin-cloudwatch 1.2.12 → 1.2.13

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: 623454cb13e5f86266ed713a9a3887d0b641a123
4
- data.tar.gz: ba8b5303fdd6766782f9ab0714fe6fc7ef76d22f
3
+ metadata.gz: ae296984e54b2597b9e0f0679ad7fcad0f7beddb
4
+ data.tar.gz: 8eb7c5bf6b1295862bf29a49d4453004460dd483
5
5
  SHA512:
6
- metadata.gz: 7dfef965c1ceab2f8cbe2ff2d9be4cc83b9a724d94115a4f65cb9428bf2ccfab7f09a4fb4a699fb112e9b3ebe24c86a60a9da38df9e7b25aef8a14b20d17f1ef
7
- data.tar.gz: 1adefd4cdc57162c3a1f919cfaa88e83b568705792489a058aed0bda393572e8e62ee8f04645e011fa37e214851bf56d8892460d3cacc0b1ea7926d8f98aa078
6
+ metadata.gz: 516c936782937df0ec098c65648bab91714589443feb65de1610087bafbdf1a87277118d04351d6e3628d10315512b7bedd694e6ddb8ae44ef22900f4e2369e9
7
+ data.tar.gz: 1578db536832213d87a3a85af0eced90966fcd0e0090380b18efe02000faf55a94dd7fcae1c43ca6a9975bee4bfdbdcf4698007c5410e025a14d6d6b87dc64f1
data/.travis.yml CHANGED
@@ -1,10 +1,13 @@
1
1
  language: ruby
2
2
 
3
+ before_install:
4
+ - gem update bundler
5
+
3
6
  rvm:
4
- - 1.9.3
5
7
  - 2.0.0
6
- - 2.1
7
- - 2.2
8
+ - 2.1.8
9
+ - 2.2.4
10
+ - 2.3.0
8
11
 
9
12
  gemfile:
10
13
  - Gemfile
@@ -12,5 +15,7 @@ gemfile:
12
15
 
13
16
  matrix:
14
17
  exclude:
15
- - rvm: 2.2
18
+ - rvm: 2.2.4
19
+ gemfile: Gemfile.fluentd.0.10
20
+ - rvm: 2.3.0
16
21
  gemfile: Gemfile.fluentd.0.10
data/README.md CHANGED
@@ -207,6 +207,18 @@ Note: Billing requires the us-east-1 endpoint
207
207
  2014-01-20 20:12:00 +0900 cloudwatch: {"CachePercentUsed":95.15519175634687}
208
208
  ```
209
209
 
210
+ ## config: Complex metric_name
211
+
212
+ `metric_name` format is allowed as below.
213
+ - `MetricName`
214
+ - `MetricName:Statstics`
215
+
216
+ For example, this configuration fetches "Sum of RequestCount" and "Average of Latancy".
217
+
218
+ ```
219
+ metric_name RequestCount,Latency:Average
220
+ statistics Sum
221
+ ```
210
222
 
211
223
  ## config: delayed_start
212
224
 
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |gem|
6
6
  gem.name = "fluent-plugin-cloudwatch"
7
- gem.version = "1.2.12"
7
+ gem.version = "1.2.13"
8
8
  gem.authors = ["Yusuke Nomura", "kenjiskywalker", "FUJIWARA Shunichiro"]
9
9
  gem.email = ["yunomu@gmail.com", "git@kenjiskywalker.org", "fujiwara.shunichiro@gmail.com"]
10
10
  gem.description = %q{Input plugin for AWS CloudWatch.}
@@ -131,29 +131,27 @@ class Fluent::CloudwatchInput < Fluent::Input
131
131
 
132
132
  def output
133
133
  @metric_name.split(",").each {|m|
134
+ name, s = m.split(":")
135
+ s ||= @statistics
134
136
  now = Time.now - @offset
135
137
  statistics = @cw.get_metric_statistics({
136
138
  :namespace => @namespace,
137
- :metric_name => m,
138
- :statistics => [@statistics],
139
+ :metric_name => name,
140
+ :statistics => [s],
139
141
  :dimensions => @dimensions,
140
142
  :start_time => (now - @period*10).iso8601,
141
143
  :end_time => now.iso8601,
142
144
  :period => @period,
143
145
  })
144
146
  unless statistics[:datapoints].empty?
145
- stat = @statistics.downcase.to_sym
146
- datapoint = statistics[:datapoints].sort_by{|h| h[:timestamp]}.last
147
- data = datapoint[stat]
147
+ datapoint = statistics[:datapoints].sort_by{|h| h[:timestamp]}.first
148
+ data = datapoint[s.downcase.to_sym]
148
149
 
149
150
  # unix time
150
151
  catch_time = datapoint[:timestamp].to_i
151
-
152
- # no output_data.to_json
153
- output_data = {m => data}
154
- router.emit(tag, catch_time, output_data)
152
+ router.emit(tag, catch_time, { name => data })
155
153
  else
156
- log.warn "cloudwatch: #{@namespace} #{@dimensions_name} #{@dimensions_value} #{m} datapoints is empty"
154
+ log.warn "cloudwatch: #{@namespace} #{@dimensions_name} #{@dimensions_value} #{name} #{s} datapoints is empty"
157
155
  end
158
156
  }
159
157
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-cloudwatch
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.12
4
+ version: 1.2.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yusuke Nomura
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2015-12-04 00:00:00.000000000 Z
13
+ date: 2016-03-29 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: fluentd