diff --git a/.generator/schemas/v1/openapi.yaml b/.generator/schemas/v1/openapi.yaml index d3016c41cbed..e1d20130c1e8 100644 --- a/.generator/schemas/v1/openapi.yaml +++ b/.generator/schemas/v1/openapi.yaml @@ -1741,6 +1741,9 @@ components: type: string markers: description: List of markers. + example: + - display_type: percentile + value: '90' items: $ref: '#/components/schemas/WidgetMarker' type: array @@ -1799,14 +1802,6 @@ components: - $ref: '#/components/schemas/FormulaAndFunctionMetricQueryDefinition' - $ref: '#/components/schemas/FormulaAndFunctionEventQueryDefinition' - $ref: '#/components/schemas/FormulaAndFunctionApmResourceStatsQueryDefinition' - DistributionWidgetHistogramRequestType: - description: Request type for the histogram request. - enum: - - histogram - example: histogram - type: string - x-enum-varnames: - - HISTOGRAM DistributionWidgetRequest: description: Updated distribution widget. properties: @@ -1816,6 +1811,11 @@ components: $ref: '#/components/schemas/ApmStatsQueryDefinition' event_query: $ref: '#/components/schemas/LogQueryDefinition' + formulas: + description: List of formulas that operate on queries. + items: + $ref: '#/components/schemas/WidgetFormula' + type: array log_query: $ref: '#/components/schemas/LogQueryDefinition' network_query: @@ -1827,10 +1827,17 @@ components: q: description: Widget query. type: string + queries: + description: List of queries that can be returned directly or used in formulas. + items: + $ref: '#/components/schemas/FormulaAndFunctionQueryDefinition' + type: array query: $ref: '#/components/schemas/DistributionWidgetHistogramRequestQuery' request_type: - $ref: '#/components/schemas/DistributionWidgetHistogramRequestType' + $ref: '#/components/schemas/WidgetHistogramRequestType' + response_format: + $ref: '#/components/schemas/FormulaAndFunctionResponseFormat' rum_query: $ref: '#/components/schemas/LogQueryDefinition' security_query: @@ -1854,6 +1861,12 @@ components: description: Specifies minimum value to show on the x-axis. It takes a number, percentile (p90 === 90th percentile), or auto for default behavior. type: string + num_buckets: + description: Number of value buckets to target, also known as the resolution + of the value bins. + format: int64 + minimum: 1 + type: integer scale: default: linear description: Specifies the scale type. Possible values are `linear`. @@ -3752,6 +3765,14 @@ components: type: array legend_size: $ref: '#/components/schemas/WidgetLegendSize' + markers: + description: List of markers. + example: + - display_type: percentile + value: '90' + items: + $ref: '#/components/schemas/WidgetMarker' + type: array requests: description: List of widget types. example: @@ -3776,6 +3797,8 @@ components: type: string type: $ref: '#/components/schemas/HeatMapWidgetDefinitionType' + xaxis: + $ref: '#/components/schemas/HeatMapWidgetXAxis' yaxis: $ref: '#/components/schemas/WidgetAxis' required: @@ -3819,6 +3842,10 @@ components: items: $ref: '#/components/schemas/FormulaAndFunctionQueryDefinition' type: array + query: + $ref: '#/components/schemas/FormulaAndFunctionMetricQueryDefinition' + request_type: + $ref: '#/components/schemas/WidgetHistogramRequestType' response_format: $ref: '#/components/schemas/FormulaAndFunctionResponseFormat' rum_query: @@ -3828,6 +3855,19 @@ components: style: $ref: '#/components/schemas/WidgetStyle' type: object + HeatMapWidgetXAxis: + description: X Axis controls for the heat map widget. + properties: + num_buckets: + description: 'Number of time buckets to target, also known as the resolution + + of the time bins. This is only applicable for distribution of + + points (group distributions use the roll-up modifier).' + format: int64 + minimum: 1 + type: integer + type: object Host: description: Object representing a host. properties: @@ -25230,6 +25270,14 @@ components: x-enum-varnames: - CHECK - CLUSTER + WidgetHistogramRequestType: + description: Request type for the histogram request. + enum: + - histogram + example: histogram + type: string + x-enum-varnames: + - HISTOGRAM WidgetHorizontalAlign: description: Horizontal alignment. enum: @@ -25434,7 +25482,7 @@ components: display_type: description: "Combination of:\n - A severity error, warning, ok, or info\n \ - A line type: dashed, solid, or bold\nIn this case of a Distribution - widget, this can be set to be `x_axis_percentile`." + widget, this can be set to be `percentile`." example: error dashed type: string label: @@ -25445,8 +25493,13 @@ components: description: Timestamp for the widget. type: string value: - description: Value to apply. Can be a single value y = 15 or a range of + description: 'Value to apply. Can be a single value y = 15 or a range of values 0 < y < 10. + + For Distribution widgets with `display_type` set to `percentile`, this + should be + + a numeric percentile value (for example, "90" for P90).' example: y = 15 type: string required: diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index f701faf62bea..6f4a04ffa01e 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -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: @@ -86626,13 +86629,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 @@ -86646,6 +86715,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: @@ -86684,11 +86758,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 diff --git a/cassettes/features/v1/dashboards/Create-a-new-dashboard-with-distribution-widget-with-markers-and-num-buckets.frozen b/cassettes/features/v1/dashboards/Create-a-new-dashboard-with-distribution-widget-with-markers-and-num-buckets.frozen new file mode 100644 index 000000000000..957e38ac24a5 --- /dev/null +++ b/cassettes/features/v1/dashboards/Create-a-new-dashboard-with-distribution-widget-with-markers-and-num-buckets.frozen @@ -0,0 +1 @@ +2025-12-04T23:08:04.708Z \ No newline at end of file diff --git a/cassettes/features/v1/dashboards/Create-a-new-dashboard-with-distribution-widget-with-markers-and-num-buckets.yml b/cassettes/features/v1/dashboards/Create-a-new-dashboard-with-distribution-widget-with-markers-and-num-buckets.yml new file mode 100644 index 000000000000..5bfe76c5deb0 --- /dev/null +++ b/cassettes/features/v1/dashboards/Create-a-new-dashboard-with-distribution-widget-with-markers-and-num-buckets.yml @@ -0,0 +1,45 @@ +http_interactions: +- recorded_at: Thu, 04 Dec 2025 23:08:04 GMT + request: + body: + encoding: UTF-8 + string: '{"layout_type":"ordered","title":"Test-Create_a_new_dashboard_with_distribution_widget_with_markers_and_num_buckets-1764889684","widgets":[{"definition":{"markers":[{"display_type":"percentile","value":"50"},{"display_type":"percentile","value":"99"},{"display_type":"percentile","value":"90"}],"requests":[{"queries":[{"aggregator":"avg","data_source":"metrics","name":"query1","query":"avg:system.cpu.user{*} + by {service}"}],"response_format":"scalar"}],"title":"","title_align":"left","title_size":"16","type":"distribution","xaxis":{"include_zero":true,"max":"auto","min":"auto","num_buckets":55,"scale":"linear"},"yaxis":{"include_zero":true,"max":"auto","min":"auto","scale":"linear"}},"layout":{"height":4,"width":4,"x":0,"y":0}}]}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v1/dashboard + response: + body: + encoding: UTF-8 + string: '{"id":"ved-atm-2g5","title":"Test-Create_a_new_dashboard_with_distribution_widget_with_markers_and_num_buckets-1764889684","description":null,"author_handle":"shishi.liu@datadoghq.com","author_name":"Shishi + Liu","layout_type":"ordered","url":"/dashboard/ved-atm-2g5/test-createanewdashboardwithdistributionwidgetwithmarkersandnumbuckets-176488968","template_variables":null,"widgets":[{"definition":{"markers":[{"display_type":"percentile","value":"50"},{"display_type":"percentile","value":"99"},{"display_type":"percentile","value":"90"}],"requests":[{"queries":[{"aggregator":"avg","data_source":"metrics","name":"query1","query":"avg:system.cpu.user{*} + by {service}"}],"response_format":"scalar"}],"title":"","title_align":"left","title_size":"16","type":"distribution","xaxis":{"include_zero":true,"max":"auto","min":"auto","num_buckets":55,"scale":"linear"},"yaxis":{"include_zero":true,"max":"auto","min":"auto","scale":"linear"}},"layout":{"height":4,"width":4,"x":0,"y":0},"id":984443192078703}],"notify_list":null,"created_at":"2025-12-04T23:08:05.111437+00:00","modified_at":"2025-12-04T23:08:05.111437+00:00","restricted_roles":[]}' + headers: + Content-Type: + - application/json + status: + code: 200 + message: OK +- recorded_at: Thu, 04 Dec 2025 23:08:04 GMT + request: + body: null + headers: + Accept: + - application/json + method: DELETE + uri: https://api.datadoghq.com/api/v1/dashboard/ved-atm-2g5 + response: + body: + encoding: UTF-8 + string: '{"deleted_dashboard_id":"ved-atm-2g5"}' + headers: + Content-Type: + - application/json + status: + code: 200 + message: OK +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v1/dashboards/Create-a-new-dashboard-with-formula-and-function-distribution-widget.frozen b/cassettes/features/v1/dashboards/Create-a-new-dashboard-with-formula-and-function-distribution-widget.frozen new file mode 100644 index 000000000000..028130f6b8a4 --- /dev/null +++ b/cassettes/features/v1/dashboards/Create-a-new-dashboard-with-formula-and-function-distribution-widget.frozen @@ -0,0 +1 @@ +2025-12-15T17:03:52.164Z \ No newline at end of file diff --git a/cassettes/features/v1/dashboards/Create-a-new-dashboard-with-formula-and-function-distribution-widget.yml b/cassettes/features/v1/dashboards/Create-a-new-dashboard-with-formula-and-function-distribution-widget.yml new file mode 100644 index 000000000000..476c762f5047 --- /dev/null +++ b/cassettes/features/v1/dashboards/Create-a-new-dashboard-with-formula-and-function-distribution-widget.yml @@ -0,0 +1,43 @@ +http_interactions: +- recorded_at: Mon, 15 Dec 2025 17:03:52 GMT + request: + body: + encoding: UTF-8 + string: '{"layout_type":"free","notify_list":[],"template_variables":[],"title":"Test-Create_a_new_dashboard_with_formula_and_function_distribution_widget-1765818232","widgets":[{"definition":{"requests":[{"queries":[{"compute":{"aggregation":"avg","metric":"@duration"},"data_source":"logs","group_by":[{"facet":"service","limit":1000,"sort":{"aggregation":"count","order":"desc"}}],"indexes":["*"],"name":"query1","search":{"query":""},"storage":"hot"}],"response_format":"scalar"}],"time":{},"title":"","title_align":"left","title_size":"16","type":"distribution"},"layout":{"height":15,"width":47,"x":0,"y":0}}]}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v1/dashboard + response: + body: + encoding: UTF-8 + string: '{"id":"ii3-z6t-p8x","title":"Test-Create_a_new_dashboard_with_formula_and_function_distribution_widget-1765818232","description":null,"author_handle":"shishi.liu@datadoghq.com","author_name":"Shishi + Liu","layout_type":"free","url":"/dashboard/ii3-z6t-p8x/test-createanewdashboardwithformulaandfunctiondistributionwidget-1765818232","template_variables":[],"widgets":[{"definition":{"requests":[{"queries":[{"compute":{"aggregation":"avg","metric":"@duration"},"data_source":"logs","group_by":[{"facet":"service","limit":1000,"sort":{"aggregation":"count","order":"desc"}}],"indexes":["*"],"name":"query1","search":{"query":""},"storage":"hot"}],"response_format":"scalar"}],"time":{},"title":"","title_align":"left","title_size":"16","type":"distribution"},"layout":{"height":15,"width":47,"x":0,"y":0},"id":1822470106302094}],"notify_list":[],"created_at":"2025-12-15T17:03:52.607823+00:00","modified_at":"2025-12-15T17:03:52.607823+00:00","restricted_roles":[]}' + headers: + Content-Type: + - application/json + status: + code: 200 + message: OK +- recorded_at: Mon, 15 Dec 2025 17:03:52 GMT + request: + body: null + headers: + Accept: + - application/json + method: DELETE + uri: https://api.datadoghq.com/api/v1/dashboard/ii3-z6t-p8x + response: + body: + encoding: UTF-8 + string: '{"deleted_dashboard_id":"ii3-z6t-p8x"}' + headers: + Content-Type: + - application/json + status: + code: 200 + message: OK +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v1/dashboards/Create-a-new-dashboard-with-heatmap-widget-with-markers-and-num-buckets.frozen b/cassettes/features/v1/dashboards/Create-a-new-dashboard-with-heatmap-widget-with-markers-and-num-buckets.frozen new file mode 100644 index 000000000000..502143efd661 --- /dev/null +++ b/cassettes/features/v1/dashboards/Create-a-new-dashboard-with-heatmap-widget-with-markers-and-num-buckets.frozen @@ -0,0 +1 @@ +2025-12-15T17:39:03.378Z \ No newline at end of file diff --git a/cassettes/features/v1/dashboards/Create-a-new-dashboard-with-heatmap-widget-with-markers-and-num-buckets.yml b/cassettes/features/v1/dashboards/Create-a-new-dashboard-with-heatmap-widget-with-markers-and-num-buckets.yml new file mode 100644 index 000000000000..64a282908910 --- /dev/null +++ b/cassettes/features/v1/dashboards/Create-a-new-dashboard-with-heatmap-widget-with-markers-and-num-buckets.yml @@ -0,0 +1,43 @@ +http_interactions: +- recorded_at: Mon, 15 Dec 2025 17:39:03 GMT + request: + body: + encoding: UTF-8 + string: '{"layout_type":"ordered","title":"Test-Create_a_new_dashboard_with_heatmap_widget_with_markers_and_num_buckets-1765820343","widgets":[{"definition":{"markers":[{"display_type":"percentile","value":"50"},{"display_type":"percentile","value":"99"}],"requests":[{"query":{"data_source":"metrics","name":"query1","query":"histogram:trace.servlet.request{*}"},"request_type":"histogram"}],"title":"","title_align":"left","title_size":"16","type":"heatmap","xaxis":{"num_buckets":75},"yaxis":{"include_zero":true,"max":"auto","min":"auto","scale":"linear"}},"layout":{"height":4,"width":4,"x":0,"y":0}}]}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v1/dashboard + response: + body: + encoding: UTF-8 + string: '{"id":"r3p-kik-ven","title":"Test-Create_a_new_dashboard_with_heatmap_widget_with_markers_and_num_buckets-1765820343","description":null,"author_handle":"shishi.liu@datadoghq.com","author_name":"Shishi + Liu","layout_type":"ordered","url":"/dashboard/r3p-kik-ven/test-createanewdashboardwithheatmapwidgetwithmarkersandnumbuckets-1765820343","template_variables":null,"widgets":[{"definition":{"markers":[{"display_type":"percentile","value":"50"},{"display_type":"percentile","value":"99"}],"requests":[{"query":{"data_source":"metrics","name":"query1","query":"histogram:trace.servlet.request{*}"},"request_type":"histogram"}],"title":"","title_align":"left","title_size":"16","type":"heatmap","xaxis":{"num_buckets":75},"yaxis":{"include_zero":true,"max":"auto","min":"auto","scale":"linear"}},"layout":{"height":4,"width":4,"x":0,"y":0},"id":4627813855695599}],"notify_list":null,"created_at":"2025-12-15T17:39:03.852775+00:00","modified_at":"2025-12-15T17:39:03.852775+00:00","restricted_roles":[]}' + headers: + Content-Type: + - application/json + status: + code: 200 + message: OK +- recorded_at: Mon, 15 Dec 2025 17:39:03 GMT + request: + body: null + headers: + Accept: + - application/json + method: DELETE + uri: https://api.datadoghq.com/api/v1/dashboard/r3p-kik-ven + response: + body: + encoding: UTF-8 + string: '{"deleted_dashboard_id":"r3p-kik-ven"}' + headers: + Content-Type: + - application/json + status: + code: 200 + message: OK +recorded_with: VCR 6.0.0 diff --git a/examples/v1/dashboards/CreateDashboard_1093147852.rb b/examples/v1/dashboards/CreateDashboard_1093147852.rb new file mode 100644 index 000000000000..962c2c80613b --- /dev/null +++ b/examples/v1/dashboards/CreateDashboard_1093147852.rb @@ -0,0 +1,66 @@ +# Create a new dashboard with distribution widget with markers and num_buckets + +require "datadog_api_client" +api_instance = DatadogAPIClient::V1::DashboardsAPI.new + +body = DatadogAPIClient::V1::Dashboard.new({ + title: "Example-Dashboard", + widgets: [ + DatadogAPIClient::V1::Widget.new({ + definition: DatadogAPIClient::V1::DistributionWidgetDefinition.new({ + title: "", + title_size: "16", + title_align: DatadogAPIClient::V1::WidgetTextAlign::LEFT, + type: DatadogAPIClient::V1::DistributionWidgetDefinitionType::DISTRIBUTION, + xaxis: DatadogAPIClient::V1::DistributionWidgetXAxis.new({ + scale: "linear", + min: "auto", + max: "auto", + include_zero: true, + num_buckets: 55, + }), + yaxis: DatadogAPIClient::V1::DistributionWidgetYAxis.new({ + scale: "linear", + min: "auto", + max: "auto", + include_zero: true, + }), + markers: [ + DatadogAPIClient::V1::WidgetMarker.new({ + display_type: "percentile", + value: "50", + }), + DatadogAPIClient::V1::WidgetMarker.new({ + display_type: "percentile", + value: "99", + }), + DatadogAPIClient::V1::WidgetMarker.new({ + display_type: "percentile", + value: "90", + }), + ], + requests: [ + DatadogAPIClient::V1::DistributionWidgetRequest.new({ + response_format: DatadogAPIClient::V1::FormulaAndFunctionResponseFormat::SCALAR, + queries: [ + DatadogAPIClient::V1::FormulaAndFunctionMetricQueryDefinition.new({ + data_source: DatadogAPIClient::V1::FormulaAndFunctionMetricDataSource::METRICS, + name: "query1", + query: "avg:system.cpu.user{*} by {service}", + aggregator: DatadogAPIClient::V1::FormulaAndFunctionMetricAggregation::AVG, + }), + ], + }), + ], + }), + layout: DatadogAPIClient::V1::WidgetLayout.new({ + x: 0, + y: 0, + width: 4, + height: 4, + }), + }), + ], + layout_type: DatadogAPIClient::V1::DashboardLayoutType::ORDERED, +}) +p api_instance.create_dashboard(body) diff --git a/examples/v1/dashboards/CreateDashboard_1442588603.rb b/examples/v1/dashboards/CreateDashboard_1442588603.rb index e04d35d225e4..bd34ecd63e79 100644 --- a/examples/v1/dashboards/CreateDashboard_1442588603.rb +++ b/examples/v1/dashboards/CreateDashboard_1442588603.rb @@ -41,7 +41,7 @@ primary_tag_name: "datacenter", operation_name: "universal.http.client", }), - request_type: DatadogAPIClient::V1::DistributionWidgetHistogramRequestType::HISTOGRAM, + request_type: DatadogAPIClient::V1::WidgetHistogramRequestType::HISTOGRAM, style: DatadogAPIClient::V1::WidgetStyle.new({ palette: "dog_classic", }), diff --git a/examples/v1/dashboards/CreateDashboard_1617893815.rb b/examples/v1/dashboards/CreateDashboard_1617893815.rb new file mode 100644 index 000000000000..7f8a4b5ad93c --- /dev/null +++ b/examples/v1/dashboards/CreateDashboard_1617893815.rb @@ -0,0 +1,61 @@ +# Create a new dashboard with formula and function distribution widget + +require "datadog_api_client" +api_instance = DatadogAPIClient::V1::DashboardsAPI.new + +body = DatadogAPIClient::V1::Dashboard.new({ + title: "Example-Dashboard", + widgets: [ + DatadogAPIClient::V1::Widget.new({ + layout: DatadogAPIClient::V1::WidgetLayout.new({ + x: 0, + y: 0, + width: 47, + height: 15, + }), + definition: DatadogAPIClient::V1::DistributionWidgetDefinition.new({ + title: "", + title_size: "16", + title_align: DatadogAPIClient::V1::WidgetTextAlign::LEFT, + time: DatadogAPIClient::V1::WidgetLegacyLiveSpan.new({}), + type: DatadogAPIClient::V1::DistributionWidgetDefinitionType::DISTRIBUTION, + requests: [ + DatadogAPIClient::V1::DistributionWidgetRequest.new({ + response_format: DatadogAPIClient::V1::FormulaAndFunctionResponseFormat::SCALAR, + queries: [ + DatadogAPIClient::V1::FormulaAndFunctionEventQueryDefinition.new({ + data_source: DatadogAPIClient::V1::FormulaAndFunctionEventsDataSource::LOGS, + name: "query1", + search: DatadogAPIClient::V1::FormulaAndFunctionEventQueryDefinitionSearch.new({ + query: "", + }), + indexes: [ + "*", + ], + compute: DatadogAPIClient::V1::FormulaAndFunctionEventQueryDefinitionCompute.new({ + aggregation: DatadogAPIClient::V1::FormulaAndFunctionEventAggregation::AVG, + metric: "@duration", + }), + group_by: [ + DatadogAPIClient::V1::FormulaAndFunctionEventQueryGroupBy.new({ + facet: "service", + limit: 1000, + sort: DatadogAPIClient::V1::FormulaAndFunctionEventQueryGroupBySort.new({ + aggregation: DatadogAPIClient::V1::FormulaAndFunctionEventAggregation::COUNT, + order: DatadogAPIClient::V1::QuerySortOrder::DESC, + }), + }), + ], + storage: "hot", + }), + ], + }), + ], + }), + }), + ], + template_variables: [], + layout_type: DatadogAPIClient::V1::DashboardLayoutType::FREE, + notify_list: [], +}) +p api_instance.create_dashboard(body) diff --git a/examples/v1/dashboards/CreateDashboard_252716965.rb b/examples/v1/dashboards/CreateDashboard_252716965.rb index 4f4133ab7701..abe7ef340488 100644 --- a/examples/v1/dashboards/CreateDashboard_252716965.rb +++ b/examples/v1/dashboards/CreateDashboard_252716965.rb @@ -38,7 +38,7 @@ data_source: DatadogAPIClient::V1::FormulaAndFunctionMetricDataSource::METRICS, name: "query1", }), - request_type: DatadogAPIClient::V1::DistributionWidgetHistogramRequestType::HISTOGRAM, + request_type: DatadogAPIClient::V1::WidgetHistogramRequestType::HISTOGRAM, style: DatadogAPIClient::V1::WidgetStyle.new({ palette: "dog_classic", }), diff --git a/examples/v1/dashboards/CreateDashboard_2823363212.rb b/examples/v1/dashboards/CreateDashboard_2823363212.rb new file mode 100644 index 000000000000..0b0b2a5a4c74 --- /dev/null +++ b/examples/v1/dashboards/CreateDashboard_2823363212.rb @@ -0,0 +1,55 @@ +# Create a new dashboard with heatmap widget with markers and num_buckets + +require "datadog_api_client" +api_instance = DatadogAPIClient::V1::DashboardsAPI.new + +body = DatadogAPIClient::V1::Dashboard.new({ + title: "Example-Dashboard", + widgets: [ + DatadogAPIClient::V1::Widget.new({ + definition: DatadogAPIClient::V1::HeatMapWidgetDefinition.new({ + title: "", + title_size: "16", + title_align: DatadogAPIClient::V1::WidgetTextAlign::LEFT, + type: DatadogAPIClient::V1::HeatMapWidgetDefinitionType::HEATMAP, + xaxis: DatadogAPIClient::V1::HeatMapWidgetXAxis.new({ + num_buckets: 75, + }), + yaxis: DatadogAPIClient::V1::WidgetAxis.new({ + scale: "linear", + min: "auto", + max: "auto", + include_zero: true, + }), + markers: [ + DatadogAPIClient::V1::WidgetMarker.new({ + display_type: "percentile", + value: "50", + }), + DatadogAPIClient::V1::WidgetMarker.new({ + display_type: "percentile", + value: "99", + }), + ], + requests: [ + DatadogAPIClient::V1::HeatMapWidgetRequest.new({ + request_type: DatadogAPIClient::V1::WidgetHistogramRequestType::HISTOGRAM, + query: DatadogAPIClient::V1::FormulaAndFunctionMetricQueryDefinition.new({ + data_source: DatadogAPIClient::V1::FormulaAndFunctionMetricDataSource::METRICS, + name: "query1", + query: "histogram:trace.servlet.request{*}", + }), + }), + ], + }), + layout: DatadogAPIClient::V1::WidgetLayout.new({ + x: 0, + y: 0, + width: 4, + height: 4, + }), + }), + ], + layout_type: DatadogAPIClient::V1::DashboardLayoutType::ORDERED, +}) +p api_instance.create_dashboard(body) diff --git a/examples/v1/dashboards/CreateDashboard_3882428227.rb b/examples/v1/dashboards/CreateDashboard_3882428227.rb index 7fd496587046..4bd9d314d09b 100644 --- a/examples/v1/dashboards/CreateDashboard_3882428227.rb +++ b/examples/v1/dashboards/CreateDashboard_3882428227.rb @@ -43,7 +43,7 @@ ], group_by: [], }), - request_type: DatadogAPIClient::V1::DistributionWidgetHistogramRequestType::HISTOGRAM, + request_type: DatadogAPIClient::V1::WidgetHistogramRequestType::HISTOGRAM, }), ], }), diff --git a/examples/v2/spa/GetSPARecommendations.rb b/examples/v2/spa/GetSPARecommendations.rb index 0234fd1e23cc..5c66dd77aefb 100644 --- a/examples/v2/spa/GetSPARecommendations.rb +++ b/examples/v2/spa/GetSPARecommendations.rb @@ -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") diff --git a/examples/v2/spa/GetSPARecommendationsWithShard.rb b/examples/v2/spa/GetSPARecommendationsWithShard.rb new file mode 100644 index 000000000000..b0e1e44fec69 --- /dev/null +++ b/examples/v2/spa/GetSPARecommendationsWithShard.rb @@ -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") diff --git a/features/scenarios_model_mapping.rb b/features/scenarios_model_mapping.rb index 50840f4f7593..976270013450 100644 --- a/features/scenarios_model_mapping.rb +++ b/features/scenarios_model_mapping.rb @@ -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", diff --git a/features/v1/dashboards.feature b/features/v1/dashboards.feature index 588c609ceddb..076546114f1f 100644 --- a/features/v1/dashboards.feature +++ b/features/v1/dashboards.feature @@ -368,6 +368,15 @@ Feature: Dashboards And the response "widgets[0].definition.requests[0].apm_stats_query.service" is equal to "cassandra" And the response "widgets[0].definition.requests[0].apm_stats_query.name" is equal to "cassandra.query" + @team:DataDog/dashboards-backend + Scenario: Create a new dashboard with distribution widget with markers and num_buckets + Given new "CreateDashboard" request + And body with value { "title": "{{ unique }}", "widgets": [{"definition": { "title": "", "title_size": "16", "title_align": "left", "type": "distribution", "xaxis": { "scale": "linear", "min": "auto", "max": "auto", "include_zero": true, "num_buckets": 55 }, "yaxis": { "scale": "linear", "min": "auto", "max": "auto", "include_zero": true }, "markers": [{ "display_type": "percentile", "value": "50" }, { "display_type": "percentile", "value": "99" }, { "display_type": "percentile", "value": "90" }], "requests": [{ "response_format": "scalar", "queries": [{ "data_source": "metrics", "name": "query1", "query": "avg:system.cpu.user{*} by {service}", "aggregator": "avg" }] }] }, "layout": { "x": 0, "y": 0, "width": 4, "height": 4 } } ], "layout_type": "ordered" } + When the request is sent + Then the response status is 200 OK + And the response "widgets[0].definition.xaxis.num_buckets" is equal to 55 + And the response "widgets[0].definition.markers" is equal to [{"display_type": "percentile", "value": "50"}, {"display_type": "percentile", "value": "99"}, {"display_type": "percentile", "value": "90"}] + @team:DataDog/dashboards-backend Scenario: Create a new dashboard with event_stream list_stream widget Given new "CreateDashboard" request @@ -397,6 +406,20 @@ Feature: Dashboards And the response "widgets[0].definition.type" is equal to "event_timeline" And the response "widgets[0].definition.query" is equal to "status:error priority:all" + @team:DataDog/dashboards-backend + Scenario: Create a new dashboard with formula and function distribution widget + Given new "CreateDashboard" request + And body with value {"title": "{{ unique }}", "widgets": [{"layout": {"x": 0, "y": 0, "width": 47, "height": 15}, "definition": {"title": "", "title_size": "16", "title_align": "left", "time": {}, "type": "distribution", "requests": [{"response_format": "scalar", "queries": [{"data_source": "logs", "name": "query1", "search": {"query": ""}, "indexes": ["*"], "compute": {"aggregation": "avg", "metric": "@duration"}, "group_by": [{"facet": "service", "limit": 1000, "sort": {"aggregation": "count", "order": "desc"}}], "storage": "hot"}]}]}}], "template_variables": [], "layout_type": "free", "notify_list": []} + When the request is sent + Then the response status is 200 OK + And the response "widgets[0].definition.type" is equal to "distribution" + And the response "widgets[0].definition.requests[0].response_format" is equal to "scalar" + And the response "widgets[0].definition.requests[0].queries[0].data_source" is equal to "logs" + And the response "widgets[0].definition.requests[0].queries[0].name" is equal to "query1" + And the response "widgets[0].definition.requests[0].queries[0].compute.aggregation" is equal to "avg" + And the response "widgets[0].definition.requests[0].queries[0].compute.metric" is equal to "@duration" + And the response "widgets[0].definition.requests[0].queries[0].group_by[0].facet" is equal to "service" + @team:DataDog/dashboards-backend Scenario: Create a new dashboard with formula and function heatmap widget Given new "CreateDashboard" request @@ -471,6 +494,15 @@ Feature: Dashboards And the response "widgets[0].definition.type" is equal to "heatmap" And the response "widgets[0].definition.requests[0].q" is equal to "avg:system.cpu.user{*} by {service}" + @team:DataDog/dashboards-backend + Scenario: Create a new dashboard with heatmap widget with markers and num_buckets + Given new "CreateDashboard" request + And body with value { "title": "{{ unique }}", "widgets": [{"definition": { "title": "", "title_size": "16", "title_align": "left", "type": "heatmap", "xaxis": { "num_buckets": 75 }, "yaxis": { "scale": "linear", "min": "auto", "max": "auto", "include_zero": true }, "markers": [{ "display_type": "percentile", "value": "50" }, { "display_type": "percentile", "value": "99" }], "requests": [{ "request_type": "histogram", "query": { "data_source": "metrics", "name": "query1", "query": "histogram:trace.servlet.request{*}"} }] }, "layout": { "x": 0, "y": 0, "width": 4, "height": 4 } }], "layout_type": "ordered" } + When the request is sent + Then the response status is 200 OK + And the response "widgets[0].definition.xaxis.num_buckets" is equal to 75 + And the response "widgets[0].definition.markers" is equal to [{"display_type": "percentile", "value": "50"}, {"display_type": "percentile", "value": "99"}] + @team:DataDog/dashboards-backend Scenario: Create a new dashboard with hostmap widget Given new "CreateDashboard" request diff --git a/features/v2/spa.feature b/features/v2/spa.feature index 327bbf16ac09..0e6ac6b3a76b 100644 --- a/features/v2/spa.feature +++ b/features/v2/spa.feature @@ -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 diff --git a/features/v2/undo.json b/features/v2/undo.json index b54378e93ba6..c6c7be164892 100644 --- a/features/v2/undo.json +++ b/features/v2/undo.json @@ -4484,6 +4484,12 @@ "type": "safe" } }, + "GetSPARecommendationsWithShard": { + "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 3257b422c9b1..ee78a48c1934 100644 --- a/lib/datadog_api_client/configuration.rb +++ b/lib/datadog_api_client/configuration.rb @@ -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, diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index bb4a9b220d44..59bc1b2037db 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -97,7 +97,6 @@ def overrides "v1.distribution_widget_definition" => "DistributionWidgetDefinition", "v1.distribution_widget_definition_type" => "DistributionWidgetDefinitionType", "v1.distribution_widget_histogram_request_query" => "DistributionWidgetHistogramRequestQuery", - "v1.distribution_widget_histogram_request_type" => "DistributionWidgetHistogramRequestType", "v1.distribution_widget_request" => "DistributionWidgetRequest", "v1.distribution_widget_x_axis" => "DistributionWidgetXAxis", "v1.distribution_widget_y_axis" => "DistributionWidgetYAxis", @@ -170,6 +169,7 @@ def overrides "v1.heat_map_widget_definition" => "HeatMapWidgetDefinition", "v1.heat_map_widget_definition_type" => "HeatMapWidgetDefinitionType", "v1.heat_map_widget_request" => "HeatMapWidgetRequest", + "v1.heat_map_widget_x_axis" => "HeatMapWidgetXAxis", "v1.host" => "Host", "v1.host_list_response" => "HostListResponse", "v1.host_map_request" => "HostMapRequest", @@ -928,6 +928,7 @@ def overrides "v1.widget_formula_style" => "WidgetFormulaStyle", "v1.widget_grouping" => "WidgetGrouping", "v1.widget_group_sort" => "WidgetGroupSort", + "v1.widget_histogram_request_type" => "WidgetHistogramRequestType", "v1.widget_horizontal_align" => "WidgetHorizontalAlign", "v1.widget_image_sizing" => "WidgetImageSizing", "v1.widget_layout" => "WidgetLayout", diff --git a/lib/datadog_api_client/v1/models/distribution_widget_request.rb b/lib/datadog_api_client/v1/models/distribution_widget_request.rb index 2119406a3e9e..6f55d9aef3d3 100644 --- a/lib/datadog_api_client/v1/models/distribution_widget_request.rb +++ b/lib/datadog_api_client/v1/models/distribution_widget_request.rb @@ -30,6 +30,9 @@ class DistributionWidgetRequest # The log query. attr_accessor :event_query + # List of formulas that operate on queries. + attr_accessor :formulas + # The log query. attr_accessor :log_query @@ -45,12 +48,18 @@ class DistributionWidgetRequest # Widget query. attr_accessor :q + # List of queries that can be returned directly or used in formulas. + attr_accessor :queries + # Query definition for Distribution Widget Histogram Request attr_accessor :query # Request type for the histogram request. attr_accessor :request_type + # Timeseries, scalar, or event list response. Event list response formats are supported by Geomap widgets. + attr_accessor :response_format + # The log query. attr_accessor :rum_query @@ -69,13 +78,16 @@ def self.attribute_map :'apm_query' => :'apm_query', :'apm_stats_query' => :'apm_stats_query', :'event_query' => :'event_query', + :'formulas' => :'formulas', :'log_query' => :'log_query', :'network_query' => :'network_query', :'process_query' => :'process_query', :'profile_metrics_query' => :'profile_metrics_query', :'q' => :'q', + :'queries' => :'queries', :'query' => :'query', :'request_type' => :'request_type', + :'response_format' => :'response_format', :'rum_query' => :'rum_query', :'security_query' => :'security_query', :'style' => :'style' @@ -89,13 +101,16 @@ def self.openapi_types :'apm_query' => :'LogQueryDefinition', :'apm_stats_query' => :'ApmStatsQueryDefinition', :'event_query' => :'LogQueryDefinition', + :'formulas' => :'Array', :'log_query' => :'LogQueryDefinition', :'network_query' => :'LogQueryDefinition', :'process_query' => :'ProcessQueryDefinition', :'profile_metrics_query' => :'LogQueryDefinition', :'q' => :'String', + :'queries' => :'Array', :'query' => :'DistributionWidgetHistogramRequestQuery', - :'request_type' => :'DistributionWidgetHistogramRequestType', + :'request_type' => :'WidgetHistogramRequestType', + :'response_format' => :'FormulaAndFunctionResponseFormat', :'rum_query' => :'LogQueryDefinition', :'security_query' => :'LogQueryDefinition', :'style' => :'WidgetStyle' @@ -132,6 +147,12 @@ def initialize(attributes = {}) self.event_query = attributes[:'event_query'] end + if attributes.key?(:'formulas') + if (value = attributes[:'formulas']).is_a?(Array) + self.formulas = value + end + end + if attributes.key?(:'log_query') self.log_query = attributes[:'log_query'] end @@ -152,6 +173,12 @@ def initialize(attributes = {}) self.q = attributes[:'q'] end + if attributes.key?(:'queries') + if (value = attributes[:'queries']).is_a?(Array) + self.queries = value + end + end + if attributes.key?(:'query') self.query = attributes[:'query'] end @@ -160,6 +187,10 @@ def initialize(attributes = {}) self.request_type = attributes[:'request_type'] end + if attributes.key?(:'response_format') + self.response_format = attributes[:'response_format'] + end + if attributes.key?(:'rum_query') self.rum_query = attributes[:'rum_query'] end @@ -202,13 +233,16 @@ def ==(o) apm_query == o.apm_query && apm_stats_query == o.apm_stats_query && event_query == o.event_query && + formulas == o.formulas && log_query == o.log_query && network_query == o.network_query && process_query == o.process_query && profile_metrics_query == o.profile_metrics_query && q == o.q && + queries == o.queries && query == o.query && request_type == o.request_type && + response_format == o.response_format && rum_query == o.rum_query && security_query == o.security_query && style == o.style && @@ -219,7 +253,7 @@ def ==(o) # @return [Integer] Hash code # @!visibility private def hash - [apm_query, apm_stats_query, event_query, log_query, network_query, process_query, profile_metrics_query, q, query, request_type, rum_query, security_query, style, additional_properties].hash + [apm_query, apm_stats_query, event_query, formulas, log_query, network_query, process_query, profile_metrics_query, q, queries, query, request_type, response_format, rum_query, security_query, style, additional_properties].hash end end end diff --git a/lib/datadog_api_client/v1/models/distribution_widget_x_axis.rb b/lib/datadog_api_client/v1/models/distribution_widget_x_axis.rb index b7ca7472c7f6..042dc7961be9 100644 --- a/lib/datadog_api_client/v1/models/distribution_widget_x_axis.rb +++ b/lib/datadog_api_client/v1/models/distribution_widget_x_axis.rb @@ -30,6 +30,9 @@ class DistributionWidgetXAxis # Specifies minimum value to show on the x-axis. It takes a number, percentile (p90 === 90th percentile), or auto for default behavior. attr_accessor :min + # Number of value buckets to target, also known as the resolution of the value bins. + attr_reader :num_buckets + # Specifies the scale type. Possible values are `linear`. attr_accessor :scale @@ -42,6 +45,7 @@ def self.attribute_map :'include_zero' => :'include_zero', :'max' => :'max', :'min' => :'min', + :'num_buckets' => :'num_buckets', :'scale' => :'scale' } end @@ -53,6 +57,7 @@ def self.openapi_types :'include_zero' => :'Boolean', :'max' => :'String', :'min' => :'String', + :'num_buckets' => :'Integer', :'scale' => :'String' } end @@ -87,11 +92,33 @@ def initialize(attributes = {}) self.min = attributes[:'min'] end + if attributes.key?(:'num_buckets') + self.num_buckets = attributes[:'num_buckets'] + end + if attributes.key?(:'scale') self.scale = attributes[:'scale'] 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 !@num_buckets.nil? && @num_buckets < 1 + true + end + + # Custom attribute writer method with validation + # @param num_buckets [Object] Object to be assigned + # @!visibility private + def num_buckets=(num_buckets) + if !num_buckets.nil? && num_buckets < 1 + fail ArgumentError, 'invalid value for "num_buckets", must be greater than or equal to 1.' + end + @num_buckets = num_buckets + end + # Returns the object in the form of hash, with additionalProperties support. # @return [Hash] Returns the object in the form of hash # @!visibility private @@ -121,6 +148,7 @@ def ==(o) include_zero == o.include_zero && max == o.max && min == o.min && + num_buckets == o.num_buckets && scale == o.scale && additional_properties == o.additional_properties end @@ -129,7 +157,7 @@ def ==(o) # @return [Integer] Hash code # @!visibility private def hash - [include_zero, max, min, scale, additional_properties].hash + [include_zero, max, min, num_buckets, scale, additional_properties].hash end end end diff --git a/lib/datadog_api_client/v1/models/heat_map_widget_definition.rb b/lib/datadog_api_client/v1/models/heat_map_widget_definition.rb index b53097ae5523..f50545502b18 100644 --- a/lib/datadog_api_client/v1/models/heat_map_widget_definition.rb +++ b/lib/datadog_api_client/v1/models/heat_map_widget_definition.rb @@ -30,6 +30,9 @@ class HeatMapWidgetDefinition # Available legend sizes for a widget. Should be one of "0", "2", "4", "8", "16", or "auto". attr_accessor :legend_size + # List of markers. + attr_accessor :markers + # List of widget types. attr_reader :requests @@ -51,6 +54,9 @@ class HeatMapWidgetDefinition # Type of the heat map widget. attr_reader :type + # X Axis controls for the heat map widget. + attr_accessor :xaxis + # Axis controls for the widget. attr_accessor :yaxis @@ -63,6 +69,7 @@ def self.attribute_map :'custom_links' => :'custom_links', :'events' => :'events', :'legend_size' => :'legend_size', + :'markers' => :'markers', :'requests' => :'requests', :'show_legend' => :'show_legend', :'time' => :'time', @@ -70,6 +77,7 @@ def self.attribute_map :'title_align' => :'title_align', :'title_size' => :'title_size', :'type' => :'type', + :'xaxis' => :'xaxis', :'yaxis' => :'yaxis' } end @@ -81,6 +89,7 @@ def self.openapi_types :'custom_links' => :'Array', :'events' => :'Array', :'legend_size' => :'String', + :'markers' => :'Array', :'requests' => :'Array', :'show_legend' => :'Boolean', :'time' => :'WidgetTime', @@ -88,6 +97,7 @@ def self.openapi_types :'title_align' => :'WidgetTextAlign', :'title_size' => :'String', :'type' => :'HeatMapWidgetDefinitionType', + :'xaxis' => :'HeatMapWidgetXAxis', :'yaxis' => :'WidgetAxis' } end @@ -126,6 +136,12 @@ def initialize(attributes = {}) self.legend_size = attributes[:'legend_size'] end + if attributes.key?(:'markers') + if (value = attributes[:'markers']).is_a?(Array) + self.markers = value + end + end + if attributes.key?(:'requests') if (value = attributes[:'requests']).is_a?(Array) self.requests = value @@ -156,6 +172,10 @@ def initialize(attributes = {}) self.type = attributes[:'type'] end + if attributes.key?(:'xaxis') + self.xaxis = attributes[:'xaxis'] + end + if attributes.key?(:'yaxis') self.yaxis = attributes[:'yaxis'] end @@ -227,6 +247,7 @@ def ==(o) custom_links == o.custom_links && events == o.events && legend_size == o.legend_size && + markers == o.markers && requests == o.requests && show_legend == o.show_legend && time == o.time && @@ -234,6 +255,7 @@ def ==(o) title_align == o.title_align && title_size == o.title_size && type == o.type && + xaxis == o.xaxis && yaxis == o.yaxis && additional_properties == o.additional_properties end @@ -242,7 +264,7 @@ def ==(o) # @return [Integer] Hash code # @!visibility private def hash - [custom_links, events, legend_size, requests, show_legend, time, title, title_align, title_size, type, yaxis, additional_properties].hash + [custom_links, events, legend_size, markers, requests, show_legend, time, title, title_align, title_size, type, xaxis, yaxis, additional_properties].hash end end end diff --git a/lib/datadog_api_client/v1/models/heat_map_widget_request.rb b/lib/datadog_api_client/v1/models/heat_map_widget_request.rb index 3c1dc4a18c00..886df0b6c958 100644 --- a/lib/datadog_api_client/v1/models/heat_map_widget_request.rb +++ b/lib/datadog_api_client/v1/models/heat_map_widget_request.rb @@ -48,6 +48,12 @@ class HeatMapWidgetRequest # List of queries that can be returned directly or used in formulas. attr_accessor :queries + # A formula and functions metrics query. + attr_accessor :query + + # Request type for the histogram request. + attr_accessor :request_type + # Timeseries, scalar, or event list response. Event list response formats are supported by Geomap widgets. attr_accessor :response_format @@ -75,6 +81,8 @@ def self.attribute_map :'profile_metrics_query' => :'profile_metrics_query', :'q' => :'q', :'queries' => :'queries', + :'query' => :'query', + :'request_type' => :'request_type', :'response_format' => :'response_format', :'rum_query' => :'rum_query', :'security_query' => :'security_query', @@ -95,6 +103,8 @@ def self.openapi_types :'profile_metrics_query' => :'LogQueryDefinition', :'q' => :'String', :'queries' => :'Array', + :'query' => :'FormulaAndFunctionMetricQueryDefinition', + :'request_type' => :'WidgetHistogramRequestType', :'response_format' => :'FormulaAndFunctionResponseFormat', :'rum_query' => :'LogQueryDefinition', :'security_query' => :'LogQueryDefinition', @@ -160,6 +170,14 @@ def initialize(attributes = {}) end end + if attributes.key?(:'query') + self.query = attributes[:'query'] + end + + if attributes.key?(:'request_type') + self.request_type = attributes[:'request_type'] + end + if attributes.key?(:'response_format') self.response_format = attributes[:'response_format'] end @@ -212,6 +230,8 @@ def ==(o) profile_metrics_query == o.profile_metrics_query && q == o.q && queries == o.queries && + query == o.query && + request_type == o.request_type && response_format == o.response_format && rum_query == o.rum_query && security_query == o.security_query && @@ -223,7 +243,7 @@ def ==(o) # @return [Integer] Hash code # @!visibility private def hash - [apm_query, event_query, formulas, log_query, network_query, process_query, profile_metrics_query, q, queries, response_format, rum_query, security_query, style, additional_properties].hash + [apm_query, event_query, formulas, log_query, network_query, process_query, profile_metrics_query, q, queries, query, request_type, response_format, rum_query, security_query, style, additional_properties].hash end end end diff --git a/lib/datadog_api_client/v1/models/heat_map_widget_x_axis.rb b/lib/datadog_api_client/v1/models/heat_map_widget_x_axis.rb new file mode 100644 index 000000000000..766d953109d4 --- /dev/null +++ b/lib/datadog_api_client/v1/models/heat_map_widget_x_axis.rb @@ -0,0 +1,125 @@ +=begin +#Datadog API V1 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::V1 + # X Axis controls for the heat map widget. + class HeatMapWidgetXAxis + include BaseGenericModel + + # Number of time buckets to target, also known as the resolution + # of the time bins. This is only applicable for distribution of + # points (group distributions use the roll-up modifier). + attr_reader :num_buckets + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'num_buckets' => :'num_buckets' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'num_buckets' => :'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::V1::HeatMapWidgetXAxis` 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?(:'num_buckets') + self.num_buckets = attributes[:'num_buckets'] + 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 !@num_buckets.nil? && @num_buckets < 1 + true + end + + # Custom attribute writer method with validation + # @param num_buckets [Object] Object to be assigned + # @!visibility private + def num_buckets=(num_buckets) + if !num_buckets.nil? && num_buckets < 1 + fail ArgumentError, 'invalid value for "num_buckets", must be greater than or equal to 1.' + end + @num_buckets = num_buckets + 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 && + num_buckets == o.num_buckets && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [num_buckets, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v1/models/distribution_widget_histogram_request_type.rb b/lib/datadog_api_client/v1/models/widget_histogram_request_type.rb similarity index 93% rename from lib/datadog_api_client/v1/models/distribution_widget_histogram_request_type.rb rename to lib/datadog_api_client/v1/models/widget_histogram_request_type.rb index 836acaf9c11d..a8b45a848a04 100644 --- a/lib/datadog_api_client/v1/models/distribution_widget_histogram_request_type.rb +++ b/lib/datadog_api_client/v1/models/widget_histogram_request_type.rb @@ -18,7 +18,7 @@ module DatadogAPIClient::V1 # Request type for the histogram request. - class DistributionWidgetHistogramRequestType + class WidgetHistogramRequestType include BaseEnumModel HISTOGRAM = "histogram".freeze diff --git a/lib/datadog_api_client/v1/models/widget_marker.rb b/lib/datadog_api_client/v1/models/widget_marker.rb index 457941b0d6ad..b66b97959aed 100644 --- a/lib/datadog_api_client/v1/models/widget_marker.rb +++ b/lib/datadog_api_client/v1/models/widget_marker.rb @@ -24,7 +24,7 @@ class WidgetMarker # Combination of: # - A severity error, warning, ok, or info # - A line type: dashed, solid, or bold - # In this case of a Distribution widget, this can be set to be `x_axis_percentile`. + # In this case of a Distribution widget, this can be set to be `percentile`. attr_accessor :display_type # Label to display over the marker. @@ -34,6 +34,8 @@ class WidgetMarker attr_accessor :time # Value to apply. Can be a single value y = 15 or a range of values 0 < y < 10. + # For Distribution widgets with `display_type` set to `percentile`, this should be + # a numeric percentile value (for example, "90" for P90). attr_reader :value attr_accessor :additional_properties diff --git a/lib/datadog_api_client/v2/api/spa_api.rb b/lib/datadog_api_client/v2/api/spa_api.rb index bfd9f0095fb0..62694b1ef38d 100644 --- a/lib/datadog_api_client/v2/api/spa_api.rb +++ b/lib/datadog_api_client/v2/api/spa_api.rb @@ -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") @@ -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] || {} @@ -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, @@ -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 diff --git a/lib/datadog_api_client/v2/models/recommendation_attributes.rb b/lib/datadog_api_client/v2/models/recommendation_attributes.rb index 2dce7efcf694..6c6945857b6f 100644 --- a/lib/datadog_api_client/v2/models/recommendation_attributes.rb +++ b/lib/datadog_api_client/v2/models/recommendation_attributes.rb @@ -21,6 +21,9 @@ module DatadogAPIClient::V2 class RecommendationAttributes include BaseGenericModel + # + attr_accessor :confidence_level + # Resource recommendation for a single Spark component (driver or executor). Contains estimation data used to patch Spark job specs. attr_reader :driver @@ -33,6 +36,7 @@ class RecommendationAttributes # @!visibility private def self.attribute_map { + :'confidence_level' => :'confidence_level', :'driver' => :'driver', :'executor' => :'executor' } @@ -42,6 +46,7 @@ def self.attribute_map # @!visibility private def self.openapi_types { + :'confidence_level' => :'Float', :'driver' => :'ComponentRecommendation', :'executor' => :'ComponentRecommendation' } @@ -65,6 +70,10 @@ def initialize(attributes = {}) end } + if attributes.key?(:'confidence_level') + self.confidence_level = attributes[:'confidence_level'] + end + if attributes.key?(:'driver') self.driver = attributes[:'driver'] end @@ -129,6 +138,7 @@ def to_hash def ==(o) return true if self.equal?(o) self.class == o.class && + confidence_level == o.confidence_level && driver == o.driver && executor == o.executor && additional_properties == o.additional_properties @@ -138,7 +148,7 @@ def ==(o) # @return [Integer] Hash code # @!visibility private def hash - [driver, executor, additional_properties].hash + [confidence_level, driver, executor, additional_properties].hash end end end