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
90 changes: 83 additions & 7 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42828,6 +42828,9 @@ components:
description: Attributes of the SPA Recommendation resource. Contains recommendations
for both driver and executor components.
properties:
confidence_level:
format: double
type: number
driver:
$ref: '#/components/schemas/ComponentRecommendation'
executor:
Expand Down Expand Up @@ -86625,13 +86628,79 @@ paths:
x-unstable: '**Note**: This feature is in private beta. To request access, use
the request access form in the [Service Level Objectives](https://docs.datadoghq.com/service_management/service_level_objectives/#slo-csv-export)
docs.'
/api/v2/spa/recommendations/{service}/{shard}:
/api/v2/spa/recommendations/{service}:
get:
description: 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.
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.
operationId: GetSPARecommendations
parameters:
- description: The recommendation service should not use its metrics cache.
in: query
name: bypass_cache
schema:
type: string
- description: The service name for a spark job.
in: path
name: service
required: true
schema:
type: string
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'
'429':
$ref: '#/components/responses/TooManyRequestsResponse'
security:
- AuthZ: []
summary: Get SPA Recommendations
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}/{shard}:
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 shard identifier,
and SPA returns structured recommendations for driver and executor resources.
operationId: GetSPARecommendationsWithShard
parameters:
- description: The shard tag for a spark job, which differentiates jobs within
the same service that have different resource needs
in: path
Expand All @@ -86645,6 +86714,11 @@ paths:
required: true
schema:
type: string
- description: The recommendation service should not use its metrics cache.
in: query
name: bypass_cache
schema:
type: string
responses:
'200':
content:
Expand Down Expand Up @@ -86683,11 +86757,13 @@ paths:
$ref: '#/components/responses/NotAuthorizedResponse'
'429':
$ref: '#/components/responses/TooManyRequestsResponse'
summary: Get SPA Recommendations
security:
- AuthZ: []
summary: Get SPA Recommendations with a shard parameter
tags:
- Spa
x-unstable: '**Note**: This endpoint is in public beta and may change in the
future. It is not yet recommended for production use.'
x-unstable: '**Note**: This endpoint is in preview and may change in the future.
It is not yet recommended for production use.'
/api/v2/spans/analytics/aggregate:
post:
description: 'The API endpoint to aggregate spans into buckets and compute metrics
Expand Down
2 changes: 1 addition & 1 deletion examples/v2/spa/GetSPARecommendations.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
config.unstable_operations["v2.get_spa_recommendations".to_sym] = true
end
api_instance = DatadogAPIClient::V2::SpaAPI.new
p api_instance.get_spa_recommendations("shard", "service")
p api_instance.get_spa_recommendations("service")
8 changes: 8 additions & 0 deletions examples/v2/spa/GetSPARecommendationsWithShard.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Get SPA Recommendations with a shard parameter returns "OK" response

require "datadog_api_client"
DatadogAPIClient.configure do |config|
config.unstable_operations["v2.get_spa_recommendations_with_shard".to_sym] = true
end
api_instance = DatadogAPIClient::V2::SpaAPI.new
p api_instance.get_spa_recommendations_with_shard("shard", "service")
5 changes: 5 additions & 0 deletions features/scenarios_model_mapping.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3211,8 +3211,13 @@
"report_id" => "String",
},
"v2.GetSPARecommendations" => {
"bypass_cache" => "String",
"service" => "String",
},
"v2.GetSPARecommendationsWithShard" => {
"shard" => "String",
"service" => "String",
"bypass_cache" => "String",
},
"v2.AggregateSpans" => {
"body" => "SpansAggregateRequest",
Expand Down
36 changes: 28 additions & 8 deletions features/v2/spa.feature
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,49 @@ Feature: Spa
insights to help optimize Spark job configurations.

Background:
Given a valid "apiKeyAuth" key in the system
And a valid "appKeyAuth" key in the system
And an instance of "Spa" API
And operation "GetSPARecommendations" enabled
And new "GetSPARecommendations" request
Given an instance of "Spa" API

@generated @skip @team:DataDog/data-and-analytics-processing
Scenario: Get SPA Recommendations returns "Bad Request" response
Given request contains "shard" parameter from "REPLACE.ME"
Given operation "GetSPARecommendations" enabled
And new "GetSPARecommendations" request
And request contains "service" parameter from "REPLACE.ME"
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 returns "OK" response
Given request contains "shard" parameter from "REPLACE.ME"
Given operation "GetSPARecommendations" enabled
And new "GetSPARecommendations" request
And request contains "service" parameter from "REPLACE.ME"
When the request is sent
Then the response status is 200 OK

@generated @skip @team:DataDog/data-and-analytics-processing
Scenario: Get SPA Recommendations with a shard parameter returns "Bad Request" response
Given operation "GetSPARecommendationsWithShard" enabled
And new "GetSPARecommendationsWithShard" request
And request contains "shard" parameter from "REPLACE.ME"
And request contains "service" parameter from "REPLACE.ME"
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 with a shard parameter returns "OK" response
Given operation "GetSPARecommendationsWithShard" enabled
And new "GetSPARecommendationsWithShard" request
And request contains "shard" parameter from "REPLACE.ME"
And request contains "service" parameter from "REPLACE.ME"
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 request contains "service" parameter with value "dedupeactivecontexts"
Given new "GetSPARecommendations" request
And a valid "apiKeyAuth" key in the system
And a valid "appKeyAuth" key in the system
And operation "GetSPARecommendations" enabled
And request contains "service" parameter with value "dedupeactivecontexts"
And request contains "shard" parameter with value "adp_dedupeactivecontexts_org2"
When the request is sent
Then the response status is 404 Not Found
Expand Down
6 changes: 6 additions & 0 deletions features/v2/undo.json
Original file line number Diff line number Diff line change
Expand Up @@ -4484,6 +4484,12 @@
"type": "safe"
}
},
"GetSPARecommendationsWithShard": {
"tag": "Spa",
"undo": {
"type": "safe"
}
},
"AggregateSpans": {
"tag": "Spans",
"undo": {
Expand Down
1 change: 1 addition & 0 deletions lib/datadog_api_client/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,7 @@ def initialize
"v2.get_slo_report": false,
"v2.get_slo_report_job_status": false,
"v2.get_spa_recommendations": false,
"v2.get_spa_recommendations_with_shard": false,
"v2.create_sca_resolve_vulnerable_symbols": false,
"v2.create_sca_result": false,
"v2.add_member_team": false,
Expand Down
97 changes: 86 additions & 11 deletions lib/datadog_api_client/v2/api/spa_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,20 @@ def initialize(api_client = DatadogAPIClient::APIClient.default)
# Get SPA Recommendations.
#
# @see #get_spa_recommendations_with_http_info
def get_spa_recommendations(shard, service, opts = {})
data, _status_code, _headers = get_spa_recommendations_with_http_info(shard, service, opts)
def get_spa_recommendations(service, opts = {})
data, _status_code, _headers = get_spa_recommendations_with_http_info(service, opts)
data
end

# Get SPA Recommendations.
#
# 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.
# 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.
#
# @param shard [String] The shard tag for a spark job, which differentiates jobs within the same service that have different resource needs
# @param service [String] The service name for a spark job
# @param service [String] The service name for a spark job.
# @param opts [Hash] the optional parameters
# @option opts [String] :bypass_cache The recommendation service should not use its metrics cache.
# @return [Array<(RecommendationDocument, Integer, Hash)>] RecommendationDocument data, response status code and response headers
def get_spa_recommendations_with_http_info(shard, service, opts = {})
def get_spa_recommendations_with_http_info(service, opts = {})
unstable_enabled = @api_client.config.unstable_operations["v2.get_spa_recommendations".to_sym]
if unstable_enabled
@api_client.config.logger.warn format("Using unstable operation '%s'", "v2.get_spa_recommendations")
Expand All @@ -50,19 +50,94 @@ def get_spa_recommendations_with_http_info(shard, service, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: SpaAPI.get_spa_recommendations ...'
end
# verify the required parameter 'service' is set
if @api_client.config.client_side_validation && service.nil?
fail ArgumentError, "Missing the required parameter 'service' when calling SpaAPI.get_spa_recommendations"
end
# resource path
local_var_path = '/api/v2/spa/recommendations/{service}'.sub('{service}', CGI.escape(service.to_s).gsub('%2F', '/'))

# query parameters
query_params = opts[:query_params] || {}
query_params[:'bypass_cache'] = opts[:'bypass_cache'] if !opts[:'bypass_cache'].nil?

# header parameters
header_params = opts[:header_params] || {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])

# form parameters
form_params = opts[:form_params] || {}

# http body (model)
post_body = opts[:debug_body]

# return_type
return_type = opts[:debug_return_type] || 'RecommendationDocument'

# auth_names
auth_names = opts[:debug_auth_names] || [:AuthZ]

new_options = opts.merge(
:operation => :get_spa_recommendations,
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type,
:api_version => "V2"
)

data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: SpaAPI#get_spa_recommendations\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end

# Get SPA Recommendations with a shard parameter.
#
# @see #get_spa_recommendations_with_shard_with_http_info
def get_spa_recommendations_with_shard(shard, service, opts = {})
data, _status_code, _headers = get_spa_recommendations_with_shard_with_http_info(shard, service, opts)
data
end

# Get SPA Recommendations with a shard parameter.
#
# 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.
#
# @param shard [String] The shard tag for a spark job, which differentiates jobs within the same service that have different resource needs
# @param service [String] The service name for a spark job
# @param opts [Hash] the optional parameters
# @option opts [String] :bypass_cache The recommendation service should not use its metrics cache.
# @return [Array<(RecommendationDocument, Integer, Hash)>] RecommendationDocument data, response status code and response headers
def get_spa_recommendations_with_shard_with_http_info(shard, service, opts = {})
unstable_enabled = @api_client.config.unstable_operations["v2.get_spa_recommendations_with_shard".to_sym]
if unstable_enabled
@api_client.config.logger.warn format("Using unstable operation '%s'", "v2.get_spa_recommendations_with_shard")
else
raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.get_spa_recommendations_with_shard"))
end

if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: SpaAPI.get_spa_recommendations_with_shard ...'
end
# verify the required parameter 'shard' is set
if @api_client.config.client_side_validation && shard.nil?
fail ArgumentError, "Missing the required parameter 'shard' when calling SpaAPI.get_spa_recommendations"
fail ArgumentError, "Missing the required parameter 'shard' when calling SpaAPI.get_spa_recommendations_with_shard"
end
# verify the required parameter 'service' is set
if @api_client.config.client_side_validation && service.nil?
fail ArgumentError, "Missing the required parameter 'service' when calling SpaAPI.get_spa_recommendations"
fail ArgumentError, "Missing the required parameter 'service' when calling SpaAPI.get_spa_recommendations_with_shard"
end
# resource path
local_var_path = '/api/v2/spa/recommendations/{service}/{shard}'.sub('{shard}', CGI.escape(shard.to_s).gsub('%2F', '/')).sub('{service}', CGI.escape(service.to_s).gsub('%2F', '/'))

# query parameters
query_params = opts[:query_params] || {}
query_params[:'bypass_cache'] = opts[:'bypass_cache'] if !opts[:'bypass_cache'].nil?

# header parameters
header_params = opts[:header_params] || {}
Expand All @@ -79,10 +154,10 @@ def get_spa_recommendations_with_http_info(shard, service, opts = {})
return_type = opts[:debug_return_type] || 'RecommendationDocument'

# auth_names
auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth]
auth_names = opts[:debug_auth_names] || [:AuthZ]

new_options = opts.merge(
:operation => :get_spa_recommendations,
:operation => :get_spa_recommendations_with_shard,
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
Expand All @@ -94,7 +169,7 @@ def get_spa_recommendations_with_http_info(shard, service, opts = {})

data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: SpaAPI#get_spa_recommendations\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
@api_client.config.logger.debug "API called: SpaAPI#get_spa_recommendations_with_shard\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
Expand Down
Loading
Loading