Class: Ci::ArchiveTraceService
- Inherits:
-
Object
- Object
- Ci::ArchiveTraceService
- Defined in:
- app/services/ci/archive_trace_service.rb
Instance Method Summary collapse
Instance Method Details
#execute(job, worker_name:) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'app/services/ci/archive_trace_service.rb', line 5 def execute(job, worker_name:) # TODO: Remove this logging once we confirmed new live trace architecture is functional. # See https://gitlab.com/gitlab-com/gl-infra/infrastructure/issues/4667. unless job.has_live_trace? Sidekiq.logger.warn(class: worker_name, message: 'The job does not have live trace but going to be archived.', job_id: job.id) return end job.trace.archive! # TODO: Remove this logging once we confirmed new live trace architecture is functional. # See https://gitlab.com/gitlab-com/gl-infra/infrastructure/issues/4667. unless job.has_archived_trace? Sidekiq.logger.warn(class: worker_name, message: 'The job does not have archived trace after archiving.', job_id: job.id) end rescue ::Gitlab::Ci::Trace::AlreadyArchivedError # It's already archived, thus we can safely ignore this exception. rescue => e # Tracks this error with application logs, Sentry, and Prometheus. # If `archive!` keeps failing for over a week, that could incur data loss. # (See more https://docs.gitlab.com/ee/administration/job_traces.html#new-live-trace-architecture) # In order to avoid interrupting the system, we do not raise an exception here. archive_error(e, job, worker_name) end |