Class: Datadog::CI::TestRetries::UniqueTestsClient
- Inherits:
-
Object
- Object
- Datadog::CI::TestRetries::UniqueTestsClient
- Defined in:
- lib/datadog/ci/test_retries/unique_tests_client.rb
Overview
fetch a list of unique known tests from the backend
Defined Under Namespace
Classes: Response
Instance Method Summary collapse
- #fetch_unique_tests(test_session) ⇒ Object
-
#initialize(dd_env:, api: nil, config_tags: {}) ⇒ UniqueTestsClient
constructor
A new instance of UniqueTestsClient.
Constructor Details
#initialize(dd_env:, api: nil, config_tags: {}) ⇒ UniqueTestsClient
Returns a new instance of UniqueTestsClient.
63 64 65 66 67 |
# File 'lib/datadog/ci/test_retries/unique_tests_client.rb', line 63 def initialize(dd_env:, api: nil, config_tags: {}) @api = api @dd_env = dd_env @config_tags = end |
Instance Method Details
#fetch_unique_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_retries/unique_tests_client.rb', line 69 def fetch_unique_tests(test_session) api = @api return Set.new unless api request_payload = payload(test_session) Datadog.logger.debug("Fetching unique known tests with request: #{request_payload}") http_response = api.api_request( path: Ext::Transport::DD_API_UNIQUE_TESTS_PATH, payload: request_payload ) Transport::Telemetry.api_requests( Ext::Telemetry::METRIC_EFD_UNIQUE_TESTS_REQUEST, 1, compressed: http_response.request_compressed ) Utils::Telemetry.distribution(Ext::Telemetry::METRIC_EFD_UNIQUE_TESTS_REQUEST_MS, http_response.duration_ms) Utils::Telemetry.distribution( Ext::Telemetry::METRIC_EFD_UNIQUE_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_EFD_UNIQUE_TESTS_REQUEST_ERRORS, 1, error_type: http_response.telemetry_error_type, status_code: http_response.code ) end Response.new(http_response).tests end |