Skip to content

Commit ccfdfb6

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit 081afac of spec repo
1 parent 83dabaf commit ccfdfb6

8 files changed

Lines changed: 226 additions & 24 deletions

File tree

.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:
@@ -86625,13 +86628,79 @@ paths:
8662586628
x-unstable: '**Note**: This feature is in private beta. To request access, use
8662686629
the request access form in the [Service Level Objectives](https://docs.datadoghq.com/service_management/service_level_objectives/#slo-csv-export)
8662786630
docs.'
86628-
/api/v2/spa/recommendations/{service}/{shard}:
86631+
/api/v2/spa/recommendations/{service}:
8662986632
get:
86630-
description: Retrieve resource recommendations for a Spark job. The caller (Spark
86631-
Gateway or DJM UI) provides a service name and shard identifier, and SPA returns
86632-
structured recommendations for driver and executor resources.
86633+
description: This endpoint is currently experimental and restricted to Datadog
86634+
internal use only. Retrieve resource recommendations for a Spark job. The
86635+
caller (Spark Gateway or DJM UI) provides a service name and SPA returns structured
86636+
recommendations for driver and executor resources. The version with a shard
86637+
should be preferred, where possible, as it gives more accurate results.
8663386638
operationId: GetSPARecommendations
8663486639
parameters:
86640+
- description: The recommendation service should not use its metrics cache.
86641+
in: query
86642+
name: bypass_cache
86643+
schema:
86644+
type: string
86645+
- description: The service name for a spark job.
86646+
in: path
86647+
name: service
86648+
required: true
86649+
schema:
86650+
type: string
86651+
responses:
86652+
'200':
86653+
content:
86654+
application/json:
86655+
example:
86656+
data:
86657+
attributes:
86658+
driver:
86659+
estimation:
86660+
cpu:
86661+
max: 1500
86662+
p75: 1000
86663+
p95: 1200
86664+
ephemeral_storage: 896
86665+
heap: 6144
86666+
memory: 7168
86667+
overhead: 1024
86668+
executor:
86669+
estimation:
86670+
cpu:
86671+
max: 2000
86672+
p75: 1200
86673+
p95: 1500
86674+
ephemeral_storage: 512
86675+
heap: 3072
86676+
memory: 4096
86677+
overhead: 1024
86678+
id: dedupeactivecontexts:adp_dedupeactivecontexts_org2
86679+
type: recommendation
86680+
schema:
86681+
$ref: '#/components/schemas/RecommendationDocument'
86682+
description: OK
86683+
'400':
86684+
$ref: '#/components/responses/BadRequestResponse'
86685+
'403':
86686+
$ref: '#/components/responses/NotAuthorizedResponse'
86687+
'429':
86688+
$ref: '#/components/responses/TooManyRequestsResponse'
86689+
security:
86690+
- AuthZ: []
86691+
summary: Get SPA Recommendations
86692+
tags:
86693+
- Spa
86694+
x-unstable: '**Note**: This endpoint is in preview and may change in the future.
86695+
It is not yet recommended for production use.'
86696+
/api/v2/spa/recommendations/{service}/{shard}:
86697+
get:
86698+
description: This endpoint is currently experimental and restricted to Datadog
86699+
internal use only. Retrieve resource recommendations for a Spark job. The
86700+
caller (Spark Gateway or DJM UI) provides a service name and shard identifier,
86701+
and SPA returns structured recommendations for driver and executor resources.
86702+
operationId: GetSPARecommendationsWithShard
86703+
parameters:
8663586704
- description: The shard tag for a spark job, which differentiates jobs within
8663686705
the same service that have different resource needs
8663786706
in: path
@@ -86645,6 +86714,11 @@ paths:
8664586714
required: true
8664686715
schema:
8664786716
type: string
86717+
- description: The recommendation service should not use its metrics cache.
86718+
in: query
86719+
name: bypass_cache
86720+
schema:
86721+
type: string
8664886722
responses:
8664986723
'200':
8665086724
content:
@@ -86683,11 +86757,13 @@ paths:
8668386757
$ref: '#/components/responses/NotAuthorizedResponse'
8668486758
'429':
8668586759
$ref: '#/components/responses/TooManyRequestsResponse'
86686-
summary: Get SPA Recommendations
86760+
security:
86761+
- AuthZ: []
86762+
summary: Get SPA Recommendations with a shard parameter
8668786763
tags:
8668886764
- Spa
86689-
x-unstable: '**Note**: This endpoint is in public beta and may change in the
86690-
future. It is not yet recommended for production use.'
86765+
x-unstable: '**Note**: This endpoint is in preview and may change in the future.
86766+
It is not yet recommended for production use.'
8669186767
/api/v2/spans/analytics/aggregate:
8669286768
post:
8669386769
description: 'The API endpoint to aggregate spans into buckets and compute metrics

examples/v2/spa/GetSPARecommendations.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
with ApiClient(configuration) as api_client:
1111
api_instance = SpaApi(api_client)
1212
response = api_instance.get_spa_recommendations(
13-
shard="shard",
1413
service="service",
1514
)
1615

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
"""
2+
Get SPA Recommendations with a shard parameter returns "OK" response
3+
"""
4+
5+
from datadog_api_client import ApiClient, Configuration
6+
from datadog_api_client.v2.api.spa_api import SpaApi
7+
8+
configuration = Configuration()
9+
configuration.unstable_operations["get_spa_recommendations_with_shard"] = True
10+
with ApiClient(configuration) as api_client:
11+
api_instance = SpaApi(api_client)
12+
response = api_instance.get_spa_recommendations_with_shard(
13+
shard="shard",
14+
service="service",
15+
)
16+
17+
print(response)

src/datadog_api_client/configuration.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,7 @@ def __init__(
392392
"v2.get_slo_report": False,
393393
"v2.get_slo_report_job_status": False,
394394
"v2.get_spa_recommendations": False,
395+
"v2.get_spa_recommendations_with_shard": False,
395396
"v2.create_sca_resolve_vulnerable_symbols": False,
396397
"v2.create_sca_result": False,
397398
"v2.add_member_team": False,

src/datadog_api_client/v2/api/spa_api.py

Lines changed: 74 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,14 @@
33
# Copyright 2019-Present Datadog, Inc.
44
from __future__ import annotations
55

6-
from typing import Any, Dict
6+
from typing import Any, Dict, Union
77

88
from datadog_api_client.api_client import ApiClient, Endpoint as _Endpoint
99
from datadog_api_client.configuration import Configuration
10+
from datadog_api_client.model_utils import (
11+
UnsetType,
12+
unset,
13+
)
1014
from datadog_api_client.v2.model.recommendation_document import RecommendationDocument
1115

1216

@@ -23,12 +27,40 @@ def __init__(self, api_client=None):
2327
self._get_spa_recommendations_endpoint = _Endpoint(
2428
settings={
2529
"response_type": (RecommendationDocument,),
26-
"auth": ["apiKeyAuth", "appKeyAuth"],
27-
"endpoint_path": "/api/v2/spa/recommendations/{service}/{shard}",
30+
"auth": ["AuthZ"],
31+
"endpoint_path": "/api/v2/spa/recommendations/{service}",
2832
"operation_id": "get_spa_recommendations",
2933
"http_method": "GET",
3034
"version": "v2",
3135
},
36+
params_map={
37+
"bypass_cache": {
38+
"openapi_types": (str,),
39+
"attribute": "bypass_cache",
40+
"location": "query",
41+
},
42+
"service": {
43+
"required": True,
44+
"openapi_types": (str,),
45+
"attribute": "service",
46+
"location": "path",
47+
},
48+
},
49+
headers_map={
50+
"accept": ["application/json"],
51+
},
52+
api_client=api_client,
53+
)
54+
55+
self._get_spa_recommendations_with_shard_endpoint = _Endpoint(
56+
settings={
57+
"response_type": (RecommendationDocument,),
58+
"auth": ["AuthZ"],
59+
"endpoint_path": "/api/v2/spa/recommendations/{service}/{shard}",
60+
"operation_id": "get_spa_recommendations_with_shard",
61+
"http_method": "GET",
62+
"version": "v2",
63+
},
3264
params_map={
3365
"shard": {
3466
"required": True,
@@ -42,6 +74,11 @@ def __init__(self, api_client=None):
4274
"attribute": "service",
4375
"location": "path",
4476
},
77+
"bypass_cache": {
78+
"openapi_types": (str,),
79+
"attribute": "bypass_cache",
80+
"location": "query",
81+
},
4582
},
4683
headers_map={
4784
"accept": ["application/json"],
@@ -51,22 +88,53 @@ def __init__(self, api_client=None):
5188

5289
def get_spa_recommendations(
5390
self,
54-
shard: str,
5591
service: str,
92+
*,
93+
bypass_cache: Union[str, UnsetType] = unset,
5694
) -> RecommendationDocument:
5795
"""Get SPA Recommendations.
5896
59-
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.
97+
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.
98+
99+
:param service: The service name for a spark job.
100+
:type service: str
101+
:param bypass_cache: The recommendation service should not use its metrics cache.
102+
:type bypass_cache: str, optional
103+
:rtype: RecommendationDocument
104+
"""
105+
kwargs: Dict[str, Any] = {}
106+
if bypass_cache is not unset:
107+
kwargs["bypass_cache"] = bypass_cache
108+
109+
kwargs["service"] = service
110+
111+
return self._get_spa_recommendations_endpoint.call_with_http_info(**kwargs)
112+
113+
def get_spa_recommendations_with_shard(
114+
self,
115+
shard: str,
116+
service: str,
117+
*,
118+
bypass_cache: Union[str, UnsetType] = unset,
119+
) -> RecommendationDocument:
120+
"""Get SPA Recommendations with a shard parameter.
121+
122+
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.
60123
61124
:param shard: The shard tag for a spark job, which differentiates jobs within the same service that have different resource needs
62125
:type shard: str
63126
:param service: The service name for a spark job
64127
:type service: str
128+
:param bypass_cache: The recommendation service should not use its metrics cache.
129+
:type bypass_cache: str, optional
65130
:rtype: RecommendationDocument
66131
"""
67132
kwargs: Dict[str, Any] = {}
68133
kwargs["shard"] = shard
69134

70135
kwargs["service"] = service
71136

72-
return self._get_spa_recommendations_endpoint.call_with_http_info(**kwargs)
137+
if bypass_cache is not unset:
138+
kwargs["bypass_cache"] = bypass_cache
139+
140+
return self._get_spa_recommendations_with_shard_endpoint.call_with_http_info(**kwargs)

src/datadog_api_client/v2/model/recommendation_attributes.py

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@
33
# Copyright 2019-Present Datadog, Inc.
44
from __future__ import annotations
55

6-
from typing import TYPE_CHECKING
6+
from typing import Union, TYPE_CHECKING
77

88
from datadog_api_client.model_utils import (
99
ModelNormal,
1010
cached_property,
11+
unset,
12+
UnsetType,
1113
)
1214

1315

@@ -21,25 +23,38 @@ def openapi_types(_):
2123
from datadog_api_client.v2.model.component_recommendation import ComponentRecommendation
2224

2325
return {
26+
"confidence_level": (float,),
2427
"driver": (ComponentRecommendation,),
2528
"executor": (ComponentRecommendation,),
2629
}
2730

2831
attribute_map = {
32+
"confidence_level": "confidence_level",
2933
"driver": "driver",
3034
"executor": "executor",
3135
}
3236

33-
def __init__(self_, driver: ComponentRecommendation, executor: ComponentRecommendation, **kwargs):
37+
def __init__(
38+
self_,
39+
driver: ComponentRecommendation,
40+
executor: ComponentRecommendation,
41+
confidence_level: Union[float, UnsetType] = unset,
42+
**kwargs,
43+
):
3444
"""
3545
Attributes of the SPA Recommendation resource. Contains recommendations for both driver and executor components.
3646
47+
:param confidence_level:
48+
:type confidence_level: float, optional
49+
3750
:param driver: Resource recommendation for a single Spark component (driver or executor). Contains estimation data used to patch Spark job specs.
3851
:type driver: ComponentRecommendation
3952
4053
:param executor: Resource recommendation for a single Spark component (driver or executor). Contains estimation data used to patch Spark job specs.
4154
:type executor: ComponentRecommendation
4255
"""
56+
if confidence_level is not unset:
57+
kwargs["confidence_level"] = confidence_level
4358
super().__init__(kwargs)
4459

4560
self_.driver = driver

tests/v2/features/spa.feature

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,29 +4,49 @@ Feature: Spa
44
insights to help optimize Spark job configurations.
55

66
Background:
7-
Given a valid "apiKeyAuth" key in the system
8-
And a valid "appKeyAuth" key in the system
9-
And an instance of "Spa" API
10-
And operation "GetSPARecommendations" enabled
11-
And new "GetSPARecommendations" request
7+
Given an instance of "Spa" API
128

139
@generated @skip @team:DataDog/data-and-analytics-processing
1410
Scenario: Get SPA Recommendations returns "Bad Request" response
15-
Given request contains "shard" parameter from "REPLACE.ME"
11+
Given operation "GetSPARecommendations" enabled
12+
And new "GetSPARecommendations" request
1613
And request contains "service" parameter from "REPLACE.ME"
1714
When the request is sent
1815
Then the response status is 400 Bad Request
1916

2017
@generated @skip @team:DataDog/data-and-analytics-processing
2118
Scenario: Get SPA Recommendations returns "OK" response
22-
Given request contains "shard" parameter from "REPLACE.ME"
19+
Given operation "GetSPARecommendations" enabled
20+
And new "GetSPARecommendations" request
21+
And request contains "service" parameter from "REPLACE.ME"
22+
When the request is sent
23+
Then the response status is 200 OK
24+
25+
@generated @skip @team:DataDog/data-and-analytics-processing
26+
Scenario: Get SPA Recommendations with a shard parameter returns "Bad Request" response
27+
Given operation "GetSPARecommendationsWithShard" enabled
28+
And new "GetSPARecommendationsWithShard" request
29+
And request contains "shard" parameter from "REPLACE.ME"
30+
And request contains "service" parameter from "REPLACE.ME"
31+
When the request is sent
32+
Then the response status is 400 Bad Request
33+
34+
@generated @skip @team:DataDog/data-and-analytics-processing
35+
Scenario: Get SPA Recommendations with a shard parameter returns "OK" response
36+
Given operation "GetSPARecommendationsWithShard" enabled
37+
And new "GetSPARecommendationsWithShard" request
38+
And request contains "shard" parameter from "REPLACE.ME"
2339
And request contains "service" parameter from "REPLACE.ME"
2440
When the request is sent
2541
Then the response status is 200 OK
2642

2743
@skip @team:DataDog/data-and-analytics-processing
2844
Scenario: GetSPARecommendations returns a JSON:API Recommendation with driver and executor estimations
29-
Given request contains "service" parameter with value "dedupeactivecontexts"
45+
Given new "GetSPARecommendations" request
46+
And a valid "apiKeyAuth" key in the system
47+
And a valid "appKeyAuth" key in the system
48+
And operation "GetSPARecommendations" enabled
49+
And request contains "service" parameter with value "dedupeactivecontexts"
3050
And request contains "shard" parameter with value "adp_dedupeactivecontexts_org2"
3151
When the request is sent
3252
Then the response status is 404 Not Found

0 commit comments

Comments
 (0)