Class: RedisTimeSeriesClient

Inherits:
Object
  • Object
show all
Defined in:
lib/tailslide/redis_timeseries_client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#hostObject (readonly)

Returns the value of attribute host.



5
6
7
# File 'lib/tailslide/redis_timeseries_client.rb', line 5

def host
  @host
end

#portObject (readonly)

Returns the value of attribute port.



5
6
7
# File 'lib/tailslide/redis_timeseries_client.rb', line 5

def port
  @port
end

#redis_clientObject

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

#initObject



13
14
15
# File 'lib/tailslide/redis_timeseries_client.rb', line 13

def init
  self.redis_client = Redis.new(host: host, port: port)
end