diff options
author | Marin Jankovski <marin@gitlab.com> | 2018-04-10 14:15:10 +0300 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2018-04-11 03:04:45 +0300 |
commit | fd35eb84788e73b3cb71806c5d82e85426a1f1ee (patch) | |
tree | f40a7d5c20a500c02794dccec9a638a11519260e /app | |
parent | 842005641cab896af5f14f4ee449f638e50d12ec (diff) |
Merge branch 'revert-e9e800f5' into 'master'
Revert "Merge branch 'improve-jobs-queuing-time-metric' into 'master'"
See merge request gitlab-org/gitlab-ce!18276
Diffstat (limited to 'app')
-rw-r--r-- | app/services/ci/register_job_service.rb | 19 |
1 files changed, 2 insertions, 17 deletions
diff --git a/app/services/ci/register_job_service.rb b/app/services/ci/register_job_service.rb index d46dcff34a1..e09b445636f 100644 --- a/app/services/ci/register_job_service.rb +++ b/app/services/ci/register_job_service.rb @@ -4,9 +4,6 @@ module Ci class RegisterJobService attr_reader :runner - JOB_QUEUE_DURATION_SECONDS_BUCKETS = [1, 3, 10, 30].freeze - JOBS_RUNNING_FOR_PROJECT_MAX_BUCKET = 5.freeze - Result = Struct.new(:build, :valid?) def initialize(runner) @@ -107,22 +104,10 @@ module Ci end def register_success(job) - labels = { shared_runner: runner.shared?, - jobs_running_for_project: jobs_running_for_project(job) } - - job_queue_duration_seconds.observe(labels, Time.now - job.queued_at) + job_queue_duration_seconds.observe({ shared_runner: @runner.shared? }, Time.now - job.created_at) attempt_counter.increment end - def jobs_running_for_project(job) - return '+Inf' unless runner.shared? - - # excluding currently started job - running_jobs_count = job.project.builds.running.where(runner: Ci::Runner.shared) - .limit(JOBS_RUNNING_FOR_PROJECT_MAX_BUCKET + 1).count - 1 - running_jobs_count < JOBS_RUNNING_FOR_PROJECT_MAX_BUCKET ? running_jobs_count : "#{JOBS_RUNNING_FOR_PROJECT_MAX_BUCKET}+" - end - def failed_attempt_counter @failed_attempt_counter ||= Gitlab::Metrics.counter(:job_register_attempts_failed_total, "Counts the times a runner tries to register a job") end @@ -132,7 +117,7 @@ module Ci end def job_queue_duration_seconds - @job_queue_duration_seconds ||= Gitlab::Metrics.histogram(:job_queue_duration_seconds, 'Request handling execution time', {}, JOB_QUEUE_DURATION_SECONDS_BUCKETS) + @job_queue_duration_seconds ||= Gitlab::Metrics.histogram(:job_queue_duration_seconds, 'Request handling execution time') end end end |