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
-
#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.
-
#logger ⇒ Logger
Logger instance.
-
#observer_token ⇒ Object
Returns the value of attribute observer_token.
-
#observer_url ⇒ Object
Returns the value of attribute observer_url.
-
#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
-
#observer_configured? ⇒ Boolean
Whether observer export is configured.
Instance Attribute Details
#custom_metrics_proc ⇒ Proc
A lambda that return hash with additional custom metrics
75 76 77 |
# File 'lib/gitlab_quality/test_tooling/test_metrics_exporter/config.rb', line 75 def custom_metrics_proc @custom_metrics_proc ||= ->(_example) { {} } end |
#extra_rspec_metadata_keys ⇒ Array<Symbol>
Extra rspec metadata keys to include in exported metrics
44 45 46 |
# File 'lib/gitlab_quality/test_tooling/test_metrics_exporter/config.rb', line 44 def @extra_rspec_metadata_keys ||= [] end |
#logger ⇒ Logger
Logger instance
82 83 84 |
# File 'lib/gitlab_quality/test_tooling/test_metrics_exporter/config.rb', line 82 def logger @logger ||= Logger.new($stdout, level: Logger::INFO) end |
#observer_token ⇒ Object
Returns the value of attribute observer_token.
22 23 24 |
# File 'lib/gitlab_quality/test_tooling/test_metrics_exporter/config.rb', line 22 def observer_token @observer_token end |
#observer_url ⇒ Object
Returns the value of attribute observer_url.
22 23 24 |
# File 'lib/gitlab_quality/test_tooling/test_metrics_exporter/config.rb', line 22 def observer_url @observer_url 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
61 62 63 |
# File 'lib/gitlab_quality/test_tooling/test_metrics_exporter/config.rb', line 61 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
51 52 53 |
# File 'lib/gitlab_quality/test_tooling/test_metrics_exporter/config.rb', line 51 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
68 69 70 |
# File 'lib/gitlab_quality/test_tooling/test_metrics_exporter/config.rb', line 68 def test_retried_proc @test_retried_proc ||= ->(_example) { false } end |
Class Method Details
.configuration ⇒ Object
13 14 15 |
# File 'lib/gitlab_quality/test_tooling/test_metrics_exporter/config.rb', line 13 def configuration Config.instance end |
.configure {|configuration| ... } ⇒ Object
17 18 19 |
# File 'lib/gitlab_quality/test_tooling/test_metrics_exporter/config.rb', line 17 def configure yield(configuration) end |
Instance Method Details
#observer_configured? ⇒ Boolean
Whether observer export is configured
Export is considered enabled when all required attributes are set
37 38 39 |
# File 'lib/gitlab_quality/test_tooling/test_metrics_exporter/config.rb', line 37 def observer_configured? [observer_url, observer_token].none? { |value| value.nil? || value.to_s.empty? } end |