<commit_before>
class Monitoring::ChecksController < Monitoring::BaseController

  def show
    host = Host.find(_id(:host))
    check = Check.find(_id).includes(:command)
    downsample = params[:downsample] || "1h-avg"
    metrics = Metric.metrics_for_check(check, nil, nil, {}, "sum", downsample)

    bootstrap host, check
    bootstrap metrics, :name => "metrics"
  end

  def new
    bootstrap Host.find(params[:host_id]), Host.for_user(current_user)
    bootstrap Command.for_monitoring(), :name => "commands", :model => "MonitoringCommandList"

    if params[:command_id] then
      command = Command.find(params[:command_id])
      bootstrap command, :name => "command", :model => "MonitoringCommand"
    end<commit_msg>pass current_user<commit_after>
class Monitoring::ChecksController < Monitoring::BaseController

  def show
    host = Host.find(_id(:host))
    check = Check.find(_id).includes(:command)
    downsample = params[:downsample] || "1h-avg"
    metrics = Metric.metrics_for_check(check, nil, nil, {}, "sum", downsample)

    bootstrap host, check
    bootstrap metrics, :name => "metrics"
  end

  def new
    bootstrap Host.find(params[:host_id]), Host.for_user(current_user)
    bootstrap Command.for_monitoring(current_user), :name => "commands", :model => "MonitoringCommandList"

    if params[:command_id] then
      command = Command.find(params[:command_id])
      bootstrap command, :name => "command", :model => "MonitoringCommand"
    end
{'fraction_non_alphanumeric': 0.13432835820895522, 'fraction_numerical': 0.0013568521031207597, 'mean_word_length': 4.503731343283582, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 13, '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': '4377241', 'n_tokens_mistral': 452, 'n_tokens_neox': 429, 'n_words': 100}