<commit_before>class FluentdController < ApplicationController
  before_action :find_fluentd, only: [:edit, :update, :destroy]

  def index
    @fluentds = Fluentd.all
  end

  def new
    @fluentd = Fluentd.new(Fluentd::Agent::Fluentd.default_options) # TODO: not fluentd type
  end

  def create
    @fluentd = Fluentd.new(fluentd_params)
    unless @fluentd.save
      return render :new
    end
    redirect_to fluentd_index_path
  end

  def edit
  end

  def update
    # TODO: should restart if changed file path? or just do "dirty" flagged?
    @fluentd.update_attributes(fluentd_params)
    unless @fluentd.save
      return render :edit
    end
    redirect_to fluentd_index_path
  end
  
  def destroy
    @fluentd.agent.stop if @fluentd.agent.running?
    @fluentd.destroy
    redirect_to fluentd_index_path
  end<commit_msg>Set default API endpoint for fluentd<commit_after>class FluentdController < ApplicationController
  before_action :find_fluentd, only: [:edit, :update, :destroy]

  def index
    @fluentds = Fluentd.all
  end

  def new
    @fluentd = Fluentd.new(Fluentd::Agent::Fluentd.default_options.merge(:api_endpoint => "http://localhost:24220/")) # TODO: not fluentd type
  end

  def create
    @fluentd = Fluentd.new(fluentd_params)
    unless @fluentd.save
      return render :new
    end
    redirect_to fluentd_index_path
  end

  def edit
  end

  def update
    # TODO: should restart if changed file path? or just do "dirty" flagged?
    @fluentd.update_attributes(fluentd_params)
    unless @fluentd.save
      return render :edit
    end
    redirect_to fluentd_index_path
  end
  
  def destroy
    @fluentd.agent.stop if @fluentd.agent.running?
    @fluentd.destroy
    redirect_to fluentd_index_path
  end
{'fraction_non_alphanumeric': 0.07498568975386377, 'fraction_numerical': 0.0028620492272467086, 'mean_word_length': 3.436548223350254, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 4, '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': '7572670', 'n_tokens_mistral': 612, 'n_tokens_neox': 598, 'n_words': 149}