Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
105 changes: 105 additions & 0 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -92998,6 +92998,49 @@ components:
type: string
x-enum-varnames:
- RECOMMENDATION
RecommendationV2RequestAttributes:
description: |-
Attributes for requesting SPA recommendations by forwarding a Spark job's raw arguments
instead of a precomputed shard.
properties:
arguments:
description: |-
Raw, unfiltered Spark job arguments as submitted (for example, `--org_id=2`).
SPA determines which arguments are relevant for the given service.
example:
- ""
items:
type: string
type: array
required: [arguments]
type: object
RecommendationV2RequestBody:
description: |-
Request body for retrieving SPA recommendations by forwarding a Spark job's raw arguments
instead of a precomputed shard.
properties:
data:
$ref: "#/components/schemas/RecommendationV2RequestData"
required: [data]
type: object
RecommendationV2RequestData:
description: JSON:API resource object for the SPA v2 recommendation request.
properties:
attributes:
$ref: "#/components/schemas/RecommendationV2RequestAttributes"
type:
$ref: "#/components/schemas/RecommendationV2RequestType"
required: [type, attributes]
type: object
RecommendationV2RequestType:
default: recommendation_v2_request
description: JSON:API resource type for the SPA v2 recommendation request.
enum:
- recommendation_v2_request
example: recommendation_v2_request
type: string
x-enum-varnames:
- RECOMMENDATION_V2_REQUEST
RecommendationsFilterRequest:
description: JSON:API request body for filtering cost recommendations.
example:
Expand Down Expand Up @@ -218752,6 +218795,68 @@ paths:
x-unstable: |-
**Note**: This endpoint is in preview and is subject to change.
If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).
/api/v2/spa/recommendations-v2/{service}:
post:
description: |-
This endpoint is experimental and restricted to Datadog internal use only.
Retrieve resource recommendations for a Spark job. The caller (Spark Gateway) provides
a service name and the job's raw arguments. SPA determines which arguments are relevant
for the service and returns structured recommendations for driver and executor resources.
operationId: GetSPARecommendationsV2
parameters:
- description: The service name for a Spark job
in: path
name: service
required: true
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/RecommendationV2RequestBody"
required: true
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"
"404":
$ref: "#/components/responses/NotFoundResponse"
"429":
$ref: "#/components/responses/TooManyRequestsResponse"
security:
- AuthZ: []
summary: Get SPA recommendations v2
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}:
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 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.
Expand Down
36 changes: 36 additions & 0 deletions examples/v2/spa/GetSPARecommendationsV2.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/**
* Get SPA recommendations v2 returns "OK" response
*/

import { client, v2 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration({
authMethods: {
AuthZ: {
accessToken: process.env.DD_BEARER_TOKEN as string,
},
},
});
configuration.unstableOperations["v2.getSPARecommendationsV2"] = true;
const apiInstance = new v2.SpaApi(configuration);

const params: v2.SpaApiGetSPARecommendationsV2Request = {
body: {
data: {
attributes: {
arguments: [""],
},
type: "recommendation_v2_request",
},
},
service: "service",
};

apiInstance
.getSPARecommendationsV2(params)
.then((data: v2.RecommendationDocument) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
})
.catch((error: any) => console.error(error));
11 changes: 11 additions & 0 deletions features/support/scenarios_model_mapping.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17361,6 +17361,17 @@ export const ScenariosModelMappings: {[key: string]: {[key: string]: any}} = {
},
"operationResponseType": "CreateSnapshotResponse",
},
"v2.GetSPARecommendationsV2": {
"service": {
"type": "string",
"format": "",
},
"body": {
"type": "RecommendationV2RequestBody",
"format": "",
},
"operationResponseType": "RecommendationDocument",
},
"v2.GetSPARecommendations": {
"bypassCache": {
"type": "string",
Expand Down
27 changes: 27 additions & 0 deletions features/v2/spa.feature
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,33 @@ Feature: Spa
When the request is sent
Then the response status is 200 OK

@generated @skip @team:DataDog/data-and-analytics-processing
Scenario: Get SPA recommendations v2 returns "Bad Request" response
Given operation "GetSPARecommendationsV2" enabled
And new "GetSPARecommendationsV2" request
And request contains "service" parameter from "REPLACE.ME"
And body with value {"data": {"attributes": {"arguments": [""]}, "type": "recommendation_v2_request"}}
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 v2 returns "Not Found" response
Given operation "GetSPARecommendationsV2" enabled
And new "GetSPARecommendationsV2" request
And request contains "service" parameter from "REPLACE.ME"
And body with value {"data": {"attributes": {"arguments": [""]}, "type": "recommendation_v2_request"}}
When the request is sent
Then the response status is 404 Not Found

@generated @skip @team:DataDog/data-and-analytics-processing
Scenario: Get SPA recommendations v2 returns "OK" response
Given operation "GetSPARecommendationsV2" enabled
And new "GetSPARecommendationsV2" request
And request contains "service" parameter from "REPLACE.ME"
And body with value {"data": {"attributes": {"arguments": [""]}, "type": "recommendation_v2_request"}}
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 new "GetSPARecommendations" request
Expand Down
6 changes: 6 additions & 0 deletions features/v2/undo.json
Original file line number Diff line number Diff line change
Expand Up @@ -9323,6 +9323,12 @@
"type": "unsafe"
}
},
"GetSPARecommendationsV2": {
"tag": "Spa",
"undo": {
"type": "safe"
}
},
"GetSPARecommendations": {
"tag": "Spa",
"undo": {
Expand Down
1 change: 1 addition & 0 deletions packages/datadog-api-client-common/configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -811,6 +811,7 @@ export function createConfiguration(
"v2.getSloStatus": false,
"v2.createSnapshot": false,
"v2.getSPARecommendations": false,
"v2.getSPARecommendationsV2": false,
"v2.getSPARecommendationsWithShard": false,
"v2.createAiCustomRule": false,
"v2.createAiCustomRuleRevision": false,
Expand Down
Loading
Loading