From ccfdfb68517fc0eb41e07566ab9e0f1250d404b6 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Tue, 13 Jan 2026 09:09:33 +0000 Subject: [PATCH] Regenerate client from commit 081afac of spec repo --- .generator/schemas/v2/openapi.yaml | 90 +++++++++++++++++-- examples/v2/spa/GetSPARecommendations.py | 1 - .../v2/spa/GetSPARecommendationsWithShard.py | 17 ++++ src/datadog_api_client/configuration.py | 1 + src/datadog_api_client/v2/api/spa_api.py | 80 +++++++++++++++-- .../v2/model/recommendation_attributes.py | 19 +++- tests/v2/features/spa.feature | 36 ++++++-- tests/v2/features/undo.json | 6 ++ 8 files changed, 226 insertions(+), 24 deletions(-) create mode 100644 examples/v2/spa/GetSPARecommendationsWithShard.py diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index d9c881cd83..6136c4fe7b 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -42828,6 +42828,9 @@ components: description: Attributes of the SPA Recommendation resource. Contains recommendations for both driver and executor components. properties: + confidence_level: + format: double + type: number driver: $ref: '#/components/schemas/ComponentRecommendation' executor: @@ -86625,13 +86628,79 @@ paths: x-unstable: '**Note**: This feature is in private beta. To request access, use the request access form in the [Service Level Objectives](https://docs.datadoghq.com/service_management/service_level_objectives/#slo-csv-export) docs.' - /api/v2/spa/recommendations/{service}/{shard}: + /api/v2/spa/recommendations/{service}: get: - description: Retrieve resource recommendations for a Spark job. The caller (Spark - Gateway or DJM UI) provides a service name and shard identifier, and SPA returns - structured recommendations for driver and executor resources. + description: This endpoint is currently experimental and restricted to Datadog + internal use only. Retrieve resource recommendations for a Spark job. The + caller (Spark Gateway or DJM UI) provides a service name and SPA returns structured + recommendations for driver and executor resources. The version with a shard + should be preferred, where possible, as it gives more accurate results. operationId: GetSPARecommendations parameters: + - description: The recommendation service should not use its metrics cache. + in: query + name: bypass_cache + schema: + type: string + - description: The service name for a spark job. + in: path + name: service + required: true + schema: + type: string + responses: + '200': + content: + application/json: + example: + data: + attributes: + driver: + estimation: + cpu: + max: 1500 + p75: 1000 + p95: 1200 + ephemeral_storage: 896 + heap: 6144 + memory: 7168 + overhead: 1024 + executor: + estimation: + cpu: + max: 2000 + p75: 1200 + p95: 1500 + ephemeral_storage: 512 + heap: 3072 + memory: 4096 + overhead: 1024 + id: dedupeactivecontexts:adp_dedupeactivecontexts_org2 + type: recommendation + schema: + $ref: '#/components/schemas/RecommendationDocument' + description: OK + '400': + $ref: '#/components/responses/BadRequestResponse' + '403': + $ref: '#/components/responses/NotAuthorizedResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - AuthZ: [] + summary: Get SPA Recommendations + tags: + - Spa + x-unstable: '**Note**: This endpoint is in preview and may change in the future. + It is not yet recommended for production use.' + /api/v2/spa/recommendations/{service}/{shard}: + get: + description: This endpoint is currently experimental and restricted to Datadog + internal use only. Retrieve resource recommendations for a Spark job. The + caller (Spark Gateway or DJM UI) provides a service name and shard identifier, + and SPA returns structured recommendations for driver and executor resources. + operationId: GetSPARecommendationsWithShard + parameters: - description: The shard tag for a spark job, which differentiates jobs within the same service that have different resource needs in: path @@ -86645,6 +86714,11 @@ paths: required: true schema: type: string + - description: The recommendation service should not use its metrics cache. + in: query + name: bypass_cache + schema: + type: string responses: '200': content: @@ -86683,11 +86757,13 @@ paths: $ref: '#/components/responses/NotAuthorizedResponse' '429': $ref: '#/components/responses/TooManyRequestsResponse' - summary: Get SPA Recommendations + security: + - AuthZ: [] + summary: Get SPA Recommendations with a shard parameter tags: - Spa - x-unstable: '**Note**: This endpoint is in public beta and may change in the - future. It is not yet recommended for production use.' + x-unstable: '**Note**: This endpoint is in preview and may change in the future. + It is not yet recommended for production use.' /api/v2/spans/analytics/aggregate: post: description: 'The API endpoint to aggregate spans into buckets and compute metrics diff --git a/examples/v2/spa/GetSPARecommendations.py b/examples/v2/spa/GetSPARecommendations.py index 6805f2996a..a262ab5b53 100644 --- a/examples/v2/spa/GetSPARecommendations.py +++ b/examples/v2/spa/GetSPARecommendations.py @@ -10,7 +10,6 @@ with ApiClient(configuration) as api_client: api_instance = SpaApi(api_client) response = api_instance.get_spa_recommendations( - shard="shard", service="service", ) diff --git a/examples/v2/spa/GetSPARecommendationsWithShard.py b/examples/v2/spa/GetSPARecommendationsWithShard.py new file mode 100644 index 0000000000..6e49b698b5 --- /dev/null +++ b/examples/v2/spa/GetSPARecommendationsWithShard.py @@ -0,0 +1,17 @@ +""" +Get SPA Recommendations with a shard parameter returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.spa_api import SpaApi + +configuration = Configuration() +configuration.unstable_operations["get_spa_recommendations_with_shard"] = True +with ApiClient(configuration) as api_client: + api_instance = SpaApi(api_client) + response = api_instance.get_spa_recommendations_with_shard( + shard="shard", + service="service", + ) + + print(response) diff --git a/src/datadog_api_client/configuration.py b/src/datadog_api_client/configuration.py index 5f29613298..73f4c788d7 100644 --- a/src/datadog_api_client/configuration.py +++ b/src/datadog_api_client/configuration.py @@ -392,6 +392,7 @@ def __init__( "v2.get_slo_report": False, "v2.get_slo_report_job_status": False, "v2.get_spa_recommendations": False, + "v2.get_spa_recommendations_with_shard": False, "v2.create_sca_resolve_vulnerable_symbols": False, "v2.create_sca_result": False, "v2.add_member_team": False, diff --git a/src/datadog_api_client/v2/api/spa_api.py b/src/datadog_api_client/v2/api/spa_api.py index 4a2f6f198b..913ca6dded 100644 --- a/src/datadog_api_client/v2/api/spa_api.py +++ b/src/datadog_api_client/v2/api/spa_api.py @@ -3,10 +3,14 @@ # Copyright 2019-Present Datadog, Inc. from __future__ import annotations -from typing import Any, Dict +from typing import Any, Dict, Union from datadog_api_client.api_client import ApiClient, Endpoint as _Endpoint from datadog_api_client.configuration import Configuration +from datadog_api_client.model_utils import ( + UnsetType, + unset, +) from datadog_api_client.v2.model.recommendation_document import RecommendationDocument @@ -23,12 +27,40 @@ def __init__(self, api_client=None): self._get_spa_recommendations_endpoint = _Endpoint( settings={ "response_type": (RecommendationDocument,), - "auth": ["apiKeyAuth", "appKeyAuth"], - "endpoint_path": "/api/v2/spa/recommendations/{service}/{shard}", + "auth": ["AuthZ"], + "endpoint_path": "/api/v2/spa/recommendations/{service}", "operation_id": "get_spa_recommendations", "http_method": "GET", "version": "v2", }, + params_map={ + "bypass_cache": { + "openapi_types": (str,), + "attribute": "bypass_cache", + "location": "query", + }, + "service": { + "required": True, + "openapi_types": (str,), + "attribute": "service", + "location": "path", + }, + }, + headers_map={ + "accept": ["application/json"], + }, + api_client=api_client, + ) + + self._get_spa_recommendations_with_shard_endpoint = _Endpoint( + settings={ + "response_type": (RecommendationDocument,), + "auth": ["AuthZ"], + "endpoint_path": "/api/v2/spa/recommendations/{service}/{shard}", + "operation_id": "get_spa_recommendations_with_shard", + "http_method": "GET", + "version": "v2", + }, params_map={ "shard": { "required": True, @@ -42,6 +74,11 @@ def __init__(self, api_client=None): "attribute": "service", "location": "path", }, + "bypass_cache": { + "openapi_types": (str,), + "attribute": "bypass_cache", + "location": "query", + }, }, headers_map={ "accept": ["application/json"], @@ -51,17 +88,45 @@ def __init__(self, api_client=None): def get_spa_recommendations( self, - shard: str, service: str, + *, + bypass_cache: Union[str, UnsetType] = unset, ) -> RecommendationDocument: """Get SPA Recommendations. - Retrieve resource recommendations for a Spark job. The caller (Spark Gateway or DJM UI) provides a service name and shard identifier, and SPA returns structured recommendations for driver and executor resources. + This endpoint is currently experimental and restricted to Datadog internal use only. Retrieve resource recommendations for a Spark job. The caller (Spark Gateway or DJM UI) provides a service name and SPA returns structured recommendations for driver and executor resources. The version with a shard should be preferred, where possible, as it gives more accurate results. + + :param service: The service name for a spark job. + :type service: str + :param bypass_cache: The recommendation service should not use its metrics cache. + :type bypass_cache: str, optional + :rtype: RecommendationDocument + """ + kwargs: Dict[str, Any] = {} + if bypass_cache is not unset: + kwargs["bypass_cache"] = bypass_cache + + kwargs["service"] = service + + return self._get_spa_recommendations_endpoint.call_with_http_info(**kwargs) + + def get_spa_recommendations_with_shard( + self, + shard: str, + service: str, + *, + bypass_cache: Union[str, UnsetType] = unset, + ) -> RecommendationDocument: + """Get SPA Recommendations with a shard parameter. + + This endpoint is currently experimental and restricted to Datadog internal use only. Retrieve resource recommendations for a Spark job. The caller (Spark Gateway or DJM UI) provides a service name and shard identifier, and SPA returns structured recommendations for driver and executor resources. :param shard: The shard tag for a spark job, which differentiates jobs within the same service that have different resource needs :type shard: str :param service: The service name for a spark job :type service: str + :param bypass_cache: The recommendation service should not use its metrics cache. + :type bypass_cache: str, optional :rtype: RecommendationDocument """ kwargs: Dict[str, Any] = {} @@ -69,4 +134,7 @@ def get_spa_recommendations( kwargs["service"] = service - return self._get_spa_recommendations_endpoint.call_with_http_info(**kwargs) + if bypass_cache is not unset: + kwargs["bypass_cache"] = bypass_cache + + return self._get_spa_recommendations_with_shard_endpoint.call_with_http_info(**kwargs) diff --git a/src/datadog_api_client/v2/model/recommendation_attributes.py b/src/datadog_api_client/v2/model/recommendation_attributes.py index f817d34e01..3310fcc5a3 100644 --- a/src/datadog_api_client/v2/model/recommendation_attributes.py +++ b/src/datadog_api_client/v2/model/recommendation_attributes.py @@ -3,11 +3,13 @@ # Copyright 2019-Present Datadog, Inc. from __future__ import annotations -from typing import TYPE_CHECKING +from typing import Union, TYPE_CHECKING from datadog_api_client.model_utils import ( ModelNormal, cached_property, + unset, + UnsetType, ) @@ -21,25 +23,38 @@ def openapi_types(_): from datadog_api_client.v2.model.component_recommendation import ComponentRecommendation return { + "confidence_level": (float,), "driver": (ComponentRecommendation,), "executor": (ComponentRecommendation,), } attribute_map = { + "confidence_level": "confidence_level", "driver": "driver", "executor": "executor", } - def __init__(self_, driver: ComponentRecommendation, executor: ComponentRecommendation, **kwargs): + def __init__( + self_, + driver: ComponentRecommendation, + executor: ComponentRecommendation, + confidence_level: Union[float, UnsetType] = unset, + **kwargs, + ): """ Attributes of the SPA Recommendation resource. Contains recommendations for both driver and executor components. + :param confidence_level: + :type confidence_level: float, optional + :param driver: Resource recommendation for a single Spark component (driver or executor). Contains estimation data used to patch Spark job specs. :type driver: ComponentRecommendation :param executor: Resource recommendation for a single Spark component (driver or executor). Contains estimation data used to patch Spark job specs. :type executor: ComponentRecommendation """ + if confidence_level is not unset: + kwargs["confidence_level"] = confidence_level super().__init__(kwargs) self_.driver = driver diff --git a/tests/v2/features/spa.feature b/tests/v2/features/spa.feature index 327bbf16ac..0e6ac6b3a7 100644 --- a/tests/v2/features/spa.feature +++ b/tests/v2/features/spa.feature @@ -4,29 +4,49 @@ Feature: Spa insights to help optimize Spark job configurations. Background: - Given a valid "apiKeyAuth" key in the system - And a valid "appKeyAuth" key in the system - And an instance of "Spa" API - And operation "GetSPARecommendations" enabled - And new "GetSPARecommendations" request + Given an instance of "Spa" API @generated @skip @team:DataDog/data-and-analytics-processing Scenario: Get SPA Recommendations returns "Bad Request" response - Given request contains "shard" parameter from "REPLACE.ME" + Given operation "GetSPARecommendations" enabled + And new "GetSPARecommendations" request And request contains "service" parameter from "REPLACE.ME" When the request is sent Then the response status is 400 Bad Request @generated @skip @team:DataDog/data-and-analytics-processing Scenario: Get SPA Recommendations returns "OK" response - Given request contains "shard" parameter from "REPLACE.ME" + Given operation "GetSPARecommendations" enabled + And new "GetSPARecommendations" request + And request contains "service" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/data-and-analytics-processing + Scenario: Get SPA Recommendations with a shard parameter returns "Bad Request" response + Given operation "GetSPARecommendationsWithShard" enabled + And new "GetSPARecommendationsWithShard" request + And request contains "shard" parameter from "REPLACE.ME" + And request contains "service" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/data-and-analytics-processing + Scenario: Get SPA Recommendations with a shard parameter returns "OK" response + Given operation "GetSPARecommendationsWithShard" enabled + And new "GetSPARecommendationsWithShard" request + And request contains "shard" parameter from "REPLACE.ME" And request contains "service" parameter from "REPLACE.ME" When the request is sent Then the response status is 200 OK @skip @team:DataDog/data-and-analytics-processing Scenario: GetSPARecommendations returns a JSON:API Recommendation with driver and executor estimations - Given request contains "service" parameter with value "dedupeactivecontexts" + Given new "GetSPARecommendations" request + And a valid "apiKeyAuth" key in the system + And a valid "appKeyAuth" key in the system + And operation "GetSPARecommendations" enabled + And request contains "service" parameter with value "dedupeactivecontexts" And request contains "shard" parameter with value "adp_dedupeactivecontexts_org2" When the request is sent Then the response status is 404 Not Found diff --git a/tests/v2/features/undo.json b/tests/v2/features/undo.json index b54378e93b..c6c7be1648 100644 --- a/tests/v2/features/undo.json +++ b/tests/v2/features/undo.json @@ -4484,6 +4484,12 @@ "type": "safe" } }, + "GetSPARecommendationsWithShard": { + "tag": "Spa", + "undo": { + "type": "safe" + } + }, "AggregateSpans": { "tag": "Spans", "undo": {