class Fluent::Plugin::SentryOutput
Public Instance Methods
create_sentry_event_ingestion_url()
click to toggle source
# File lib/fluent/plugin/out_sentry.rb, line 116 def create_sentry_event_ingestion_url "#{@ingest_url}/api/#{@project_id}/store/?sentry_key=#{@auth_token}&sentry_version=7" end
send_to_sentry(record, time)
click to toggle source
# File lib/fluent/plugin/out_sentry.rb, line 120 def send_to_sentry(record, time) event = SentryMessageFormat.new( record['timestamp'] || Time.at(time).to_i || Time.now.to_i, SecureRandom.hex(16), record['component_name'] || nil, record['environment'] || nil, record['commitId'] || nil, record['tags'] || nil, record['request'] || nil, record['exception'] || nil, record['platform'] || 'node', record['transaction'] || nil ) url = create_sentry_event_ingestion_url request_payload = event.to_json log.debug 'Sending payload - ', request_payload, ' to - ', url Net::HTTP.post(URI(url), request_payload) end
write(chunk)
click to toggle source
# File lib/fluent/plugin/out_sentry.rb, line 105 def write(chunk) chunk.each do |time, record| log.debug time, record begin send_to_sentry(record, time) rescue => e log.error 'Unable to send event to Sentry, Err class - ', e.class, ', error message - ', e.message, ', error backtrace - ', e.backtrace end end end