diff --git a/.generated-info b/.generated-info index 164df7cdd1..8ae2582226 100644 --- a/.generated-info +++ b/.generated-info @@ -1,4 +1,4 @@ { - "spec_repo_commit": "d58cb84", - "generated": "2025-08-22 18:45:21.021" + "spec_repo_commit": "205813d", + "generated": "2025-08-25 08:41:57.392" } diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 997d486189..123b5ff156 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -9284,6 +9284,15 @@ components: that evaluates to a boolean. example: ${true} type: string + ComponentRecommendation: + description: Resource recommendation for a single Spark component (driver or + executor). Contains estimation data used to patch Spark job specs. + properties: + estimation: + $ref: '#/components/schemas/Estimation' + required: + - estimation + type: object ComponentType: description: The UI component type. enum: @@ -10480,6 +10489,28 @@ components: type: string x-enum-varnames: - COST_BY_ORG + Cpu: + description: CPU usage statistics derived from historical Spark job metrics. + Provides multiple estimates so users can choose between conservative and cost-saving + risk profiles. + properties: + max: + description: Maximum CPU usage observed for the job, expressed in millicores. + This represents the upper bound of usage. + format: int64 + type: integer + p75: + description: 75th percentile of CPU usage (millicores). Represents a cost-saving + configuration while covering most workloads. + format: int64 + type: integer + p95: + description: 95th percentile of CPU usage (millicores). Balances performance + and cost, providing a safer margin than p75. + format: int64 + type: integer + type: object + x-model-simple-name: SpaCpu CreateActionConnectionRequest: description: Request used to create an action connection. properties: @@ -15937,6 +15968,33 @@ components: type: string x-enum-varnames: - ESCALATION_POLICY_STEPS + Estimation: + description: Recommended resource values for a Spark driver or executor, derived + from recent real usage metrics. Used by SPA to propose more efficient pod + sizing. + properties: + cpu: + $ref: '#/components/schemas/Cpu' + ephemeral_storage: + description: Recommended ephemeral storage allocation (in MiB). Derived + from job temporary storage patterns. + format: int64 + type: integer + heap: + description: Recommended JVM heap size (in MiB). + format: int64 + type: integer + memory: + description: Recommended total memory allocation (in MiB). Includes both + heap and overhead. + format: int64 + type: integer + overhead: + description: Recommended JVM overhead (in MiB). Computed as total memory + - heap. + format: int64 + type: integer + type: object Event: description: The metadata associated with a request. properties: @@ -32835,6 +32893,52 @@ components: x-enum-varnames: - ANY - ALL + RecommendationAttributes: + description: Attributes of the SPA Recommendation resource. Contains recommendations + for both driver and executor components. + properties: + driver: + $ref: '#/components/schemas/ComponentRecommendation' + executor: + $ref: '#/components/schemas/ComponentRecommendation' + required: + - driver + - executor + type: object + RecommendationData: + description: JSON:API resource object for SPA Recommendation. Includes type, + optional ID, and resource attributes with structured recommendations. + properties: + attributes: + $ref: '#/components/schemas/RecommendationAttributes' + id: + description: Resource identifier for the recommendation. Optional in responses. + type: string + type: + $ref: '#/components/schemas/RecommendationType' + required: + - type + - attributes + type: object + RecommendationDocument: + description: JSON:API document containing a single Recommendation resource. + Returned by SPA when the Spark Gateway requests recommendations. + properties: + data: + $ref: '#/components/schemas/RecommendationData' + required: + - data + type: object + RecommendationType: + default: recommendation + description: JSON:API resource type for Spark Pod Autosizing recommendations. + Identifies the Recommendation resource returned by SPA. + enum: + - recommendation + example: recommendation + type: string + x-enum-varnames: + - RECOMMENDATION RegisterAppKeyResponse: description: The response object after creating an app key registration. properties: @@ -65710,6 +65814,69 @@ 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}: + 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. + operationId: GetSPARecommendations + parameters: + - description: The shard tag for a spark job, which differentiates jobs within + the same service that have different resource needs + in: path + name: shard + required: true + 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' + summary: Get SPA Recommendations + 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.' /api/v2/spans/analytics/aggregate: post: description: 'The API endpoint to aggregate spans into buckets and compute metrics @@ -69127,6 +69294,9 @@ tags: externalDocs: url: https://docs.datadoghq.com/service_catalog/service_definitions#metadata-schema-v30-beta name: Software Catalog +- description: SPA (Spark Pod Autosizing) API. Provides resource recommendations and + cost insights to help optimize Spark job configurations. + name: Spa - description: Search and aggregate your spans from your Datadog platform over HTTP. name: Spans - description: Manage configuration of [span-based metrics](https://app.datadoghq.com/apm/traces/generate-metrics) diff --git a/docs/datadog_api_client.v2.api.rst b/docs/datadog_api_client.v2.api.rst index 474d361052..503ed65d6b 100644 --- a/docs/datadog_api_client.v2.api.rst +++ b/docs/datadog_api_client.v2.api.rst @@ -452,6 +452,13 @@ datadog\_api\_client.v2.api.software\_catalog\_api module :members: :show-inheritance: +datadog\_api\_client.v2.api.spa\_api module +------------------------------------------- + +.. automodule:: datadog_api_client.v2.api.spa_api + :members: + :show-inheritance: + datadog\_api\_client.v2.api.spans\_api module --------------------------------------------- diff --git a/docs/datadog_api_client.v2.model.rst b/docs/datadog_api_client.v2.model.rst index 31bdac915a..2f8c1b79c8 100644 --- a/docs/datadog_api_client.v2.model.rst +++ b/docs/datadog_api_client.v2.model.rst @@ -3686,6 +3686,13 @@ datadog\_api\_client.v2.model.component\_properties\_is\_visible module :members: :show-inheritance: +datadog\_api\_client.v2.model.component\_recommendation module +-------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.component_recommendation + :members: + :show-inheritance: + datadog\_api\_client.v2.model.component\_type module ---------------------------------------------------- @@ -4225,6 +4232,13 @@ datadog\_api\_client.v2.model.cost\_by\_org\_type module :members: :show-inheritance: +datadog\_api\_client.v2.model.cpu module +---------------------------------------- + +.. automodule:: datadog_api_client.v2.model.cpu + :members: + :show-inheritance: + datadog\_api\_client.v2.model.create\_action\_connection\_request module ------------------------------------------------------------------------ @@ -6675,6 +6689,13 @@ datadog\_api\_client.v2.model.escalation\_type module :members: :show-inheritance: +datadog\_api\_client.v2.model.estimation module +----------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.estimation + :members: + :show-inheritance: + datadog\_api\_client.v2.model.event module ------------------------------------------ @@ -14179,6 +14200,34 @@ datadog\_api\_client.v2.model.readiness\_gate\_threshold\_type module :members: :show-inheritance: +datadog\_api\_client.v2.model.recommendation\_attributes module +--------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.recommendation_attributes + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.recommendation\_data module +--------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.recommendation_data + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.recommendation\_document module +------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.recommendation_document + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.recommendation\_type module +--------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.recommendation_type + :members: + :show-inheritance: + datadog\_api\_client.v2.model.register\_app\_key\_response module ----------------------------------------------------------------- diff --git a/examples/v2/spa/GetSPARecommendations.py b/examples/v2/spa/GetSPARecommendations.py new file mode 100644 index 0000000000..6805f2996a --- /dev/null +++ b/examples/v2/spa/GetSPARecommendations.py @@ -0,0 +1,17 @@ +""" +Get SPA Recommendations 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"] = True +with ApiClient(configuration) as api_client: + api_instance = SpaApi(api_client) + response = api_instance.get_spa_recommendations( + shard="shard", + service="service", + ) + + print(response) diff --git a/src/datadog_api_client/configuration.py b/src/datadog_api_client/configuration.py index 4f0446b2b2..db01c60e2b 100644 --- a/src/datadog_api_client/configuration.py +++ b/src/datadog_api_client/configuration.py @@ -321,6 +321,7 @@ def __init__( "v2.create_slo_report_job": False, "v2.get_slo_report": False, "v2.get_slo_report_job_status": False, + "v2.get_spa_recommendations": False, "v2.add_member_team": False, "v2.list_member_teams": False, "v2.remove_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 new file mode 100644 index 0000000000..4a2f6f198b --- /dev/null +++ b/src/datadog_api_client/v2/api/spa_api.py @@ -0,0 +1,72 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Any, Dict + +from datadog_api_client.api_client import ApiClient, Endpoint as _Endpoint +from datadog_api_client.configuration import Configuration +from datadog_api_client.v2.model.recommendation_document import RecommendationDocument + + +class SpaApi: + """ + SPA (Spark Pod Autosizing) API. Provides resource recommendations and cost insights to help optimize Spark job configurations. + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient(Configuration()) + self.api_client = api_client + + self._get_spa_recommendations_endpoint = _Endpoint( + settings={ + "response_type": (RecommendationDocument,), + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/spa/recommendations/{service}/{shard}", + "operation_id": "get_spa_recommendations", + "http_method": "GET", + "version": "v2", + }, + params_map={ + "shard": { + "required": True, + "openapi_types": (str,), + "attribute": "shard", + "location": "path", + }, + "service": { + "required": True, + "openapi_types": (str,), + "attribute": "service", + "location": "path", + }, + }, + headers_map={ + "accept": ["application/json"], + }, + api_client=api_client, + ) + + def get_spa_recommendations( + self, + shard: str, + service: str, + ) -> 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. + + :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 + :rtype: RecommendationDocument + """ + kwargs: Dict[str, Any] = {} + kwargs["shard"] = shard + + kwargs["service"] = service + + return self._get_spa_recommendations_endpoint.call_with_http_info(**kwargs) diff --git a/src/datadog_api_client/v2/apis/__init__.py b/src/datadog_api_client/v2/apis/__init__.py index 8848a8692e..30a5f51bd2 100644 --- a/src/datadog_api_client/v2/apis/__init__.py +++ b/src/datadog_api_client/v2/apis/__init__.py @@ -62,6 +62,7 @@ from datadog_api_client.v2.api.service_level_objectives_api import ServiceLevelObjectivesApi from datadog_api_client.v2.api.service_scorecards_api import ServiceScorecardsApi from datadog_api_client.v2.api.software_catalog_api import SoftwareCatalogApi +from datadog_api_client.v2.api.spa_api import SpaApi from datadog_api_client.v2.api.spans_api import SpansApi from datadog_api_client.v2.api.spans_metrics_api import SpansMetricsApi from datadog_api_client.v2.api.synthetics_api import SyntheticsApi @@ -136,6 +137,7 @@ "ServiceLevelObjectivesApi", "ServiceScorecardsApi", "SoftwareCatalogApi", + "SpaApi", "SpansApi", "SpansMetricsApi", "SyntheticsApi", diff --git a/src/datadog_api_client/v2/model/component_recommendation.py b/src/datadog_api_client/v2/model/component_recommendation.py new file mode 100644 index 0000000000..5f5130e497 --- /dev/null +++ b/src/datadog_api_client/v2/model/component_recommendation.py @@ -0,0 +1,40 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.estimation import Estimation + + +class ComponentRecommendation(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.estimation import Estimation + + return { + "estimation": (Estimation,), + } + + attribute_map = { + "estimation": "estimation", + } + + def __init__(self_, estimation: Estimation, **kwargs): + """ + Resource recommendation for a single Spark component (driver or executor). Contains estimation data used to patch Spark job specs. + + :param estimation: Recommended resource values for a Spark driver or executor, derived from recent real usage metrics. Used by SPA to propose more efficient pod sizing. + :type estimation: Estimation + """ + super().__init__(kwargs) + + self_.estimation = estimation diff --git a/src/datadog_api_client/v2/model/cpu.py b/src/datadog_api_client/v2/model/cpu.py new file mode 100644 index 0000000000..3184d035e1 --- /dev/null +++ b/src/datadog_api_client/v2/model/cpu.py @@ -0,0 +1,56 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Union + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +class Cpu(ModelNormal): + @cached_property + def openapi_types(_): + return { + "max": (int,), + "p75": (int,), + "p95": (int,), + } + + attribute_map = { + "max": "max", + "p75": "p75", + "p95": "p95", + } + + def __init__( + self_, + max: Union[int, UnsetType] = unset, + p75: Union[int, UnsetType] = unset, + p95: Union[int, UnsetType] = unset, + **kwargs, + ): + """ + CPU usage statistics derived from historical Spark job metrics. Provides multiple estimates so users can choose between conservative and cost-saving risk profiles. + + :param max: Maximum CPU usage observed for the job, expressed in millicores. This represents the upper bound of usage. + :type max: int, optional + + :param p75: 75th percentile of CPU usage (millicores). Represents a cost-saving configuration while covering most workloads. + :type p75: int, optional + + :param p95: 95th percentile of CPU usage (millicores). Balances performance and cost, providing a safer margin than p75. + :type p95: int, optional + """ + if max is not unset: + kwargs["max"] = max + if p75 is not unset: + kwargs["p75"] = p75 + if p95 is not unset: + kwargs["p95"] = p95 + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/estimation.py b/src/datadog_api_client/v2/model/estimation.py new file mode 100644 index 0000000000..919215813d --- /dev/null +++ b/src/datadog_api_client/v2/model/estimation.py @@ -0,0 +1,78 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.cpu import Cpu + + +class Estimation(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.cpu import Cpu + + return { + "cpu": (Cpu,), + "ephemeral_storage": (int,), + "heap": (int,), + "memory": (int,), + "overhead": (int,), + } + + attribute_map = { + "cpu": "cpu", + "ephemeral_storage": "ephemeral_storage", + "heap": "heap", + "memory": "memory", + "overhead": "overhead", + } + + def __init__( + self_, + cpu: Union[Cpu, UnsetType] = unset, + ephemeral_storage: Union[int, UnsetType] = unset, + heap: Union[int, UnsetType] = unset, + memory: Union[int, UnsetType] = unset, + overhead: Union[int, UnsetType] = unset, + **kwargs, + ): + """ + Recommended resource values for a Spark driver or executor, derived from recent real usage metrics. Used by SPA to propose more efficient pod sizing. + + :param cpu: CPU usage statistics derived from historical Spark job metrics. Provides multiple estimates so users can choose between conservative and cost-saving risk profiles. + :type cpu: Cpu, optional + + :param ephemeral_storage: Recommended ephemeral storage allocation (in MiB). Derived from job temporary storage patterns. + :type ephemeral_storage: int, optional + + :param heap: Recommended JVM heap size (in MiB). + :type heap: int, optional + + :param memory: Recommended total memory allocation (in MiB). Includes both heap and overhead. + :type memory: int, optional + + :param overhead: Recommended JVM overhead (in MiB). Computed as total memory - heap. + :type overhead: int, optional + """ + if cpu is not unset: + kwargs["cpu"] = cpu + if ephemeral_storage is not unset: + kwargs["ephemeral_storage"] = ephemeral_storage + if heap is not unset: + kwargs["heap"] = heap + if memory is not unset: + kwargs["memory"] = memory + if overhead is not unset: + kwargs["overhead"] = overhead + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/recommendation_attributes.py b/src/datadog_api_client/v2/model/recommendation_attributes.py new file mode 100644 index 0000000000..f817d34e01 --- /dev/null +++ b/src/datadog_api_client/v2/model/recommendation_attributes.py @@ -0,0 +1,46 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.component_recommendation import ComponentRecommendation + + +class RecommendationAttributes(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.component_recommendation import ComponentRecommendation + + return { + "driver": (ComponentRecommendation,), + "executor": (ComponentRecommendation,), + } + + attribute_map = { + "driver": "driver", + "executor": "executor", + } + + def __init__(self_, driver: ComponentRecommendation, executor: ComponentRecommendation, **kwargs): + """ + Attributes of the SPA Recommendation resource. Contains recommendations for both driver and executor components. + + :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 + """ + super().__init__(kwargs) + + self_.driver = driver + self_.executor = executor diff --git a/src/datadog_api_client/v2/model/recommendation_data.py b/src/datadog_api_client/v2/model/recommendation_data.py new file mode 100644 index 0000000000..d52f628808 --- /dev/null +++ b/src/datadog_api_client/v2/model/recommendation_data.py @@ -0,0 +1,63 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.recommendation_attributes import RecommendationAttributes + from datadog_api_client.v2.model.recommendation_type import RecommendationType + + +class RecommendationData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.recommendation_attributes import RecommendationAttributes + from datadog_api_client.v2.model.recommendation_type import RecommendationType + + return { + "attributes": (RecommendationAttributes,), + "id": (str,), + "type": (RecommendationType,), + } + + attribute_map = { + "attributes": "attributes", + "id": "id", + "type": "type", + } + + def __init__( + self_, + attributes: RecommendationAttributes, + type: RecommendationType, + id: Union[str, UnsetType] = unset, + **kwargs, + ): + """ + JSON:API resource object for SPA Recommendation. Includes type, optional ID, and resource attributes with structured recommendations. + + :param attributes: Attributes of the SPA Recommendation resource. Contains recommendations for both driver and executor components. + :type attributes: RecommendationAttributes + + :param id: Resource identifier for the recommendation. Optional in responses. + :type id: str, optional + + :param type: JSON:API resource type for Spark Pod Autosizing recommendations. Identifies the Recommendation resource returned by SPA. + :type type: RecommendationType + """ + if id is not unset: + kwargs["id"] = id + super().__init__(kwargs) + + self_.attributes = attributes + self_.type = type diff --git a/src/datadog_api_client/v2/model/recommendation_document.py b/src/datadog_api_client/v2/model/recommendation_document.py new file mode 100644 index 0000000000..1799696fef --- /dev/null +++ b/src/datadog_api_client/v2/model/recommendation_document.py @@ -0,0 +1,40 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.recommendation_data import RecommendationData + + +class RecommendationDocument(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.recommendation_data import RecommendationData + + return { + "data": (RecommendationData,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: RecommendationData, **kwargs): + """ + JSON:API document containing a single Recommendation resource. Returned by SPA when the Spark Gateway requests recommendations. + + :param data: JSON:API resource object for SPA Recommendation. Includes type, optional ID, and resource attributes with structured recommendations. + :type data: RecommendationData + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/recommendation_type.py b/src/datadog_api_client/v2/model/recommendation_type.py new file mode 100644 index 0000000000..75568c6e9c --- /dev/null +++ b/src/datadog_api_client/v2/model/recommendation_type.py @@ -0,0 +1,35 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class RecommendationType(ModelSimple): + """ + JSON:API resource type for Spark Pod Autosizing recommendations. Identifies the Recommendation resource returned by SPA. + + :param value: If omitted defaults to "recommendation". Must be one of ["recommendation"]. + :type value: str + """ + + allowed_values = { + "recommendation", + } + RECOMMENDATION: ClassVar["RecommendationType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +RecommendationType.RECOMMENDATION = RecommendationType("recommendation") diff --git a/src/datadog_api_client/v2/models/__init__.py b/src/datadog_api_client/v2/models/__init__.py index 76b18d03ca..a370727c3b 100644 --- a/src/datadog_api_client/v2/models/__init__.py +++ b/src/datadog_api_client/v2/models/__init__.py @@ -700,6 +700,7 @@ from datadog_api_client.v2.model.component_grid_type import ComponentGridType from datadog_api_client.v2.model.component_properties import ComponentProperties from datadog_api_client.v2.model.component_properties_is_visible import ComponentPropertiesIsVisible +from datadog_api_client.v2.model.component_recommendation import ComponentRecommendation from datadog_api_client.v2.model.component_type import ComponentType from datadog_api_client.v2.model.config_cat_credentials import ConfigCatCredentials from datadog_api_client.v2.model.config_cat_credentials_update import ConfigCatCredentialsUpdate @@ -783,6 +784,7 @@ from datadog_api_client.v2.model.cost_by_org_attributes import CostByOrgAttributes from datadog_api_client.v2.model.cost_by_org_response import CostByOrgResponse from datadog_api_client.v2.model.cost_by_org_type import CostByOrgType +from datadog_api_client.v2.model.cpu import Cpu from datadog_api_client.v2.model.create_action_connection_request import CreateActionConnectionRequest from datadog_api_client.v2.model.create_action_connection_response import CreateActionConnectionResponse from datadog_api_client.v2.model.create_app_request import CreateAppRequest @@ -1270,6 +1272,7 @@ from datadog_api_client.v2.model.escalation_target import EscalationTarget from datadog_api_client.v2.model.escalation_targets import EscalationTargets from datadog_api_client.v2.model.escalation_type import EscalationType +from datadog_api_client.v2.model.estimation import Estimation from datadog_api_client.v2.model.event import Event from datadog_api_client.v2.model.event_attributes import EventAttributes from datadog_api_client.v2.model.event_category import EventCategory @@ -2889,6 +2892,10 @@ from datadog_api_client.v2.model.rum_warning import RUMWarning from datadog_api_client.v2.model.readiness_gate import ReadinessGate from datadog_api_client.v2.model.readiness_gate_threshold_type import ReadinessGateThresholdType +from datadog_api_client.v2.model.recommendation_attributes import RecommendationAttributes +from datadog_api_client.v2.model.recommendation_data import RecommendationData +from datadog_api_client.v2.model.recommendation_document import RecommendationDocument +from datadog_api_client.v2.model.recommendation_type import RecommendationType from datadog_api_client.v2.model.register_app_key_response import RegisterAppKeyResponse from datadog_api_client.v2.model.relation_attributes import RelationAttributes from datadog_api_client.v2.model.relation_entity import RelationEntity @@ -4468,6 +4475,7 @@ "ComponentGridType", "ComponentProperties", "ComponentPropertiesIsVisible", + "ComponentRecommendation", "ComponentType", "ConfigCatCredentials", "ConfigCatCredentialsUpdate", @@ -4545,6 +4553,7 @@ "CostByOrgAttributes", "CostByOrgResponse", "CostByOrgType", + "Cpu", "CreateActionConnectionRequest", "CreateActionConnectionResponse", "CreateAppRequest", @@ -4894,6 +4903,7 @@ "EscalationTarget", "EscalationTargets", "EscalationType", + "Estimation", "Event", "EventAttributes", "EventCategory", @@ -6019,6 +6029,10 @@ "RUMWarning", "ReadinessGate", "ReadinessGateThresholdType", + "RecommendationAttributes", + "RecommendationData", + "RecommendationDocument", + "RecommendationType", "RegisterAppKeyResponse", "RelationAttributes", "RelationEntity", diff --git a/tests/v2/features/spa.feature b/tests/v2/features/spa.feature new file mode 100644 index 0000000000..327bbf16ac --- /dev/null +++ b/tests/v2/features/spa.feature @@ -0,0 +1,54 @@ +@endpoint(spa) @endpoint(spa-v2) +Feature: Spa + SPA (Spark Pod Autosizing) API. Provides resource recommendations and cost + 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 + + @generated @skip @team:DataDog/data-and-analytics-processing + Scenario: Get SPA Recommendations returns "Bad Request" response + Given 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 returns "OK" response + Given 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" + And request contains "shard" parameter with value "adp_dedupeactivecontexts_org2" + When the request is sent + Then the response status is 404 Not Found + And the response "data.type" is equal to "recommendation" + And the response "data" has field "attributes" + And the response "data.attributes" has field "driver" + And the response "data.attributes" has field "executor" + And the response "data.attributes.driver" has field "estimation" + And the response "data.attributes.driver.estimation" has field "cpu" + And the response "data.attributes.driver.estimation" has field "memory" + And the response "data.attributes.driver.estimation" has field "ephemeral_storage" + And the response "data.attributes.driver.estimation" has field "heap" + And the response "data.attributes.driver.estimation" has field "overhead" + And the response "data.attributes.driver.estimation.cpu" has field "max" + And the response "data.attributes.driver.estimation.cpu" has field "p95" + And the response "data.attributes.driver.estimation.cpu" has field "p75" + And the response "data.attributes.executor" has field "estimation" + And the response "data.attributes.executor.estimation" has field "cpu" + And the response "data.attributes.executor.estimation" has field "memory" + And the response "data.attributes.executor.estimation" has field "ephemeral_storage" + And the response "data.attributes.executor.estimation" has field "heap" + And the response "data.attributes.executor.estimation" has field "overhead" + And the response "data.attributes.executor.estimation.cpu" has field "max" + And the response "data.attributes.executor.estimation.cpu" has field "p95" + And the response "data.attributes.executor.estimation.cpu" has field "p75" diff --git a/tests/v2/features/undo.json b/tests/v2/features/undo.json index 6f5c5499f1..9878d7a467 100644 --- a/tests/v2/features/undo.json +++ b/tests/v2/features/undo.json @@ -3362,6 +3362,12 @@ "type": "safe" } }, + "GetSPARecommendations": { + "tag": "Spa", + "undo": { + "type": "safe" + } + }, "AggregateSpans": { "tag": "Spans", "undo": {