Class: Fluent::RavenOutput

Inherits:
BufferedOutput
  • Object
show all
Defined in:
lib/fluent/plugin/out_raven.rb

Instance Method Summary collapse

Instance Method Details

#configure(conf) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/fluent/plugin/out_raven.rb', line 14

def configure(conf)
  super

  @base_configuration = Raven::Configuration.new
  @base_configuration.server = conf['server']
  @base_configuration.public_key = 'not_used'
  @base_configuration.secret_key = 'not_used'
  @base_configuration.ssl_verification = conf['ssl_verification']
  @base_configuration.timeout = conf['timeout']
  @base_configuration.open_timeout = conf['open_timeout']

  if conf['raven_log_path'].nil?
    log.warn("`raven_log_level` is meaningless when `raven_log_path` isn't set")
  end

  Raven.configure do |config|
    config.logger = if conf['raven_log_path'].nil?
                      log
                    else
                      Logger.new(conf['raven_log_path'], log_level(conf['raven_log_level']))
                    end
  end
end

#format(tag, time, record) ⇒ Object



50
51
52
# File 'lib/fluent/plugin/out_raven.rb', line 50

def format(tag, time, record)
  [tag, time, record].to_msgpack
end

#multi_workers_ready?Boolean

Returns:

  • (Boolean)


38
39
40
# File 'lib/fluent/plugin/out_raven.rb', line 38

def multi_workers_ready?
  true
end

#shutdownObject



46
47
48
# File 'lib/fluent/plugin/out_raven.rb', line 46

def shutdown
  super
end

#startObject



42
43
44
# File 'lib/fluent/plugin/out_raven.rb', line 42

def start
  super
end

#write(chunk) ⇒ Object



54
55
56
57
58
59
60
61
62
# File 'lib/fluent/plugin/out_raven.rb', line 54

def write(chunk)
  chunk.msgpack_each do |tag, time, record|
    auth_header = record['auth_header']
    data        = record['data']
    options     = Hash[record['options'].map { |key, value| [key.to_sym, value] }] if record['options']
    project_id  = record['project_id']
    send_to_sentry(auth_header, data, project_id, options)
  end
end