Skip to content

Commit 0701270

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Add a new end point that allows the SPA recommendation to be called without the shard parameter (#3374)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent d4b6104 commit 0701270

File tree

8 files changed

+496
-44
lines changed

8 files changed

+496
-44
lines changed

.generator/schemas/v2/openapi.yaml

Lines changed: 83 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42828,6 +42828,9 @@ components:
4282842828
description: Attributes of the SPA Recommendation resource. Contains recommendations
4282942829
for both driver and executor components.
4283042830
properties:
42831+
confidence_level:
42832+
format: double
42833+
type: number
4283142834
driver:
4283242835
$ref: '#/components/schemas/ComponentRecommendation'
4283342836
executor:
@@ -86626,13 +86629,79 @@ paths:
8662686629
x-unstable: '**Note**: This feature is in private beta. To request access, use
8662786630
the request access form in the [Service Level Objectives](https://docs.datadoghq.com/service_management/service_level_objectives/#slo-csv-export)
8662886631
docs.'
86629-
/api/v2/spa/recommendations/{service}/{shard}:
86632+
/api/v2/spa/recommendations/{service}:
8663086633
get:
86631-
description: Retrieve resource recommendations for a Spark job. The caller (Spark
86632-
Gateway or DJM UI) provides a service name and shard identifier, and SPA returns
86633-
structured recommendations for driver and executor resources.
86634+
description: This endpoint is currently experimental and restricted to Datadog
86635+
internal use only. Retrieve resource recommendations for a Spark job. The
86636+
caller (Spark Gateway or DJM UI) provides a service name and SPA returns structured
86637+
recommendations for driver and executor resources. The version with a shard
86638+
should be preferred, where possible, as it gives more accurate results.
8663486639
operationId: GetSPARecommendations
8663586640
parameters:
86641+
- description: The recommendation service should not use its metrics cache.
86642+
in: query
86643+
name: bypass_cache
86644+
schema:
86645+
type: string
86646+
- description: The service name for a spark job.
86647+
in: path
86648+
name: service
86649+
required: true
86650+
schema:
86651+
type: string
86652+
responses:
86653+
'200':
86654+
content:
86655+
application/json:
86656+
example:
86657+
data:
86658+
attributes:
86659+
driver:
86660+
estimation:
86661+
cpu:
86662+
max: 1500
86663+
p75: 1000
86664+
p95: 1200
86665+
ephemeral_storage: 896
86666+
heap: 6144
86667+
memory: 7168
86668+
overhead: 1024
86669+
executor:
86670+
estimation:
86671+
cpu:
86672+
max: 2000
86673+
p75: 1200
86674+
p95: 1500
86675+
ephemeral_storage: 512
86676+
heap: 3072
86677+
memory: 4096
86678+
overhead: 1024
86679+
id: dedupeactivecontexts:adp_dedupeactivecontexts_org2
86680+
type: recommendation
86681+
schema:
86682+
$ref: '#/components/schemas/RecommendationDocument'
86683+
description: OK
86684+
'400':
86685+
$ref: '#/components/responses/BadRequestResponse'
86686+
'403':
86687+
$ref: '#/components/responses/NotAuthorizedResponse'
86688+
'429':
86689+
$ref: '#/components/responses/TooManyRequestsResponse'
86690+
security:
86691+
- AuthZ: []
86692+
summary: Get SPA Recommendations
86693+
tags:
86694+
- Spa
86695+
x-unstable: '**Note**: This endpoint is in preview and may change in the future.
86696+
It is not yet recommended for production use.'
86697+
/api/v2/spa/recommendations/{service}/{shard}:
86698+
get:
86699+
description: This endpoint is currently experimental and restricted to Datadog
86700+
internal use only. Retrieve resource recommendations for a Spark job. The
86701+
caller (Spark Gateway or DJM UI) provides a service name and shard identifier,
86702+
and SPA returns structured recommendations for driver and executor resources.
86703+
operationId: GetSPARecommendationsWithShard
86704+
parameters:
8663686705
- description: The shard tag for a spark job, which differentiates jobs within
8663786706
the same service that have different resource needs
8663886707
in: path
@@ -86646,6 +86715,11 @@ paths:
8664686715
required: true
8664786716
schema:
8664886717
type: string
86718+
- description: The recommendation service should not use its metrics cache.
86719+
in: query
86720+
name: bypass_cache
86721+
schema:
86722+
type: string
8664986723
responses:
8665086724
'200':
8665186725
content:
@@ -86684,11 +86758,13 @@ paths:
8668486758
$ref: '#/components/responses/NotAuthorizedResponse'
8668586759
'429':
8668686760
$ref: '#/components/responses/TooManyRequestsResponse'
86687-
summary: Get SPA Recommendations
86761+
security:
86762+
- AuthZ: []
86763+
summary: Get SPA Recommendations with a shard parameter
8668886764
tags:
8668986765
- Spa
86690-
x-unstable: '**Note**: This endpoint is in public beta and may change in the
86691-
future. It is not yet recommended for production use.'
86766+
x-unstable: '**Note**: This endpoint is in preview and may change in the future.
86767+
It is not yet recommended for production use.'
8669286768
/api/v2/spans/analytics/aggregate:
8669386769
post:
8669486770
description: 'The API endpoint to aggregate spans into buckets and compute metrics

examples/v2/spa/GetSPARecommendations.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public static void main(String[] args) {
1212
SpaApi apiInstance = new SpaApi(defaultClient);
1313

1414
try {
15-
RecommendationDocument result = apiInstance.getSPARecommendations("shard", "service");
15+
RecommendationDocument result = apiInstance.getSPARecommendations("service");
1616
System.out.println(result);
1717
} catch (ApiException e) {
1818
System.err.println("Exception when calling SpaApi#getSPARecommendations");
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// Get SPA Recommendations with a shard parameter returns "OK" response
2+
3+
import com.datadog.api.client.ApiClient;
4+
import com.datadog.api.client.ApiException;
5+
import com.datadog.api.client.v2.api.SpaApi;
6+
import com.datadog.api.client.v2.model.RecommendationDocument;
7+
8+
public class Example {
9+
public static void main(String[] args) {
10+
ApiClient defaultClient = ApiClient.getDefaultApiClient();
11+
defaultClient.setUnstableOperationEnabled("v2.getSPARecommendationsWithShard", true);
12+
SpaApi apiInstance = new SpaApi(defaultClient);
13+
14+
try {
15+
RecommendationDocument result =
16+
apiInstance.getSPARecommendationsWithShard("shard", "service");
17+
System.out.println(result);
18+
} catch (ApiException e) {
19+
System.err.println("Exception when calling SpaApi#getSPARecommendationsWithShard");
20+
System.err.println("Status code: " + e.getCode());
21+
System.err.println("Reason: " + e.getResponseBody());
22+
System.err.println("Response headers: " + e.getResponseHeaders());
23+
e.printStackTrace();
24+
}
25+
}
26+
}

src/main/java/com/datadog/api/client/ApiClient.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -901,6 +901,7 @@ public class ApiClient {
901901
put("v2.getSLOReport", false);
902902
put("v2.getSLOReportJobStatus", false);
903903
put("v2.getSPARecommendations", false);
904+
put("v2.getSPARecommendationsWithShard", false);
904905
put("v2.createSCAResolveVulnerableSymbols", false);
905906
put("v2.createSCAResult", false);
906907
put("v2.addMemberTeam", false);

0 commit comments

Comments
 (0)