lib/fluent/plugin/out_dd.rb in fluent-plugin-dd-0.1.2 vs lib/fluent/plugin/out_dd.rb in fluent-plugin-dd-0.1.3
- old
+ new
@@ -5,10 +5,11 @@
define_method('log') { $log }
end
config_param :dd_api_key, :string
config_param :host, :string, :default => nil
+ config_param :use_fluentd_tag_for_datadog_tag, :bool, :default => false
def initialize
super
require 'dogapi'
require 'socket'
@@ -49,11 +50,16 @@
log.warn("`metric` key does not exist: #{[tag, time, record].inspect}")
end
record['metric']
}.chunk {|tag, time, record|
- tag = record['tag'] || tag
- [tag] + record.values_at('metric', 'host', 'type')
+ dd_tag = record['tag']
+
+ if not dd_tag and @use_fluentd_tag_for_datadog_tag
+ dd_tag = tag
+ end
+
+ [dd_tag] + record.values_at('metric', 'host', 'type')
}.each {|i, records|
tag, metric, host, type = i
points = records.map do |tag, time, record|
time = Time.at(time)