Extract process_name from GitLab::Sentry
GitLab::Sentry has a program_context method to determine whether a Sentry exception occurred in Sidekiq or rails. Since we will need similar functionality for distributed tracing, this change extracts the program_context method into GitLab.process_name for more general consumption.
This commit is contained in:
parent
eec16ee28c
commit
2c0d69d310
4 changed files with 14 additions and 9 deletions
5
changelogs/unreleased/an-gilab-process-name.yml
Normal file
5
changelogs/unreleased/an-gilab-process-name.yml
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
title: Extract process_name from GitLab::Sentry
|
||||
merge_request: 24422
|
||||
author:
|
||||
type: other
|
|
@ -19,7 +19,7 @@ def configure_sentry
|
|||
config.sanitize_fields = Rails.application.config.filter_parameters.map(&:to_s)
|
||||
# Sanitize authentication headers
|
||||
config.sanitize_http_headers = %w[Authorization Private-Token]
|
||||
config.tags = { program: Gitlab::Sentry.program_context }
|
||||
config.tags = { program: Gitlab.process_name }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -89,4 +89,12 @@ module Gitlab
|
|||
def self.dev_env_or_com?
|
||||
Rails.env.development? || org? || com?
|
||||
end
|
||||
|
||||
def self.process_name
|
||||
return 'sidekiq' if Sidekiq.server?
|
||||
return 'console' if defined?(Rails::Console)
|
||||
return 'test' if Rails.env.test?
|
||||
|
||||
'web'
|
||||
end
|
||||
end
|
||||
|
|
|
@ -52,14 +52,6 @@ module Gitlab
|
|||
end
|
||||
end
|
||||
|
||||
def self.program_context
|
||||
if Sidekiq.server?
|
||||
'sidekiq'
|
||||
else
|
||||
'rails'
|
||||
end
|
||||
end
|
||||
|
||||
def self.should_raise_for_dev?
|
||||
Rails.env.development? || Rails.env.test?
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue