Method: PMetric::Configuration#initialize
- Defined in:
- lib/pmetric/configuration.rb
#initialize ⇒ Configuration
Returns a new instance of Configuration.
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/pmetric/configuration.rb', line 19 def initialize @host = ENV.fetch('INFLUXDB_HOST', 'influxdb.500friends.com'.freeze) @port = ENV.fetch('INFLUXDB_PORT', 8086) @username = ENV.fetch('INFLUXDB_USERNAME', nil) @password = ENV.fetch('INFLUXDB_PASSWORD', nil) @database = ENV.fetch('INFLUXDB_DATABASE', 'prism'.freeze) @time_precision = 'ns'.freeze @retry = 10 @use_ssl = false # Logging is off by default @logger = false # PMetric must be intentionally enabled @collector = :noop # Async options @async = { # InfluxDB async writer uses a custom ruby Queue to keep track of # pending points, and this specifies the max number of items the queue # will allow. Anything greater will just drop off. max_queue_size: 10_000, # Number of post points to write at once. For a full queue with a max # size of 10_000, and a max post points of 1_000, it will take 10 batch # calls to post all the data. max_post_points: 1_000, # Number of Threads emptying the async queue. This will be per-process, # as the collector is shared globally. num_worker_threads: 2, # Time each thread waits to check for new points. The InfluxDB client # will actually sleep at `rand(sleep_interval)`, fyi. sleep_interval: 5 } # Default to no udp_port. Setting udp_port && udp_host enables UDP on. @udp_host = ENV.fetch('INFLUXDB_UDP_HOST', @host) @udp_port = ENV.fetch('INFLUXDB_UDP_PORT', nil) # Default Event Tags @default_tags = nil end |