<commit_before>require "growth_push"
require "json"

# TODO Delete it before publishing
require "pry"
require "awesome_print"

class Fluent::GrowthPushOutput < Fluent::Output
  Fluent::Plugin.register_output('growthpush', self)

  config_param :application_id, :string
  config_param :secret, :string
  
  def initialize 
    super
    @growthpush = GrowthPush.new(@application_id, @secret)
  end

  def config(conf)
  	super
  end


  def emit(tag, es, chain)
    chain.next
    es.each {|time,record|
      $stderr.puts "#{record}"
      # @growthpush.create_event(token, name, value);
      # p GrowthPush.new(@application_id, @secret)
    }
  end

end<commit_msg>Add: out_growthpush.rb:<commit_after>require "growth_push"
require "json"
require "pry"
require "awesome_print"

class Fluent::GrowthPushOutput < Fluent::Output
  Fluent::Plugin.register_output('growthpush', self)

  config_param :application_id, :string
  config_param :secret, :string
  
  def initialize 
    super
    @growthpush = GrowthPush.new(@application_id, @secret)
  end

  def config(conf)
  	super
  end


  def emit(tag, es, chain)
    chain.next
    es.each do |time,record|
      @growthpush.create_event(record["client"], record["name"], record["value"]);
    end
  end

end
{'fraction_non_alphanumeric': 0.11517077045274027, 'fraction_numerical': 0.0, 'mean_word_length': 4.163934426229508, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, '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': '4422152', 'n_tokens_mistral': 440, 'n_tokens_neox': 415, 'n_words': 96}