Class: GitlabQuality::TestTooling::TestMetricsExporter::Formatter
- Inherits:
-
RSpec::Core::Formatters::BaseFormatter
- Object
- RSpec::Core::Formatters::BaseFormatter
- GitlabQuality::TestTooling::TestMetricsExporter::Formatter
show all
- Includes:
- Utils
- Defined in:
- lib/gitlab_quality/test_tooling/test_metrics_exporter/formatter.rb
Constant Summary
collapse
- LOG_PREFIX =
"[MetricsExporter]"
Instance Method Summary
collapse
Methods included from Utils
clickhouse_client, config, #create_clickhouse_metrics_table, #gcs_client, logger
Instance Method Details
#start(_notification) ⇒ Object
15
16
17
18
19
20
21
22
23
24
|
# File 'lib/gitlab_quality/test_tooling/test_metrics_exporter/formatter.rb', line 15
def start(_notification)
return unless config.initial_run
logger.info("#{LOG_PREFIX} Running initial setup for metrics export")
raise "Initial setup is enabled, but clickhouse configuration is missing!" unless clickhouse_config
create_clickhouse_metrics_table
rescue StandardError => e
logger.error("#{LOG_PREFIX} Error occurred during initial setup: #{e.message}")
end
|
#stop(notification) ⇒ Object
26
27
28
29
30
31
32
33
34
35
36
37
|
# File 'lib/gitlab_quality/test_tooling/test_metrics_exporter/formatter.rb', line 26
def stop(notification)
logger.debug("#{LOG_PREFIX} Starting test metrics export")
data = notification.examples.filter_map do |example|
next if config.skip_record_proc.call(example)
TestMetrics.new(example, time).data
end
return logger.warn("#{LOG_PREFIX} No test execution records found, metrics will not be exported!") if data.empty?
push_to_gcs(data)
push_to_clickhouse(data)
end
|