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
1 change: 1 addition & 0 deletions api/datadog/configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -1391,6 +1391,7 @@ func NewConfiguration() *Configuration {
"v2.GetSloStatus": false,
"v2.CreateSnapshot": false,
"v2.GetSPARecommendations": false,
"v2.GetSPARecommendationsV2": false,
"v2.GetSPARecommendationsWithShard": false,
"v2.CreateAiCustomRule": false,
"v2.CreateAiCustomRuleRevision": false,
Expand Down
85 changes: 85 additions & 0 deletions api/datadogV2/api_spa.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,91 @@ func (a *SpaApi) GetSPARecommendations(ctx _context.Context, service string, o .
return localVarReturnValue, localVarHTTPResponse, nil
}

// GetSPARecommendationsV2 Get SPA recommendations v2.
// 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.
func (a *SpaApi) GetSPARecommendationsV2(ctx _context.Context, service string, body RecommendationV2RequestBody) (RecommendationDocument, *_nethttp.Response, error) {
var (
localVarHTTPMethod = _nethttp.MethodPost
localVarPostBody interface{}
localVarReturnValue RecommendationDocument
)

operationId := "v2.GetSPARecommendationsV2"
isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId)
if !isOperationEnabled {
return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)}
}
if isOperationEnabled && a.Client.Cfg.Debug {
_log.Printf("WARNING: Using unstable operation '%s'", operationId)
}

localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.SpaApi.GetSPARecommendationsV2")
if err != nil {
return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()}
}

localVarPath := localBasePath + "/api/v2/spa/recommendations-v2/{service}"
localVarPath = datadog.ReplacePathParameter(localVarPath, "{service}", _neturl.PathEscape(datadog.ParameterToString(service, "")))

localVarHeaderParams := make(map[string]string)
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
localVarHeaderParams["Content-Type"] = "application/json"
localVarHeaderParams["Accept"] = "application/json"

// body params
localVarPostBody = &body
datadog.SetAuthKeys(
ctx,
&localVarHeaderParams,
)

req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil)
if err != nil {
return localVarReturnValue, nil, err
}

localVarHTTPResponse, err := a.Client.CallAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarReturnValue, localVarHTTPResponse, err
}

localVarBody, err := datadog.ReadBody(localVarHTTPResponse)
if err != nil {
return localVarReturnValue, localVarHTTPResponse, err
}

if localVarHTTPResponse.StatusCode >= 300 {
newErr := datadog.GenericOpenAPIError{
ErrorBody: localVarBody,
ErrorMessage: localVarHTTPResponse.Status,
}
if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 {
var v APIErrorResponse
err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
return localVarReturnValue, localVarHTTPResponse, newErr
}
newErr.ErrorModel = v
}
return localVarReturnValue, localVarHTTPResponse, newErr
}

err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr := datadog.GenericOpenAPIError{
ErrorBody: localVarBody,
ErrorMessage: err.Error(),
}
return localVarReturnValue, localVarHTTPResponse, newErr
}

return localVarReturnValue, localVarHTTPResponse, nil
}

// GetSPARecommendationsWithShardOptionalParameters holds optional parameters for GetSPARecommendationsWithShard.
type GetSPARecommendationsWithShardOptionalParameters struct {
BypassCache *string
Expand Down
1 change: 1 addition & 0 deletions api/datadogV2/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -1364,6 +1364,7 @@
// - [SoftwareCatalogApi.UpsertCatalogEntity]
// - [SoftwareCatalogApi.UpsertCatalogKind]
// - [SpaApi.GetSPARecommendations]
// - [SpaApi.GetSPARecommendationsV2]
// - [SpaApi.GetSPARecommendationsWithShard]
// - [SpansApi.AggregateSpans]
// - [SpansApi.ListSpans]
Expand Down
103 changes: 103 additions & 0 deletions api/datadogV2/model_recommendation_v2_request_attributes.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
// 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.

package datadogV2

import (
"fmt"

"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
)

// RecommendationV2RequestAttributes Attributes for requesting SPA recommendations by forwarding a Spark job's raw arguments
// instead of a precomputed shard.
type RecommendationV2RequestAttributes struct {
// Raw, unfiltered Spark job arguments as submitted (for example, `--org_id=2`).
// SPA determines which arguments are relevant for the given service.
Arguments []string `json:"arguments"`
// UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
UnparsedObject map[string]interface{} `json:"-"`
AdditionalProperties map[string]interface{} `json:"-"`
}

// NewRecommendationV2RequestAttributes instantiates a new RecommendationV2RequestAttributes object.
// This constructor will assign default values to properties that have it defined,
// and makes sure properties required by API are set, but the set of arguments
// will change when the set of required properties is changed.
func NewRecommendationV2RequestAttributes(arguments []string) *RecommendationV2RequestAttributes {
this := RecommendationV2RequestAttributes{}
this.Arguments = arguments
return &this
}

// NewRecommendationV2RequestAttributesWithDefaults instantiates a new RecommendationV2RequestAttributes object.
// This constructor will only assign default values to properties that have it defined,
// but it doesn't guarantee that properties required by API are set.
func NewRecommendationV2RequestAttributesWithDefaults() *RecommendationV2RequestAttributes {
this := RecommendationV2RequestAttributes{}
return &this
}

// GetArguments returns the Arguments field value.
func (o *RecommendationV2RequestAttributes) GetArguments() []string {
if o == nil {
var ret []string
return ret
}
return o.Arguments
}

// GetArgumentsOk returns a tuple with the Arguments field value
// and a boolean to check if the value has been set.
func (o *RecommendationV2RequestAttributes) GetArgumentsOk() (*[]string, bool) {
if o == nil {
return nil, false
}
return &o.Arguments, true
}

// SetArguments sets field value.
func (o *RecommendationV2RequestAttributes) SetArguments(v []string) {
o.Arguments = v
}

// MarshalJSON serializes the struct using spec logic.
func (o RecommendationV2RequestAttributes) MarshalJSON() ([]byte, error) {
toSerialize := map[string]interface{}{}
if o.UnparsedObject != nil {
return datadog.Marshal(o.UnparsedObject)
}
toSerialize["arguments"] = o.Arguments

for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return datadog.Marshal(toSerialize)
}

// UnmarshalJSON deserializes the given payload.
func (o *RecommendationV2RequestAttributes) UnmarshalJSON(bytes []byte) (err error) {
all := struct {
Arguments *[]string `json:"arguments"`
}{}
if err = datadog.Unmarshal(bytes, &all); err != nil {
return datadog.Unmarshal(bytes, &o.UnparsedObject)
}
if all.Arguments == nil {
return fmt.Errorf("required field arguments missing")
}
additionalProperties := make(map[string]interface{})
if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil {
datadog.DeleteKeys(additionalProperties, &[]string{"arguments"})
} else {
return err
}
o.Arguments = *all.Arguments

if len(additionalProperties) > 0 {
o.AdditionalProperties = additionalProperties
}

return nil
}
Loading
Loading