class Fluent::AppendKubernetesAnnotationsToTag
Public Instance Methods
configure(conf)
click to toggle source
Calls superclass method
# File lib/fluent/plugin/out_append_kubernetes_annotations_to_tag.rb, line 10 def configure(conf) super @annotations = conf['annotations'].split(',') end
emit(tag, es, chain)
click to toggle source
# File lib/fluent/plugin/out_append_kubernetes_annotations_to_tag.rb, line 16 def emit(tag, es, chain) es.each do |time, record| new_tag = process_tag(tag, record) next if new_tag == tag router.emit(new_tag, time, record) end chain.next rescue => exception log.error "Failed to re-format docker record #{tag}" log.error exception log.error exception.backtrace # this seems to be a way to safely swallow records we don't know how to format "" end
Private Instance Methods
kubernetes_annotations_tag_appender()
click to toggle source
# File lib/fluent/plugin/out_append_kubernetes_annotations_to_tag.rb, line 46 def kubernetes_annotations_tag_appender @kubernetes_annotations_tag_appender ||= KubernetesAnnotationsTagAppender.new(@annotations) end
process_tag(tag, record)
click to toggle source
# File lib/fluent/plugin/out_append_kubernetes_annotations_to_tag.rb, line 36 def process_tag(tag, record) if record.has_key?('kubernetes') && record['kubernetes'].has_key?('annotations') kubernetes_annotations_tag_appender.append(tag, record['kubernetes']['annotations'], record['kubernetes']['container_name']) else tag end end