Class: InfluxDB::Metrics::Configuration
- Inherits:
-
Object
- Object
- InfluxDB::Metrics::Configuration
- Defined in:
- lib/influxdb/metrics/configuration.rb
Constant Summary collapse
- EVENTS =
{ action_controller: Controller, active_record: Model }
Instance Attribute Summary collapse
-
#app_name ⇒ Object
Returns the value of attribute app_name.
-
#async ⇒ Object
Returns the value of attribute async.
- #client ⇒ Object
-
#database ⇒ Object
Returns the value of attribute database.
-
#debug ⇒ Object
Returns the value of attribute debug.
-
#events ⇒ Object
Returns the value of attribute events.
-
#hosts ⇒ Object
Returns the value of attribute hosts.
-
#logger ⇒ Object
Returns the value of attribute logger.
-
#password ⇒ Object
Returns the value of attribute password.
-
#port ⇒ Object
Returns the value of attribute port.
-
#subscribed ⇒ Object
readonly
Returns the value of attribute subscribed.
-
#username ⇒ Object
Returns the value of attribute username.
Instance Method Summary collapse
- #host=(value) ⇒ Object
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #subscribe ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/influxdb/metrics/configuration.rb', line 27 def initialize @hosts = [] @app_name = 'rails' @username = 'root' @password = 'root' @database = 'rails' @port = 8086 @async = true @debug = false @events = EVENTS.values @subscribed = [] end |
Instance Attribute Details
#app_name ⇒ Object
Returns the value of attribute app_name.
16 17 18 |
# File 'lib/influxdb/metrics/configuration.rb', line 16 def app_name @app_name end |
#async ⇒ Object
Returns the value of attribute async.
19 20 21 |
# File 'lib/influxdb/metrics/configuration.rb', line 19 def async @async end |
#client ⇒ Object
57 58 59 60 61 62 63 64 65 66 |
# File 'lib/influxdb/metrics/configuration.rb', line 57 def client @client ||= InfluxDB::Client.new(database, hosts: hosts, username: username, password: password, port: port, async: async, debug: debug ) end |
#database ⇒ Object
Returns the value of attribute database.
15 16 17 |
# File 'lib/influxdb/metrics/configuration.rb', line 15 def database @database end |
#debug ⇒ Object
Returns the value of attribute debug.
18 19 20 |
# File 'lib/influxdb/metrics/configuration.rb', line 18 def debug @debug end |
#events ⇒ Object
Returns the value of attribute events.
24 25 26 |
# File 'lib/influxdb/metrics/configuration.rb', line 24 def events @events end |
#hosts ⇒ Object
Returns the value of attribute hosts.
12 13 14 |
# File 'lib/influxdb/metrics/configuration.rb', line 12 def hosts @hosts end |
#logger ⇒ Object
Returns the value of attribute logger.
23 24 25 |
# File 'lib/influxdb/metrics/configuration.rb', line 23 def logger @logger end |
#password ⇒ Object
Returns the value of attribute password.
14 15 16 |
# File 'lib/influxdb/metrics/configuration.rb', line 14 def password @password end |
#port ⇒ Object
Returns the value of attribute port.
17 18 19 |
# File 'lib/influxdb/metrics/configuration.rb', line 17 def port @port end |
#subscribed ⇒ Object (readonly)
Returns the value of attribute subscribed.
25 26 27 |
# File 'lib/influxdb/metrics/configuration.rb', line 25 def subscribed @subscribed end |
#username ⇒ Object
Returns the value of attribute username.
13 14 15 |
# File 'lib/influxdb/metrics/configuration.rb', line 13 def username @username end |
Instance Method Details
#host=(value) ⇒ Object
40 41 42 |
# File 'lib/influxdb/metrics/configuration.rb', line 40 def host=(value) hosts << value end |
#subscribe ⇒ Object
51 52 53 54 55 |
# File 'lib/influxdb/metrics/configuration.rb', line 51 def subscribe @subscribed = events.map do |event| event.new.tap(&:subscribe) end end |