Method: Fluent::Plugin::Graphite#init_client

Defined in:
lib/fluent/plugin/graphite.rb

#init_client(log_level, host, port) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/fluent/plugin/graphite.rb', line 26

def init_client(log_level, host, port)
  options = {
    # Required: valid URI {udp,tcp}://host:port/?timeout=seconds
    graphite: "tcp://#{host}:#{port}",

    # Optional: results are aggregated in 60 seconds slices ( default is 60 )
    slice: 30,

    # Optional: send to graphite every 60 seconds ( default is 0 - direct send )
    interval: 30,

    # Optional: set the max age in seconds for records reanimation ( default is 12 hours )
    cache: 4 * 60 * 60,
  }
  @client = GraphiteAPI.new options
  init_logger(log_level)
  log.info("Starting graphite client")
end