class Fluent::AppdynamicsInput::RedisStateStore

Class store in redis

Public Class Methods

new(path,tag) click to toggle source
# File lib/fluent/plugin/in_appdynamics.rb, line 87
def initialize(path,tag)
  state_key=tag
  #redis_server = $appsettings['redis_server']
  #redis_port = $appsettings['redis_port']
  #redis_spectrum_key = $appsettings['redis_spectrum_key']
  #####
  require 'redis'
  $redis = if File.exists?(path)
          redis_config = YAML.load_file(path)
          # Connect to Redis using the redis_config host and port
          if path
              begin
                  pp "In redis #{path} Host #{redis_config['host']} port #{redis_config['port']}"
                  $redis = Redis.new(host: redis_config['host'], port: redis_config['port'])
              rescue Exception => e
                  $log.info e.message
                  $log.info e.backtrace.inspect
              end
          end
  else
          Redis.new
  end
  @data = {}
end

Public Instance Methods

last_records(tag=nil) click to toggle source
# File lib/fluent/plugin/in_appdynamics.rb, line 112
def last_records(tag=nil)
  begin
     alertStart=$redis.get(tag)
     return alertStart
  rescue Exception => e
     $log.info e.message
     $log.info e.backtrace.inspect
  end
end
update_records(time, tag=nil) click to toggle source
# File lib/fluent/plugin/in_appdynamics.rb, line 122
def update_records(time, tag=nil)
  begin
     alertStart=$redis.set(tag,time)
  rescue Exception => e
     $log.info e.message
     $log.info e.backtrace.inspect
  end
end