Class: ErrorTrackingIssueLinkWorker
- Inherits:
-
Object
- Object
- ErrorTrackingIssueLinkWorker
- Includes:
- ApplicationWorker, ExclusiveLeaseGuard, Gitlab::Utils::StrongMemoize
- Defined in:
- app/workers/error_tracking_issue_link_worker.rb
Overview
Creates a link in Sentry between a Sentry issue and a GitLab issue. If the link already exists, no changes will occur. If a link to a different GitLab issue exists, a new link
will still be created, but will not be visible in Sentry
until the prior link is deleted.
Constant Summary collapse
- LEASE_TIMEOUT =
15.minutes
Constants included from ApplicationWorker
ApplicationWorker::LOGGING_EXTRA_KEY, ApplicationWorker::SAFE_PUSH_BULK_LIMIT
Constants included from Gitlab::Loggable
Constants included from WorkerAttributes
WorkerAttributes::DEFAULT_DATA_CONSISTENCY, WorkerAttributes::DEFAULT_DEFER_DELAY, WorkerAttributes::NAMESPACE_WEIGHTS, WorkerAttributes::VALID_DATA_CONSISTENCIES, WorkerAttributes::VALID_RESOURCE_BOUNDARIES, WorkerAttributes::VALID_URGENCIES
Instance Attribute Summary collapse
-
#issue ⇒ Object
readonly
Returns the value of attribute issue.
Instance Method Summary collapse
Methods included from ExclusiveLeaseGuard
#exclusive_lease, #lease_release?, #lease_taken_log_level, #lease_taken_message, #log_lease_taken, #release_lease, #renew_lease!, #try_obtain_lease
Methods included from Gitlab::Loggable
Methods included from Gitlab::SidekiqVersioning::Worker
Methods included from WorkerContext
Instance Attribute Details
#issue ⇒ Object (readonly)
Returns the value of attribute issue.
22 23 24 |
# File 'app/workers/error_tracking_issue_link_worker.rb', line 22 def issue @issue end |
Instance Method Details
#perform(issue_id) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'app/workers/error_tracking_issue_link_worker.rb', line 24 def perform(issue_id) @issue = Issue.find_by_id(issue_id) return unless valid? try_obtain_lease do logger.info("Linking Sentry issue #{sentry_issue_id} to GitLab issue #{issue.id}") sentry_client.create_issue_link(integration_id, sentry_issue_id, issue) rescue ErrorTracking::SentryClient::Error => e logger.info("Failed to link Sentry issue #{sentry_issue_id} to GitLab issue #{issue.id} with error: #{e.}") end end |