Skip to content

Commit 539c091

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Add DNAP Spark Pod Autosizing service to API client (#3296)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent fbdb4ed commit 539c091

16 files changed

Lines changed: 1413 additions & 2 deletions

.generated-info

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
2-
"spec_repo_commit": "d58cb84",
3-
"generated": "2025-08-22 18:46:37.565"
2+
"spec_repo_commit": "205813d",
3+
"generated": "2025-08-25 08:43:18.277"
44
}

.generator/schemas/v2/openapi.yaml

Lines changed: 170 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9284,6 +9284,15 @@ components:
92849284
that evaluates to a boolean.
92859285
example: ${true}
92869286
type: string
9287+
ComponentRecommendation:
9288+
description: Resource recommendation for a single Spark component (driver or
9289+
executor). Contains estimation data used to patch Spark job specs.
9290+
properties:
9291+
estimation:
9292+
$ref: '#/components/schemas/Estimation'
9293+
required:
9294+
- estimation
9295+
type: object
92879296
ComponentType:
92889297
description: The UI component type.
92899298
enum:
@@ -10480,6 +10489,28 @@ components:
1048010489
type: string
1048110490
x-enum-varnames:
1048210491
- COST_BY_ORG
10492+
Cpu:
10493+
description: CPU usage statistics derived from historical Spark job metrics.
10494+
Provides multiple estimates so users can choose between conservative and cost-saving
10495+
risk profiles.
10496+
properties:
10497+
max:
10498+
description: Maximum CPU usage observed for the job, expressed in millicores.
10499+
This represents the upper bound of usage.
10500+
format: int64
10501+
type: integer
10502+
p75:
10503+
description: 75th percentile of CPU usage (millicores). Represents a cost-saving
10504+
configuration while covering most workloads.
10505+
format: int64
10506+
type: integer
10507+
p95:
10508+
description: 95th percentile of CPU usage (millicores). Balances performance
10509+
and cost, providing a safer margin than p75.
10510+
format: int64
10511+
type: integer
10512+
type: object
10513+
x-model-simple-name: SpaCpu
1048310514
CreateActionConnectionRequest:
1048410515
description: Request used to create an action connection.
1048510516
properties:
@@ -15937,6 +15968,33 @@ components:
1593715968
type: string
1593815969
x-enum-varnames:
1593915970
- ESCALATION_POLICY_STEPS
15971+
Estimation:
15972+
description: Recommended resource values for a Spark driver or executor, derived
15973+
from recent real usage metrics. Used by SPA to propose more efficient pod
15974+
sizing.
15975+
properties:
15976+
cpu:
15977+
$ref: '#/components/schemas/Cpu'
15978+
ephemeral_storage:
15979+
description: Recommended ephemeral storage allocation (in MiB). Derived
15980+
from job temporary storage patterns.
15981+
format: int64
15982+
type: integer
15983+
heap:
15984+
description: Recommended JVM heap size (in MiB).
15985+
format: int64
15986+
type: integer
15987+
memory:
15988+
description: Recommended total memory allocation (in MiB). Includes both
15989+
heap and overhead.
15990+
format: int64
15991+
type: integer
15992+
overhead:
15993+
description: Recommended JVM overhead (in MiB). Computed as total memory
15994+
- heap.
15995+
format: int64
15996+
type: integer
15997+
type: object
1594015998
Event:
1594115999
description: The metadata associated with a request.
1594216000
properties:
@@ -32835,6 +32893,52 @@ components:
3283532893
x-enum-varnames:
3283632894
- ANY
3283732895
- ALL
32896+
RecommendationAttributes:
32897+
description: Attributes of the SPA Recommendation resource. Contains recommendations
32898+
for both driver and executor components.
32899+
properties:
32900+
driver:
32901+
$ref: '#/components/schemas/ComponentRecommendation'
32902+
executor:
32903+
$ref: '#/components/schemas/ComponentRecommendation'
32904+
required:
32905+
- driver
32906+
- executor
32907+
type: object
32908+
RecommendationData:
32909+
description: JSON:API resource object for SPA Recommendation. Includes type,
32910+
optional ID, and resource attributes with structured recommendations.
32911+
properties:
32912+
attributes:
32913+
$ref: '#/components/schemas/RecommendationAttributes'
32914+
id:
32915+
description: Resource identifier for the recommendation. Optional in responses.
32916+
type: string
32917+
type:
32918+
$ref: '#/components/schemas/RecommendationType'
32919+
required:
32920+
- type
32921+
- attributes
32922+
type: object
32923+
RecommendationDocument:
32924+
description: JSON:API document containing a single Recommendation resource.
32925+
Returned by SPA when the Spark Gateway requests recommendations.
32926+
properties:
32927+
data:
32928+
$ref: '#/components/schemas/RecommendationData'
32929+
required:
32930+
- data
32931+
type: object
32932+
RecommendationType:
32933+
default: recommendation
32934+
description: JSON:API resource type for Spark Pod Autosizing recommendations.
32935+
Identifies the Recommendation resource returned by SPA.
32936+
enum:
32937+
- recommendation
32938+
example: recommendation
32939+
type: string
32940+
x-enum-varnames:
32941+
- RECOMMENDATION
3283832942
RegisterAppKeyResponse:
3283932943
description: The response object after creating an app key registration.
3284032944
properties:
@@ -65710,6 +65814,69 @@ paths:
6571065814
x-unstable: '**Note**: This feature is in private beta. To request access, use
6571165815
the request access form in the [Service Level Objectives](https://docs.datadoghq.com/service_management/service_level_objectives/#slo-csv-export)
6571265816
docs.'
65817+
/api/v2/spa/recommendations/{service}/{shard}:
65818+
get:
65819+
description: Retrieve resource recommendations for a Spark job. The caller (Spark
65820+
Gateway or DJM UI) provides a service name and shard identifier, and SPA returns
65821+
structured recommendations for driver and executor resources.
65822+
operationId: GetSPARecommendations
65823+
parameters:
65824+
- description: The shard tag for a spark job, which differentiates jobs within
65825+
the same service that have different resource needs
65826+
in: path
65827+
name: shard
65828+
required: true
65829+
schema:
65830+
type: string
65831+
- description: The service name for a spark job
65832+
in: path
65833+
name: service
65834+
required: true
65835+
schema:
65836+
type: string
65837+
responses:
65838+
'200':
65839+
content:
65840+
application/json:
65841+
example:
65842+
data:
65843+
attributes:
65844+
driver:
65845+
estimation:
65846+
cpu:
65847+
max: 1500
65848+
p75: 1000
65849+
p95: 1200
65850+
ephemeral_storage: 896
65851+
heap: 6144
65852+
memory: 7168
65853+
overhead: 1024
65854+
executor:
65855+
estimation:
65856+
cpu:
65857+
max: 2000
65858+
p75: 1200
65859+
p95: 1500
65860+
ephemeral_storage: 512
65861+
heap: 3072
65862+
memory: 4096
65863+
overhead: 1024
65864+
id: dedupeactivecontexts:adp_dedupeactivecontexts_org2
65865+
type: recommendation
65866+
schema:
65867+
$ref: '#/components/schemas/RecommendationDocument'
65868+
description: OK
65869+
'400':
65870+
$ref: '#/components/responses/BadRequestResponse'
65871+
'403':
65872+
$ref: '#/components/responses/NotAuthorizedResponse'
65873+
'429':
65874+
$ref: '#/components/responses/TooManyRequestsResponse'
65875+
summary: Get SPA Recommendations
65876+
tags:
65877+
- Spa
65878+
x-unstable: '**Note**: This endpoint is in public beta and may change in the
65879+
future. It is not yet recommended for production use.'
6571365880
/api/v2/spans/analytics/aggregate:
6571465881
post:
6571565882
description: 'The API endpoint to aggregate spans into buckets and compute metrics
@@ -69127,6 +69294,9 @@ tags:
6912769294
externalDocs:
6912869295
url: https://docs.datadoghq.com/service_catalog/service_definitions#metadata-schema-v30-beta
6912969296
name: Software Catalog
69297+
- description: SPA (Spark Pod Autosizing) API. Provides resource recommendations and
69298+
cost insights to help optimize Spark job configurations.
69299+
name: Spa
6913069300
- description: Search and aggregate your spans from your Datadog platform over HTTP.
6913169301
name: Spans
6913269302
- description: Manage configuration of [span-based metrics](https://app.datadoghq.com/apm/traces/generate-metrics)

api/datadog/configuration.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -685,6 +685,7 @@ func NewConfiguration() *Configuration {
685685
"v2.CreateSLOReportJob": false,
686686
"v2.GetSLOReport": false,
687687
"v2.GetSLOReportJobStatus": false,
688+
"v2.GetSPARecommendations": false,
688689
"v2.AddMemberTeam": false,
689690
"v2.ListMemberTeams": false,
690691
"v2.RemoveMemberTeam": false,

api/datadogV2/api_spa.go

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
2+
// This product includes software developed at Datadog (https://www.datadoghq.com/).
3+
// Copyright 2019-Present Datadog, Inc.
4+
5+
package datadogV2
6+
7+
import (
8+
_context "context"
9+
_fmt "fmt"
10+
_log "log"
11+
_nethttp "net/http"
12+
_neturl "net/url"
13+
14+
"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
15+
)
16+
17+
// SpaApi service type
18+
type SpaApi datadog.Service
19+
20+
// GetSPARecommendations Get SPA Recommendations.
21+
// 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.
22+
func (a *SpaApi) GetSPARecommendations(ctx _context.Context, shard string, service string) (RecommendationDocument, *_nethttp.Response, error) {
23+
var (
24+
localVarHTTPMethod = _nethttp.MethodGet
25+
localVarPostBody interface{}
26+
localVarReturnValue RecommendationDocument
27+
)
28+
29+
operationId := "v2.GetSPARecommendations"
30+
isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId)
31+
if !isOperationEnabled {
32+
return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)}
33+
}
34+
if isOperationEnabled && a.Client.Cfg.Debug {
35+
_log.Printf("WARNING: Using unstable operation '%s'", operationId)
36+
}
37+
38+
localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.SpaApi.GetSPARecommendations")
39+
if err != nil {
40+
return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()}
41+
}
42+
43+
localVarPath := localBasePath + "/api/v2/spa/recommendations/{service}/{shard}"
44+
localVarPath = datadog.ReplacePathParameter(localVarPath, "{shard}", _neturl.PathEscape(datadog.ParameterToString(shard, "")))
45+
localVarPath = datadog.ReplacePathParameter(localVarPath, "{service}", _neturl.PathEscape(datadog.ParameterToString(service, "")))
46+
47+
localVarHeaderParams := make(map[string]string)
48+
localVarQueryParams := _neturl.Values{}
49+
localVarFormParams := _neturl.Values{}
50+
localVarHeaderParams["Accept"] = "application/json"
51+
52+
if a.Client.Cfg.DelegatedTokenConfig != nil {
53+
err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig)
54+
if err != nil {
55+
return localVarReturnValue, nil, err
56+
}
57+
} else {
58+
datadog.SetAuthKeys(
59+
ctx,
60+
&localVarHeaderParams,
61+
[2]string{"apiKeyAuth", "DD-API-KEY"},
62+
[2]string{"appKeyAuth", "DD-APPLICATION-KEY"},
63+
)
64+
}
65+
req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil)
66+
if err != nil {
67+
return localVarReturnValue, nil, err
68+
}
69+
70+
localVarHTTPResponse, err := a.Client.CallAPI(req)
71+
if err != nil || localVarHTTPResponse == nil {
72+
return localVarReturnValue, localVarHTTPResponse, err
73+
}
74+
75+
localVarBody, err := datadog.ReadBody(localVarHTTPResponse)
76+
if err != nil {
77+
return localVarReturnValue, localVarHTTPResponse, err
78+
}
79+
80+
if localVarHTTPResponse.StatusCode >= 300 {
81+
newErr := datadog.GenericOpenAPIError{
82+
ErrorBody: localVarBody,
83+
ErrorMessage: localVarHTTPResponse.Status,
84+
}
85+
if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 429 {
86+
var v APIErrorResponse
87+
err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
88+
if err != nil {
89+
return localVarReturnValue, localVarHTTPResponse, newErr
90+
}
91+
newErr.ErrorModel = v
92+
}
93+
return localVarReturnValue, localVarHTTPResponse, newErr
94+
}
95+
96+
err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
97+
if err != nil {
98+
newErr := datadog.GenericOpenAPIError{
99+
ErrorBody: localVarBody,
100+
ErrorMessage: err.Error(),
101+
}
102+
return localVarReturnValue, localVarHTTPResponse, newErr
103+
}
104+
105+
return localVarReturnValue, localVarHTTPResponse, nil
106+
}
107+
108+
// NewSpaApi Returns NewSpaApi.
109+
func NewSpaApi(client *datadog.APIClient) *SpaApi {
110+
return &SpaApi{
111+
Client: client,
112+
}
113+
}

api/datadogV2/doc.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -482,6 +482,7 @@
482482
// - [SoftwareCatalogApi.ListCatalogRelation]
483483
// - [SoftwareCatalogApi.UpsertCatalogEntity]
484484
// - [SoftwareCatalogApi.UpsertCatalogKind]
485+
// - [SpaApi.GetSPARecommendations]
485486
// - [SpansApi.AggregateSpans]
486487
// - [SpansApi.ListSpans]
487488
// - [SpansApi.ListSpansGet]

0 commit comments

Comments
 (0)