Class: Datadog::CI::TestOptimisation::Skippable
- Inherits:
-
Object
- Object
- Datadog::CI::TestOptimisation::Skippable
- Defined in:
- lib/datadog/ci/test_optimisation/skippable.rb
Defined Under Namespace
Classes: Response
Instance Method Summary collapse
- #fetch_skippable_tests(test_session) ⇒ Object
-
#initialize(dd_env:, api: nil, config_tags: {}) ⇒ Skippable
constructor
A new instance of Skippable.
Constructor Details
#initialize(dd_env:, api: nil, config_tags: {}) ⇒ Skippable
Returns a new instance of Skippable.
63 64 65 66 67 |
# File 'lib/datadog/ci/test_optimisation/skippable.rb', line 63 def initialize(dd_env:, api: nil, config_tags: {}) @api = api @dd_env = dd_env @config_tags = end |
Instance Method Details
#fetch_skippable_tests(test_session) ⇒ Object
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
# File 'lib/datadog/ci/test_optimisation/skippable.rb', line 69 def fetch_skippable_tests(test_session) api = @api return Response.new(nil) unless api request_payload = payload(test_session) Datadog.logger.debug("Fetching skippable tests with request: #{request_payload}") http_response = api.api_request( path: Ext::Transport::DD_API_SKIPPABLE_TESTS_PATH, payload: request_payload ) Transport::Telemetry.api_requests( Ext::Telemetry::METRIC_ITR_SKIPPABLE_TESTS_REQUEST, 1, compressed: http_response.request_compressed ) Utils::Telemetry.distribution(Ext::Telemetry::METRIC_ITR_SKIPPABLE_TESTS_REQUEST_MS, http_response.duration_ms) Utils::Telemetry.distribution( Ext::Telemetry::METRIC_ITR_SKIPPABLE_TESTS_RESPONSE_BYTES, http_response.response_size.to_f, {Ext::Telemetry::TAG_RESPONSE_COMPRESSED => http_response.gzipped_content?.to_s} ) unless http_response.ok? Transport::Telemetry.api_requests_errors( Ext::Telemetry::METRIC_ITR_SKIPPABLE_TESTS_REQUEST_ERRORS, 1, error_type: http_response.telemetry_error_type, status_code: http_response.code ) end Response.new(http_response) end |