<commit_before># If Mini Profiler is included via gem
if defined?(Rack::MiniProfiler)

  Rack::MiniProfiler.config.storage_instance = Rack::MiniProfiler::RedisStore.new(connection:  DiscourseRedis.new)

  # For our app, let's just show mini profiler always, polling is chatty so nuke that
  Rack::MiniProfiler.config.pre_authorize_cb = lambda do |env|
    (env['HTTP_USER_AGENT'] !~ /iPad|iPhone|Nexus 7/) &&
    (env['PATH_INFO'] !~ /^\/message-bus/) &&
    (env['PATH_INFO'] !~ /topics\/timings/) &&
    (env['PATH_INFO'] !~ /assets/) &&
    (env['PATH_INFO'] !~ /jasmine/) &&
    (env['PATH_INFO'] !~ /users\/.*\/avatar/) &&
    (env['PATH_INFO'] !~ /srv\/status/) &&
    (env['PATH_INFO'] !~ /commits-widget/)
  end

  Rack::MiniProfiler.config.position = 'left'
  Rack::MiniProfiler.config.backtrace_ignores ||= []
  Rack::MiniProfiler.config.backtrace_ignores << /lib\/rack\/message_bus.rb/
  Rack::MiniProfiler.config.backtrace_ignores << /config\/initializers\/silence_logger/
  Rack::MiniProfiler.config.backtrace_ignores << /config\/initializers\/quiet_logger/<commit_msg>wow, this has been broken for OH so long, we need to segragate users correctly so MP results work as expected<commit_after># If Mini Profiler is included via gem
if defined?(Rack::MiniProfiler)

  Rack::MiniProfiler.config.storage_instance = Rack::MiniProfiler::RedisStore.new(connection:  DiscourseRedis.new)

  # For our app, let's just show mini profiler always, polling is chatty so nuke that
  Rack::MiniProfiler.config.pre_authorize_cb = lambda do |env|
    (env['HTTP_USER_AGENT'] !~ /iPad|iPhone|Nexus 7/) &&
    (env['PATH_INFO'] !~ /^\/message-bus/) &&
    (env['PATH_INFO'] !~ /topics\/timings/) &&
    (env['PATH_INFO'] !~ /assets/) &&
    (env['PATH_INFO'] !~ /jasmine/) &&
    (env['PATH_INFO'] !~ /users\/.*\/avatar/) &&
    (env['PATH_INFO'] !~ /srv\/status/) &&
    (env['PATH_INFO'] !~ /commits-widget/)
  end

  Rack::MiniProfiler.config.user_provider = lambda do |env|
    user = CurrentUser.lookup_from_env(env)
    user ? user.id.to_s : Rack::Request.new(env).ip
  end

  Rack::MiniProfiler.config.position = 'left'
  Rack::MiniProfiler.config.backtrace_ignores ||= []
  Rack::MiniProfiler.config.backtrace_ignores << /lib\/rack\/message_bus.rb/
  Rack::MiniProfiler.config.backtrace_ignores << /config\/initializers\/silence_logger/
  Rack::MiniProfiler.config.backtrace_ignores << /config\/initializers\/quiet_logger/
{'fraction_non_alphanumeric': 0.17292612463887744, 'fraction_numerical': 0.0008254230293025176, 'mean_word_length': 4.327472527472527, 'pattern_counts': {'":': 0, '<': 15, '<?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': '5984021', 'n_tokens_mistral': 896, 'n_tokens_neox': 896, 'n_words': 147}