From 63f18d2e5ef4316563674c44123117ee15ebc43d Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Thu, 18 Dec 2025 09:46:36 +0000 Subject: [PATCH] Regenerate client from commit 360779b of spec repo --- .generator/schemas/v1/openapi.yaml | 51 ++++++++- ...widget-with-markers-and-num-buckets.frozen | 1 + ...on-widget-with-markers-and-num-buckets.yml | 45 ++++++++ ...la-and-function-distribution-widget.frozen | 1 + ...rmula-and-function-distribution-widget.yml | 43 +++++++ ...widget-with-markers-and-num-buckets.frozen | 1 + ...ap-widget-with-markers-and-num-buckets.yml | 43 +++++++ .../dashboards/CreateDashboard_1093147852.rb | 66 +++++++++++ .../dashboards/CreateDashboard_1617893815.rb | 61 ++++++++++ .../dashboards/CreateDashboard_2823363212.rb | 55 +++++++++ features/v1/dashboards.feature | 32 ++++++ lib/datadog_api_client/inflector.rb | 1 + .../v1/models/distribution_widget_request.rb | 36 +++++- .../v1/models/distribution_widget_x_axis.rb | 12 +- .../v1/models/heat_map_widget_definition.rb | 24 +++- .../v1/models/heat_map_widget_request.rb | 22 +++- .../v1/models/heat_map_widget_x_axis.rb | 105 ++++++++++++++++++ .../v1/models/widget_marker.rb | 3 +- 18 files changed, 595 insertions(+), 7 deletions(-) create mode 100644 cassettes/features/v1/dashboards/Create-a-new-dashboard-with-distribution-widget-with-markers-and-num-buckets.frozen create mode 100644 cassettes/features/v1/dashboards/Create-a-new-dashboard-with-distribution-widget-with-markers-and-num-buckets.yml create mode 100644 cassettes/features/v1/dashboards/Create-a-new-dashboard-with-formula-and-function-distribution-widget.frozen create mode 100644 cassettes/features/v1/dashboards/Create-a-new-dashboard-with-formula-and-function-distribution-widget.yml create mode 100644 cassettes/features/v1/dashboards/Create-a-new-dashboard-with-heatmap-widget-with-markers-and-num-buckets.frozen create mode 100644 cassettes/features/v1/dashboards/Create-a-new-dashboard-with-heatmap-widget-with-markers-and-num-buckets.yml create mode 100644 examples/v1/dashboards/CreateDashboard_1093147852.rb create mode 100644 examples/v1/dashboards/CreateDashboard_1617893815.rb create mode 100644 examples/v1/dashboards/CreateDashboard_2823363212.rb create mode 100644 lib/datadog_api_client/v1/models/heat_map_widget_x_axis.rb diff --git a/.generator/schemas/v1/openapi.yaml b/.generator/schemas/v1/openapi.yaml index d9bb88a10f2..590559216b1 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 @@ -1816,6 +1819,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 +1835,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' + response_format: + $ref: '#/components/schemas/FormulaAndFunctionResponseFormat' rum_query: $ref: '#/components/schemas/LogQueryDefinition' security_query: @@ -1854,6 +1869,11 @@ 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 + type: integer scale: default: linear description: Specifies the scale type. Possible values are `linear`. @@ -3752,6 +3772,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 +3804,8 @@ components: type: string type: $ref: '#/components/schemas/HeatMapWidgetDefinitionType' + xaxis: + $ref: '#/components/schemas/HeatMapWidgetXAxis' yaxis: $ref: '#/components/schemas/WidgetAxis' required: @@ -3819,6 +3849,10 @@ components: items: $ref: '#/components/schemas/FormulaAndFunctionQueryDefinition' type: array + query: + $ref: '#/components/schemas/FormulaAndFunctionMetricQueryDefinition' + request_type: + $ref: '#/components/schemas/DistributionWidgetHistogramRequestType' response_format: $ref: '#/components/schemas/FormulaAndFunctionResponseFormat' rum_query: @@ -3828,6 +3862,16 @@ 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 + type: integer + type: object Host: description: Object representing a host. properties: @@ -25245,7 +25289,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: @@ -25256,8 +25300,11 @@ 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/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 00000000000..957e38ac24a --- /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 00000000000..5bfe76c5deb --- /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 00000000000..028130f6b8a --- /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 00000000000..476c762f504 --- /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 00000000000..502143efd66 --- /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 00000000000..64a28290891 --- /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 00000000000..962c2c80613 --- /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_1617893815.rb b/examples/v1/dashboards/CreateDashboard_1617893815.rb new file mode 100644 index 00000000000..7f8a4b5ad93 --- /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_2823363212.rb b/examples/v1/dashboards/CreateDashboard_2823363212.rb new file mode 100644 index 00000000000..d74bb02ba85 --- /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::DistributionWidgetHistogramRequestType::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/features/v1/dashboards.feature b/features/v1/dashboards.feature index 588c609cedd..076546114f1 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/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index 3e6e421122a..e75d9934bab 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -170,6 +170,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", 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 2119406a3e9..6df67ef5a91 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', + :'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 b7ca7472c7f..0d21f5fef82 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_accessor :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,6 +92,10 @@ 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 @@ -121,6 +130,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 +139,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 b53097ae552..f50545502b1 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 3c1dc4a18c0..349a396d1b6 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' => :'DistributionWidgetHistogramRequestType', :'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 00000000000..c8013b74035 --- /dev/null +++ b/lib/datadog_api_client/v1/models/heat_map_widget_x_axis.rb @@ -0,0 +1,105 @@ +=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_accessor :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 + + # 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/widget_marker.rb b/lib/datadog_api_client/v1/models/widget_marker.rb index 457941b0d6a..0e73c38368a 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,7 @@ 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