<commit_before>module Air
  Revision = `git log --pretty=format:'%h' -n 1`

  def self.config
    Settings
  end

  @@cloud_clients = {}
  @@monitoring_clients = {'null' => Monitoring::NullClient.new}
  @@metrics_store_clients = {'null' => Monitoring::NullMetricsStore.new}

  def self.register_cloud_client(site_id, cloud_client)
    @@cloud_clients[site_id] = {timestamp: Time.now, client: cloud_client}
  end

  def self.unregister_cloud_client(site_id)
    @@cloud_clients.delete(site_id)
  end

  def self.get_cloud_client(site_id)
    (@@cloud_clients[site_id] && (Time.now - @@cloud_clients[site_id][:timestamp]) < 23.hours) ? @@cloud_clients[site_id][:client] : nil
  end

  def self.action_logger
    @@action_logger ||= Logger.new(Rails.root.join('log', 'user_actions.log'))
  end

  def self.monitoring_logger
    @@monitoring_logger ||= Logger.new(Rails.root.join('log', 'monitoring.log'))
  end

  def self.optimizer_logger
    @@optimizer_logger ||= Logger.new(Rails.root.join('log', 'optimizer.log'))
  end

  def self.monitoring_client
    if config['zabbix']
      if @@monitoring_clients['zabbix']
        @@monitoring_clients['zabbix']
      else
        client = Monitoring::ZabbixClient.new
        @@monitoring_clients['zabbix'] = client
        client
      end
    else
      @@monitoring_clients['null']
    end
  end

  def self.metrics_store
    if config['influxdb']
      if @@metrics_store_clients['influxdb'] && @@metrics_store_clients['influxdb']['client'] && (Time.now - @@metrics_store_clients['influxdb']['timestamp']) < 60.minutes
        @@metrics_store_clients['influxdb']['client']
      else
        client = Monitoring::InfluxdbMetricsStore.new(config['influxdb'])
        @@metrics_store_clients['influxdb'] = {}
        @@metrics_store_clients['influxdb']['client'] = client
        @@metrics_store_clients['influxdb']['timestamp'] = Time.now
        client
      end
    else
      @@metrics_store_clients['null']
    end
  end

end<commit_msg>for static methods only one @ is enough<commit_after>require 'cache_entry'

module Air
  Revision = `git log --pretty=format:'%h' -n 1`

  def self.config
    Settings
  end

  @cloud_clients = {}
  @monitoring_clients = {'null' => Monitoring::NullClient.new}
  @metrics_store_clients = {'null' => Monitoring::NullMetricsStore.new}

  def self.register_cloud_client(site_id, cloud_client)
    @cloud_clients[site_id] = {timestamp: Time.now, client: cloud_client}
  end

  def self.unregister_cloud_client(site_id)
    @cloud_clients.delete(site_id)
  end

  def self.get_cloud_client(site_id)
    (@cloud_clients[site_id] && (Time.now - @cloud_clients[site_id][:timestamp]) < 23.hours) ? @cloud_clients[site_id][:client] : nil
  end

  def self.action_logger
    @action_logger ||= Logger.new(Rails.root.join('log', 'user_actions.log'))
  end

  def self.monitoring_logger
    @monitoring_logger ||= Logger.new(Rails.root.join('log', 'monitoring.log'))
  end

  def self.optimizer_logger
    @optimizer_logger ||= Logger.new(Rails.root.join('log', 'optimizer.log'))
  end

  def self.monitoring_client
    if config['zabbix']
      if @monitoring_clients['zabbix']
        @monitoring_clients['zabbix']
      else
        client = Monitoring::ZabbixClient.new
        @monitoring_clients['zabbix'] = client
        client
      end
    else
      @monitoring_clients['null']
    end
  end

  def self.metrics_store
    if config['influxdb']
      if @metrics_store_clients['influxdb'] && @metrics_store_clients['influxdb']['client'] && (Time.now - @metrics_store_clients['influxdb']['timestamp']) < 60.minutes
        @metrics_store_clients['influxdb']['client']
      else
        client = Monitoring::InfluxdbMetricsStore.new(config['influxdb'])
        @metrics_store_clients['influxdb'] = {}
        @metrics_store_clients['influxdb']['client'] = client
        @metrics_store_clients['influxdb']['timestamp'] = Time.now
        client
      end
    else
      @metrics_store_clients['null']
    end
  end
end
{'fraction_non_alphanumeric': 0.13996500874781304, 'fraction_numerical': 0.0024993751562109472, 'mean_word_length': 3.9285714285714284, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5497255', 'n_tokens_mistral': 1398, 'n_tokens_neox': 1329, 'n_words': 213}