diff --git a/.generated-info b/.generated-info index 3eb058360149..ea5e89e8c103 100644 --- a/.generated-info +++ b/.generated-info @@ -1,4 +1,4 @@ { - "spec_repo_commit": "d58cb84", - "generated": "2025-08-22 18:44:59.682" + "spec_repo_commit": "205813d", + "generated": "2025-08-25 08:41:30.486" } diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 997d4861896c..123b5ff15617 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -9284,6 +9284,15 @@ components: that evaluates to a boolean. example: ${true} type: string + ComponentRecommendation: + description: Resource recommendation for a single Spark component (driver or + executor). Contains estimation data used to patch Spark job specs. + properties: + estimation: + $ref: '#/components/schemas/Estimation' + required: + - estimation + type: object ComponentType: description: The UI component type. enum: @@ -10480,6 +10489,28 @@ components: type: string x-enum-varnames: - COST_BY_ORG + Cpu: + description: CPU usage statistics derived from historical Spark job metrics. + Provides multiple estimates so users can choose between conservative and cost-saving + risk profiles. + properties: + max: + description: Maximum CPU usage observed for the job, expressed in millicores. + This represents the upper bound of usage. + format: int64 + type: integer + p75: + description: 75th percentile of CPU usage (millicores). Represents a cost-saving + configuration while covering most workloads. + format: int64 + type: integer + p95: + description: 95th percentile of CPU usage (millicores). Balances performance + and cost, providing a safer margin than p75. + format: int64 + type: integer + type: object + x-model-simple-name: SpaCpu CreateActionConnectionRequest: description: Request used to create an action connection. properties: @@ -15937,6 +15968,33 @@ components: type: string x-enum-varnames: - ESCALATION_POLICY_STEPS + Estimation: + description: Recommended resource values for a Spark driver or executor, derived + from recent real usage metrics. Used by SPA to propose more efficient pod + sizing. + properties: + cpu: + $ref: '#/components/schemas/Cpu' + ephemeral_storage: + description: Recommended ephemeral storage allocation (in MiB). Derived + from job temporary storage patterns. + format: int64 + type: integer + heap: + description: Recommended JVM heap size (in MiB). + format: int64 + type: integer + memory: + description: Recommended total memory allocation (in MiB). Includes both + heap and overhead. + format: int64 + type: integer + overhead: + description: Recommended JVM overhead (in MiB). Computed as total memory + - heap. + format: int64 + type: integer + type: object Event: description: The metadata associated with a request. properties: @@ -32835,6 +32893,52 @@ components: x-enum-varnames: - ANY - ALL + RecommendationAttributes: + description: Attributes of the SPA Recommendation resource. Contains recommendations + for both driver and executor components. + properties: + driver: + $ref: '#/components/schemas/ComponentRecommendation' + executor: + $ref: '#/components/schemas/ComponentRecommendation' + required: + - driver + - executor + type: object + RecommendationData: + description: JSON:API resource object for SPA Recommendation. Includes type, + optional ID, and resource attributes with structured recommendations. + properties: + attributes: + $ref: '#/components/schemas/RecommendationAttributes' + id: + description: Resource identifier for the recommendation. Optional in responses. + type: string + type: + $ref: '#/components/schemas/RecommendationType' + required: + - type + - attributes + type: object + RecommendationDocument: + description: JSON:API document containing a single Recommendation resource. + Returned by SPA when the Spark Gateway requests recommendations. + properties: + data: + $ref: '#/components/schemas/RecommendationData' + required: + - data + type: object + RecommendationType: + default: recommendation + description: JSON:API resource type for Spark Pod Autosizing recommendations. + Identifies the Recommendation resource returned by SPA. + enum: + - recommendation + example: recommendation + type: string + x-enum-varnames: + - RECOMMENDATION RegisterAppKeyResponse: description: The response object after creating an app key registration. properties: @@ -65710,6 +65814,69 @@ 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}: + 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. + operationId: GetSPARecommendations + parameters: + - description: The shard tag for a spark job, which differentiates jobs within + the same service that have different resource needs + in: path + name: shard + required: true + 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' + summary: Get SPA Recommendations + 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.' /api/v2/spans/analytics/aggregate: post: description: 'The API endpoint to aggregate spans into buckets and compute metrics @@ -69127,6 +69294,9 @@ tags: externalDocs: url: https://docs.datadoghq.com/service_catalog/service_definitions#metadata-schema-v30-beta name: Software Catalog +- description: SPA (Spark Pod Autosizing) API. Provides resource recommendations and + cost insights to help optimize Spark job configurations. + name: Spa - description: Search and aggregate your spans from your Datadog platform over HTTP. name: Spans - description: Manage configuration of [span-based metrics](https://app.datadoghq.com/apm/traces/generate-metrics) diff --git a/examples/v2/spa/GetSPARecommendations.rb b/examples/v2/spa/GetSPARecommendations.rb new file mode 100644 index 000000000000..0234fd1e23cc --- /dev/null +++ b/examples/v2/spa/GetSPARecommendations.rb @@ -0,0 +1,8 @@ +# Get SPA Recommendations returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + 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") diff --git a/features/scenarios_model_mapping.rb b/features/scenarios_model_mapping.rb index e7e7f3b97a2d..2159ef256c13 100644 --- a/features/scenarios_model_mapping.rb +++ b/features/scenarios_model_mapping.rb @@ -2634,6 +2634,10 @@ "v2.GetSLOReportJobStatus" => { "report_id" => "String", }, + "v2.GetSPARecommendations" => { + "shard" => "String", + "service" => "String", + }, "v2.AggregateSpans" => { "body" => "SpansAggregateRequest", }, diff --git a/features/v2/spa.feature b/features/v2/spa.feature new file mode 100644 index 000000000000..327bbf16ac09 --- /dev/null +++ b/features/v2/spa.feature @@ -0,0 +1,54 @@ +@endpoint(spa) @endpoint(spa-v2) +Feature: Spa + SPA (Spark Pod Autosizing) API. Provides resource recommendations and cost + 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 + + @generated @skip @team:DataDog/data-and-analytics-processing + Scenario: Get SPA Recommendations returns "Bad Request" response + Given 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 returns "OK" response + Given 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" + And request contains "shard" parameter with value "adp_dedupeactivecontexts_org2" + When the request is sent + Then the response status is 404 Not Found + And the response "data.type" is equal to "recommendation" + And the response "data" has field "attributes" + And the response "data.attributes" has field "driver" + And the response "data.attributes" has field "executor" + And the response "data.attributes.driver" has field "estimation" + And the response "data.attributes.driver.estimation" has field "cpu" + And the response "data.attributes.driver.estimation" has field "memory" + And the response "data.attributes.driver.estimation" has field "ephemeral_storage" + And the response "data.attributes.driver.estimation" has field "heap" + And the response "data.attributes.driver.estimation" has field "overhead" + And the response "data.attributes.driver.estimation.cpu" has field "max" + And the response "data.attributes.driver.estimation.cpu" has field "p95" + And the response "data.attributes.driver.estimation.cpu" has field "p75" + And the response "data.attributes.executor" has field "estimation" + And the response "data.attributes.executor.estimation" has field "cpu" + And the response "data.attributes.executor.estimation" has field "memory" + And the response "data.attributes.executor.estimation" has field "ephemeral_storage" + And the response "data.attributes.executor.estimation" has field "heap" + And the response "data.attributes.executor.estimation" has field "overhead" + And the response "data.attributes.executor.estimation.cpu" has field "max" + And the response "data.attributes.executor.estimation.cpu" has field "p95" + And the response "data.attributes.executor.estimation.cpu" has field "p75" diff --git a/features/v2/undo.json b/features/v2/undo.json index 6f5c5499f1cf..9878d7a46785 100644 --- a/features/v2/undo.json +++ b/features/v2/undo.json @@ -3362,6 +3362,12 @@ "type": "safe" } }, + "GetSPARecommendations": { + "tag": "Spa", + "undo": { + "type": "safe" + } + }, "AggregateSpans": { "tag": "Spans", "undo": { diff --git a/lib/datadog_api_client/configuration.rb b/lib/datadog_api_client/configuration.rb index d50a8a700689..a6a5a665e366 100644 --- a/lib/datadog_api_client/configuration.rb +++ b/lib/datadog_api_client/configuration.rb @@ -274,6 +274,7 @@ def initialize "v2.create_slo_report_job": false, "v2.get_slo_report": false, "v2.get_slo_report_job_status": false, + "v2.get_spa_recommendations": false, "v2.add_member_team": false, "v2.list_member_teams": false, "v2.remove_member_team": false, diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index 31a9061949a4..9ec3071709b5 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -1461,6 +1461,7 @@ def overrides "v2.component_grid_type" => "ComponentGridType", "v2.component_properties" => "ComponentProperties", "v2.component_properties_is_visible" => "ComponentPropertiesIsVisible", + "v2.component_recommendation" => "ComponentRecommendation", "v2.component_type" => "ComponentType", "v2.config_cat_credentials" => "ConfigCatCredentials", "v2.config_cat_credentials_update" => "ConfigCatCredentialsUpdate", @@ -1537,6 +1538,7 @@ def overrides "v2.cost_by_org_attributes" => "CostByOrgAttributes", "v2.cost_by_org_response" => "CostByOrgResponse", "v2.cost_by_org_type" => "CostByOrgType", + "v2.cpu" => "Cpu", "v2.create_action_connection_request" => "CreateActionConnectionRequest", "v2.create_action_connection_response" => "CreateActionConnectionResponse", "v2.create_app_request" => "CreateAppRequest", @@ -1887,6 +1889,7 @@ def overrides "v2.escalation_target" => "EscalationTarget", "v2.escalation_targets" => "EscalationTargets", "v2.escalation_type" => "EscalationType", + "v2.estimation" => "Estimation", "v2.event" => "Event", "v2.event_attributes" => "EventAttributes", "v2.event_category" => "EventCategory", @@ -2951,6 +2954,10 @@ def overrides "v2.query_sort_order" => "QuerySortOrder", "v2.readiness_gate" => "ReadinessGate", "v2.readiness_gate_threshold_type" => "ReadinessGateThresholdType", + "v2.recommendation_attributes" => "RecommendationAttributes", + "v2.recommendation_data" => "RecommendationData", + "v2.recommendation_document" => "RecommendationDocument", + "v2.recommendation_type" => "RecommendationType", "v2.register_app_key_response" => "RegisterAppKeyResponse", "v2.relation_attributes" => "RelationAttributes", "v2.relation_entity" => "RelationEntity", @@ -3924,6 +3931,7 @@ def overrides "v2.service_level_objectives_api" => "ServiceLevelObjectivesAPI", "v2.service_scorecards_api" => "ServiceScorecardsAPI", "v2.software_catalog_api" => "SoftwareCatalogAPI", + "v2.spa_api" => "SpaAPI", "v2.spans_api" => "SpansAPI", "v2.spans_metrics_api" => "SpansMetricsAPI", "v2.synthetics_api" => "SyntheticsAPI", diff --git a/lib/datadog_api_client/v2/api/spa_api.rb b/lib/datadog_api_client/v2/api/spa_api.rb new file mode 100644 index 000000000000..bfd9f0095fb0 --- /dev/null +++ b/lib/datadog_api_client/v2/api/spa_api.rb @@ -0,0 +1,102 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'cgi' + +module DatadogAPIClient::V2 + class SpaAPI + attr_accessor :api_client + + def initialize(api_client = DatadogAPIClient::APIClient.default) + @api_client = api_client + end + + # 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) + 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. + # + # @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 + # @return [Array<(RecommendationDocument, Integer, Hash)>] RecommendationDocument data, response status code and response headers + def get_spa_recommendations_with_http_info(shard, 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") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.get_spa_recommendations")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: SpaAPI.get_spa_recommendations ...' + 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" + 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}/{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] || {} + + # 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] || [:apiKeyAuth, :appKeyAuth] + + 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 + end +end diff --git a/lib/datadog_api_client/v2/models/component_recommendation.rb b/lib/datadog_api_client/v2/models/component_recommendation.rb new file mode 100644 index 000000000000..0c941f40d4e5 --- /dev/null +++ b/lib/datadog_api_client/v2/models/component_recommendation.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Resource recommendation for a single Spark component (driver or executor). Contains estimation data used to patch Spark job specs. + class ComponentRecommendation + include BaseGenericModel + + # Recommended resource values for a Spark driver or executor, derived from recent real usage metrics. Used by SPA to propose more efficient pod sizing. + attr_reader :estimation + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'estimation' => :'estimation' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'estimation' => :'Estimation' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ComponentRecommendation` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'estimation') + self.estimation = attributes[:'estimation'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @estimation.nil? + true + end + + # Custom attribute writer method with validation + # @param estimation [Object] Object to be assigned + # @!visibility private + def estimation=(estimation) + if estimation.nil? + fail ArgumentError, 'invalid value for "estimation", estimation cannot be nil.' + end + @estimation = estimation + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + estimation == o.estimation && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [estimation, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/cpu.rb b/lib/datadog_api_client/v2/models/cpu.rb new file mode 100644 index 000000000000..ba58559d69f6 --- /dev/null +++ b/lib/datadog_api_client/v2/models/cpu.rb @@ -0,0 +1,125 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # CPU usage statistics derived from historical Spark job metrics. Provides multiple estimates so users can choose between conservative and cost-saving risk profiles. + class Cpu + include BaseGenericModel + + # Maximum CPU usage observed for the job, expressed in millicores. This represents the upper bound of usage. + attr_accessor :max + + # 75th percentile of CPU usage (millicores). Represents a cost-saving configuration while covering most workloads. + attr_accessor :p75 + + # 95th percentile of CPU usage (millicores). Balances performance and cost, providing a safer margin than p75. + attr_accessor :p95 + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'max' => :'max', + :'p75' => :'p75', + :'p95' => :'p95' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'max' => :'Integer', + :'p75' => :'Integer', + :'p95' => :'Integer' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::Cpu` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'max') + self.max = attributes[:'max'] + end + + if attributes.key?(:'p75') + self.p75 = attributes[:'p75'] + end + + if attributes.key?(:'p95') + self.p95 = attributes[:'p95'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + max == o.max && + p75 == o.p75 && + p95 == o.p95 && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [max, p75, p95, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/estimation.rb b/lib/datadog_api_client/v2/models/estimation.rb new file mode 100644 index 000000000000..3c62834ee6d7 --- /dev/null +++ b/lib/datadog_api_client/v2/models/estimation.rb @@ -0,0 +1,145 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Recommended resource values for a Spark driver or executor, derived from recent real usage metrics. Used by SPA to propose more efficient pod sizing. + class Estimation + include BaseGenericModel + + # CPU usage statistics derived from historical Spark job metrics. Provides multiple estimates so users can choose between conservative and cost-saving risk profiles. + attr_accessor :cpu + + # Recommended ephemeral storage allocation (in MiB). Derived from job temporary storage patterns. + attr_accessor :ephemeral_storage + + # Recommended JVM heap size (in MiB). + attr_accessor :heap + + # Recommended total memory allocation (in MiB). Includes both heap and overhead. + attr_accessor :memory + + # Recommended JVM overhead (in MiB). Computed as total memory - heap. + attr_accessor :overhead + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'cpu' => :'cpu', + :'ephemeral_storage' => :'ephemeral_storage', + :'heap' => :'heap', + :'memory' => :'memory', + :'overhead' => :'overhead' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'cpu' => :'Cpu', + :'ephemeral_storage' => :'Integer', + :'heap' => :'Integer', + :'memory' => :'Integer', + :'overhead' => :'Integer' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::Estimation` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'cpu') + self.cpu = attributes[:'cpu'] + end + + if attributes.key?(:'ephemeral_storage') + self.ephemeral_storage = attributes[:'ephemeral_storage'] + end + + if attributes.key?(:'heap') + self.heap = attributes[:'heap'] + end + + if attributes.key?(:'memory') + self.memory = attributes[:'memory'] + end + + if attributes.key?(:'overhead') + self.overhead = attributes[:'overhead'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + cpu == o.cpu && + ephemeral_storage == o.ephemeral_storage && + heap == o.heap && + memory == o.memory && + overhead == o.overhead && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [cpu, ephemeral_storage, heap, memory, overhead, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/recommendation_attributes.rb b/lib/datadog_api_client/v2/models/recommendation_attributes.rb new file mode 100644 index 000000000000..2dce7efcf694 --- /dev/null +++ b/lib/datadog_api_client/v2/models/recommendation_attributes.rb @@ -0,0 +1,144 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Attributes of the SPA Recommendation resource. Contains recommendations for both driver and executor components. + class RecommendationAttributes + include BaseGenericModel + + # Resource recommendation for a single Spark component (driver or executor). Contains estimation data used to patch Spark job specs. + attr_reader :driver + + # Resource recommendation for a single Spark component (driver or executor). Contains estimation data used to patch Spark job specs. + attr_reader :executor + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'driver' => :'driver', + :'executor' => :'executor' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'driver' => :'ComponentRecommendation', + :'executor' => :'ComponentRecommendation' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::RecommendationAttributes` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'driver') + self.driver = attributes[:'driver'] + end + + if attributes.key?(:'executor') + self.executor = attributes[:'executor'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @driver.nil? + return false if @executor.nil? + true + end + + # Custom attribute writer method with validation + # @param driver [Object] Object to be assigned + # @!visibility private + def driver=(driver) + if driver.nil? + fail ArgumentError, 'invalid value for "driver", driver cannot be nil.' + end + @driver = driver + end + + # Custom attribute writer method with validation + # @param executor [Object] Object to be assigned + # @!visibility private + def executor=(executor) + if executor.nil? + fail ArgumentError, 'invalid value for "executor", executor cannot be nil.' + end + @executor = executor + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + driver == o.driver && + executor == o.executor && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [driver, executor, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/recommendation_data.rb b/lib/datadog_api_client/v2/models/recommendation_data.rb new file mode 100644 index 000000000000..134c91af2366 --- /dev/null +++ b/lib/datadog_api_client/v2/models/recommendation_data.rb @@ -0,0 +1,154 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # JSON:API resource object for SPA Recommendation. Includes type, optional ID, and resource attributes with structured recommendations. + class RecommendationData + include BaseGenericModel + + # Attributes of the SPA Recommendation resource. Contains recommendations for both driver and executor components. + attr_reader :attributes + + # Resource identifier for the recommendation. Optional in responses. + attr_accessor :id + + # JSON:API resource type for Spark Pod Autosizing recommendations. Identifies the Recommendation resource returned by SPA. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'id' => :'id', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'RecommendationAttributes', + :'id' => :'String', + :'type' => :'RecommendationType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::RecommendationData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attributes.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + id == o.id && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, id, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/recommendation_document.rb b/lib/datadog_api_client/v2/models/recommendation_document.rb new file mode 100644 index 000000000000..15c5403af0df --- /dev/null +++ b/lib/datadog_api_client/v2/models/recommendation_document.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # JSON:API document containing a single Recommendation resource. Returned by SPA when the Spark Gateway requests recommendations. + class RecommendationDocument + include BaseGenericModel + + # JSON:API resource object for SPA Recommendation. Includes type, optional ID, and resource attributes with structured recommendations. + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'RecommendationData' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::RecommendationDocument` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/recommendation_type.rb b/lib/datadog_api_client/v2/models/recommendation_type.rb new file mode 100644 index 000000000000..96b4e691e380 --- /dev/null +++ b/lib/datadog_api_client/v2/models/recommendation_type.rb @@ -0,0 +1,26 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # JSON:API resource type for Spark Pod Autosizing recommendations. Identifies the Recommendation resource returned by SPA. + class RecommendationType + include BaseEnumModel + + RECOMMENDATION = "recommendation".freeze + end +end