Class: GitlabQuality::TestTooling::TestMetricsExporter::Config
- Inherits:
-
Object
- Object
- GitlabQuality::TestTooling::TestMetricsExporter::Config
- Includes:
- Singleton
- Defined in:
- lib/gitlab_quality/test_tooling/test_metrics_exporter/config.rb
Instance Attribute Summary collapse
-
#clickhouse_database ⇒ Object
Returns the value of attribute clickhouse_database.
-
#clickhouse_password ⇒ Object
Returns the value of attribute clickhouse_password.
-
#clickhouse_table_name ⇒ Object
Returns the value of attribute clickhouse_table_name.
-
#clickhouse_url ⇒ Object
Returns the value of attribute clickhouse_url.
-
#clickhouse_username ⇒ Object
Returns the value of attribute clickhouse_username.
-
#custom_metrics_proc ⇒ Proc
A lambda that return hash with additional custom metrics.
-
#extra_rspec_metadata_keys ⇒ Array<Symbol>
Extra rspec metadata keys to include in exported metrics.
-
#initial_run ⇒ Object
readonly
Returns the value of attribute initial_run.
-
#logger ⇒ Logger
Logger instance.
-
#run_type ⇒ Object
Returns the value of attribute run_type.
-
#skip_record_proc ⇒ Proc
A lambda that determines whether to skip recording a test result.
-
#spec_file_path_prefix ⇒ String
Extra path prefix for constructing full file path within mono-repository setups.
-
#test_retried_proc ⇒ Proc
A lambda that determines whether a test was retried or not.
Class Method Summary collapse
Instance Method Summary collapse
-
#clickhouse_configured? ⇒ Boolean
Whether ClickHouse export is configured.
-
#extra_metadata_columns ⇒ Array
Additional metadata columns used during initial table creation.
-
#extra_metadata_columns=(columns) ⇒ Array
Additional columns to be created in the table if initial_run setup is used Columns should be defined in the format used for ALTER TABLE query, example; [ “feature_category LowCardinality(String) DEFAULT ””, “level LowCardinality(String) DEFAULT ”” ].
-
#initial_run! ⇒ Boolean
Marks execution as initial run and performs setup tasks before running tests, like creating database in ClickHouse.
Instance Attribute Details
#clickhouse_database ⇒ Object
Returns the value of attribute clickhouse_database.
22 23 24 |
# File 'lib/gitlab_quality/test_tooling/test_metrics_exporter/config.rb', line 22 def clickhouse_database @clickhouse_database end |
#clickhouse_password ⇒ Object
Returns the value of attribute clickhouse_password.
22 23 24 |
# File 'lib/gitlab_quality/test_tooling/test_metrics_exporter/config.rb', line 22 def clickhouse_password @clickhouse_password end |
#clickhouse_table_name ⇒ Object
Returns the value of attribute clickhouse_table_name.
22 23 24 |
# File 'lib/gitlab_quality/test_tooling/test_metrics_exporter/config.rb', line 22 def clickhouse_table_name @clickhouse_table_name end |
#clickhouse_url ⇒ Object
Returns the value of attribute clickhouse_url.
22 23 24 |
# File 'lib/gitlab_quality/test_tooling/test_metrics_exporter/config.rb', line 22 def clickhouse_url @clickhouse_url end |
#clickhouse_username ⇒ Object
Returns the value of attribute clickhouse_username.
22 23 24 |
# File 'lib/gitlab_quality/test_tooling/test_metrics_exporter/config.rb', line 22 def clickhouse_username @clickhouse_username end |
#custom_metrics_proc ⇒ Proc
A lambda that return hash with additional custom metrics
109 110 111 |
# File 'lib/gitlab_quality/test_tooling/test_metrics_exporter/config.rb', line 109 def custom_metrics_proc @custom_metrics_proc ||= ->(_example) { {} } end |
#extra_rspec_metadata_keys ⇒ Array<Symbol>
Extra rspec metadata keys to include in exported metrics
78 79 80 |
# File 'lib/gitlab_quality/test_tooling/test_metrics_exporter/config.rb', line 78 def @extra_rspec_metadata_keys ||= [] end |
#initial_run ⇒ Object (readonly)
Returns the value of attribute initial_run.
21 22 23 |
# File 'lib/gitlab_quality/test_tooling/test_metrics_exporter/config.rb', line 21 def initial_run @initial_run end |
#logger ⇒ Logger
Logger instance
116 117 118 |
# File 'lib/gitlab_quality/test_tooling/test_metrics_exporter/config.rb', line 116 def logger @logger ||= Logger.new($stdout, level: Logger::INFO) end |
#run_type ⇒ Object
Returns the value of attribute run_type.
22 23 24 |
# File 'lib/gitlab_quality/test_tooling/test_metrics_exporter/config.rb', line 22 def run_type @run_type end |
#skip_record_proc ⇒ Proc
A lambda that determines whether to skip recording a test result
This is useful when you would want to skip initial failure when retrying specs is set up in a separate process and you want to avoid duplicate records
95 96 97 |
# File 'lib/gitlab_quality/test_tooling/test_metrics_exporter/config.rb', line 95 def skip_record_proc @skip_record_proc ||= ->(_example) { false } end |
#spec_file_path_prefix ⇒ String
Extra path prefix for constructing full file path within mono-repository setups
85 86 87 |
# File 'lib/gitlab_quality/test_tooling/test_metrics_exporter/config.rb', line 85 def spec_file_path_prefix @spec_file_path_prefix ||= "" end |
#test_retried_proc ⇒ Proc
A lambda that determines whether a test was retried or not
102 103 104 |
# File 'lib/gitlab_quality/test_tooling/test_metrics_exporter/config.rb', line 102 def test_retried_proc @test_retried_proc ||= ->(_example) { false } end |
Class Method Details
.configuration ⇒ Object
12 13 14 |
# File 'lib/gitlab_quality/test_tooling/test_metrics_exporter/config.rb', line 12 def configuration Config.instance end |
.configure {|configuration| ... } ⇒ Object
16 17 18 |
# File 'lib/gitlab_quality/test_tooling/test_metrics_exporter/config.rb', line 16 def configure yield(configuration) end |
Instance Method Details
#clickhouse_configured? ⇒ Boolean
Whether ClickHouse export is configured
Export is considered enabled when all required attributes are set
57 58 59 |
# File 'lib/gitlab_quality/test_tooling/test_metrics_exporter/config.rb', line 57 def clickhouse_configured? [clickhouse_url, clickhouse_database, clickhouse_table_name, clickhouse_username, clickhouse_password].none?(&:blank?) end |
#extra_metadata_columns ⇒ Array
Additional metadata columns used during initial table creation
71 72 73 |
# File 'lib/gitlab_quality/test_tooling/test_metrics_exporter/config.rb', line 71 def @extra_metadata_columns ||= [] end |
#extra_metadata_columns=(columns) ⇒ Array
Additional columns to be created in the table if initial_run setup is used Columns should be defined in the format used for ALTER TABLE query, example;
[
"feature_category LowCardinality(String) DEFAULT ''",
"level LowCardinality(String) DEFAULT ''"
]
46 47 48 |
# File 'lib/gitlab_quality/test_tooling/test_metrics_exporter/config.rb', line 46 def (columns) @extra_metadata_columns = columns end |
#initial_run! ⇒ Boolean
Marks execution as initial run and performs setup tasks before running tests, like creating database in ClickHouse
64 65 66 |
# File 'lib/gitlab_quality/test_tooling/test_metrics_exporter/config.rb', line 64 def initial_run! @initial_run = true end |