lib/fluent/plugin/out_sentry.rb in ach-fluent-plugin-sentry-0.0.15 vs lib/fluent/plugin/out_sentry.rb in ach-fluent-plugin-sentry-0.0.16
- old
+ new
@@ -57,11 +57,13 @@
end
def write(chunk)
chunk.msgpack_each do |tag, time, record|
begin
- notify_sentry(tag, time, record)
+ if record['level'] == 'error'
+ notify_sentry(tag, time, record)
+ end
rescue => e
$log.error("Sentry Error:", :error_class => e.class, :error => e.message)
end
end
end
@@ -73,14 +75,16 @@
:configuration => @configuration,
:message => record['message']
)
event.timestamp = record['timestamp'] || Time.at(time).utc.strftime('%Y-%m-%dT%H:%M:%S')
event.level = record['level'] || @default_level
+ event.environment = record['clustername'] || 'my-test-environment'
+
#event.logger = record['logger'] || @default_logger
#event.culprit = record['culprit'] || nil
#event.server_name = record['server_name'] || @hostname
#event.release = record['release'] if record['release']
- event.tags = event.tags.merge({ :tag => tag }.merge(record['tags'] || {}))
+ event.tags = event.tags.merge({ :tag => tag }.merge(record['kubernetes'] || {}))
#event.extra = record.reject{ |key| EVENT_KEYS.include?(key) }
@client.send_event(event)
end
end