Class: Ci::Observability::ExportService

Inherits:
Object
  • Object
show all
Includes:
Gitlab::Utils::StrongMemoize
Defined in:
app/services/ci/observability/export_service.rb

Constant Summary collapse

OBSERVABILITY_VARIABLE =
'GITLAB_OBSERVABILITY_EXPORT'
VALID_VARIABLE_VALUES =
%w[traces metrics logs].freeze

Instance Method Summary collapse

Constructor Details

#initialize(pipeline) ⇒ ExportService

Returns a new instance of ExportService.



11
12
13
# File 'app/services/ci/observability/export_service.rb', line 11

def initialize(pipeline)
  @pipeline = pipeline
end

Instance Method Details

#executeObject



15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'app/services/ci/observability/export_service.rb', line 15

def execute
  return unless should_export? && observability_available?

  export_data
rescue StandardError => e
  Gitlab::AppLogger.error(
    message: "GitLab Observability export failed",
    pipeline_id: pipeline.id,
    project_id: pipeline.project_id,
    error_class: e.class.name,
    error_message: e.message
  )
end