lib/fluent/plugin/in_cadvisor.rb in fluent-plugin-cadvisor-0.2.2 vs lib/fluent/plugin/in_cadvisor.rb in fluent-plugin-cadvisor-0.2.3

- old
+ new

@@ -1,6 +1,7 @@ require 'rest_client' +require 'digest/sha1' require 'time' class CadvisorInput < Fluent::Input class TimerWatcher < Coolio::TimerWatcher @@ -130,9 +131,10 @@ prev = res['stats'][index + 1]; raw_usage = stats['cpu']['usage']['total'] - prev['cpu']['usage']['total'] interval_in_ns = get_interval(stats['timestamp'], prev['timestamp']) record = { + 'id' => Digest::SHA1.hexdigest("#{obj[:name]}#{id}#{timestamp.to_s}"), 'container_id' => id, 'image' => obj[:name], 'memory_current' => stats['memory']['usage'], 'memory_limit' => memory_limit, 'cpu_usage' => raw_usage,