Class: RedisTimeSeriesClient
- Inherits:
-
Object
- Object
- RedisTimeSeriesClient
- Defined in:
- lib/tailslide/redis_timeseries_client.rb
Instance Attribute Summary collapse
-
#host ⇒ Object
readonly
Returns the value of attribute host.
-
#port ⇒ Object
readonly
Returns the value of attribute port.
-
#redis_client ⇒ Object
Returns the value of attribute redis_client.
Instance Method Summary collapse
- #emit_signal(flag_id, app_id, status) ⇒ Object
- #init ⇒ Object
-
#initialize(host, port) ⇒ RedisTimeSeriesClient
constructor
A new instance of RedisTimeSeriesClient.
Constructor Details
#initialize(host, port) ⇒ RedisTimeSeriesClient
Returns a new instance of RedisTimeSeriesClient.
8 9 10 11 |
# File 'lib/tailslide/redis_timeseries_client.rb', line 8 def initialize(host, port) @host = host || 'localhost' @port = port || 6379 end |
Instance Attribute Details
#host ⇒ Object (readonly)
Returns the value of attribute host.
5 6 7 |
# File 'lib/tailslide/redis_timeseries_client.rb', line 5 def host @host end |
#port ⇒ Object (readonly)
Returns the value of attribute port.
5 6 7 |
# File 'lib/tailslide/redis_timeseries_client.rb', line 5 def port @port end |
#redis_client ⇒ Object
Returns the value of attribute redis_client.
6 7 8 |
# File 'lib/tailslide/redis_timeseries_client.rb', line 6 def redis_client @redis_client end |
Instance Method Details
#emit_signal(flag_id, app_id, status) ⇒ Object
17 18 19 20 |
# File 'lib/tailslide/redis_timeseries_client.rb', line 17 def emit_signal(flag_id, app_id, status) redis_client.ts_add(key: "#{flag_id}:#{status}", timestamp: '*', value: 1, labels: ['status', status, 'appId', app_id, 'flagId', flag_id]) end |
#init ⇒ Object
13 14 15 |
# File 'lib/tailslide/redis_timeseries_client.rb', line 13 def init self.redis_client = Redis.new(host: host, port: port) end |