fluent-plugin-cadvisor 0.2.1 → 0.2.2

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: e3d8b3692b419d69ce14a45b7154d7f1e28d2a86
4
- data.tar.gz: 0d7f65745abee6a06ea690be92f2375ac4b80248
3
+ metadata.gz: 4f95eea068db5b25ff24eb37c74dfa039e6cc0db
4
+ data.tar.gz: 1aa56d3786f3bb54279ba48a217206c36fb3cdd0
5
5
  SHA512:
6
- metadata.gz: 1b06b7b754351f2c7298dd565245f244a82693e48b8587e7de52ac0f076046e161c15633a2d65eca95642050e488b3d0fe1996f6d6ef63a2a99654c6e6d3a597
7
- data.tar.gz: 3453ad3f3dce83a41a0a4d7b93526b3b1370ae8f9384a7ea3c5db5312d3fe7843614d307c1773afb1143fd38ffce2d06eaee914040f9d07a234da0f70d54616d
6
+ metadata.gz: 409c4ac8cb54280a251a3eb70932ab980b266c1927916d8f54c17fda4d8bb9de3e0f3c9bfdb92b00aefc0127689b1b48086129d88a2120135e81928c8ab624e3
7
+ data.tar.gz: ee88cae019e4406221493d133364d4a630553b20196dd6a9405d98365b35661e7858d9091d0517c2ab2e557c536c61bc732858bb151e3d94e3e359bd02f0556e
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "fluent-plugin-cadvisor"
7
- spec.version = "0.2.1"
7
+ spec.version = "0.2.2"
8
8
  spec.authors = ["Woorank"]
9
9
  spec.email = ["dev@woorank.com"]
10
10
  spec.summary = "cadvisor input plugin for Fluent event collector"
@@ -109,25 +109,25 @@ class CadvisorInput < Fluent::Input
109
109
 
110
110
  latest_timestamp = @dict[id] ||= 0
111
111
 
112
- # Order from
113
- rev_stats = res['stats'].reverse
114
-
115
- rev_stats.each_with_index do | stats, index |
116
- # Break if it's the last item
117
- # We need 2 items to create the percentage, in this case the prev will be
118
- # out of the array
119
- break if index == (rev_stats.count - 1)
112
+ # Remove already sent elements
113
+ res['stats'].reject! do | stats |
114
+ Time.parse(stats['timestamp']).to_i <= latest_timestamp
115
+ end
120
116
 
117
+ res['stats'].each_with_index do | stats, index |
121
118
  timestamp = Time.parse(stats['timestamp']).to_i
122
- # We already have stored these items
123
- break if timestamp < latest_timestamp
124
-
125
- @dict[id] = timestamp
119
+ # Break on last element
120
+ # We need 2 elements to create the percentage, in this case the prev will be
121
+ # out of the array
122
+ if index == (res['stats'].count - 1)
123
+ @dict[id] = timestamp
124
+ break
125
+ end
126
126
 
127
127
  num_cores = stats['cpu']['usage']['per_cpu_usage'].count
128
128
 
129
129
  # CPU percentage variables
130
- prev = rev_stats[index + 1];
130
+ prev = res['stats'][index + 1];
131
131
  raw_usage = stats['cpu']['usage']['total'] - prev['cpu']['usage']['total']
132
132
  interval_in_ns = get_interval(stats['timestamp'], prev['timestamp'])
133
133
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-cadvisor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Woorank
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-18 00:00:00.000000000 Z
11
+ date: 2014-11-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest_client