diff --git a/.generator/schemas/v1/openapi.yaml b/.generator/schemas/v1/openapi.yaml index d9bb88a10..7d3eaefcd 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,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 +3764,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 +3796,8 @@ components: type: string type: $ref: '#/components/schemas/HeatMapWidgetDefinitionType' + xaxis: + $ref: '#/components/schemas/HeatMapWidgetXAxis' yaxis: $ref: '#/components/schemas/WidgetAxis' required: @@ -3819,6 +3841,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 +3854,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: @@ -25041,6 +25077,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: @@ -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/examples/v1_dashboards_CreateDashboard_1093147852.rs b/examples/v1_dashboards_CreateDashboard_1093147852.rs new file mode 100644 index 000000000..72cb9f988 --- /dev/null +++ b/examples/v1_dashboards_CreateDashboard_1093147852.rs @@ -0,0 +1,91 @@ +// Create a new dashboard with distribution widget with markers and num_buckets +use datadog_api_client::datadog; +use datadog_api_client::datadogV1::api_dashboards::DashboardsAPI; +use datadog_api_client::datadogV1::model::Dashboard; +use datadog_api_client::datadogV1::model::DashboardLayoutType; +use datadog_api_client::datadogV1::model::DistributionWidgetDefinition; +use datadog_api_client::datadogV1::model::DistributionWidgetDefinitionType; +use datadog_api_client::datadogV1::model::DistributionWidgetRequest; +use datadog_api_client::datadogV1::model::DistributionWidgetXAxis; +use datadog_api_client::datadogV1::model::DistributionWidgetYAxis; +use datadog_api_client::datadogV1::model::FormulaAndFunctionMetricAggregation; +use datadog_api_client::datadogV1::model::FormulaAndFunctionMetricDataSource; +use datadog_api_client::datadogV1::model::FormulaAndFunctionMetricQueryDefinition; +use datadog_api_client::datadogV1::model::FormulaAndFunctionQueryDefinition; +use datadog_api_client::datadogV1::model::FormulaAndFunctionResponseFormat; +use datadog_api_client::datadogV1::model::Widget; +use datadog_api_client::datadogV1::model::WidgetDefinition; +use datadog_api_client::datadogV1::model::WidgetLayout; +use datadog_api_client::datadogV1::model::WidgetMarker; +use datadog_api_client::datadogV1::model::WidgetTextAlign; + +#[tokio::main] +async fn main() { + let body = + Dashboard::new( + DashboardLayoutType::ORDERED, + "Example-Dashboard".to_string(), + vec![ + Widget::new( + WidgetDefinition::DistributionWidgetDefinition( + Box::new( + DistributionWidgetDefinition::new( + vec![ + DistributionWidgetRequest::new() + .queries( + vec![ + FormulaAndFunctionQueryDefinition + ::FormulaAndFunctionMetricQueryDefinition( + Box::new( + FormulaAndFunctionMetricQueryDefinition::new( + FormulaAndFunctionMetricDataSource::METRICS, + "query1".to_string(), + "avg:system.cpu.user{*} by {service}".to_string(), + ).aggregator(FormulaAndFunctionMetricAggregation::AVG), + ), + ) + ], + ) + .response_format(FormulaAndFunctionResponseFormat::SCALAR) + ], + DistributionWidgetDefinitionType::DISTRIBUTION, + ) + .markers( + vec![ + WidgetMarker::new("50".to_string()).display_type("percentile".to_string()), + WidgetMarker::new("99".to_string()).display_type("percentile".to_string()), + WidgetMarker::new("90".to_string()).display_type("percentile".to_string()) + ], + ) + .title("".to_string()) + .title_align(WidgetTextAlign::LEFT) + .title_size("16".to_string()) + .xaxis( + DistributionWidgetXAxis::new() + .include_zero(true) + .max("auto".to_string()) + .min("auto".to_string()) + .num_buckets(55) + .scale("linear".to_string()), + ) + .yaxis( + DistributionWidgetYAxis::new() + .include_zero(true) + .max("auto".to_string()) + .min("auto".to_string()) + .scale("linear".to_string()), + ), + ), + ), + ).layout(WidgetLayout::new(4, 4, 0, 0)) + ], + ); + let configuration = datadog::Configuration::new(); + let api = DashboardsAPI::with_config(configuration); + let resp = api.create_dashboard(body).await; + if let Ok(value) = resp { + println!("{:#?}", value); + } else { + println!("{:#?}", resp.unwrap_err()); + } +} diff --git a/examples/v1_dashboards_CreateDashboard_1442588603.rs b/examples/v1_dashboards_CreateDashboard_1442588603.rs index c1a719b07..b95a9e9ee 100644 --- a/examples/v1_dashboards_CreateDashboard_1442588603.rs +++ b/examples/v1_dashboards_CreateDashboard_1442588603.rs @@ -7,7 +7,6 @@ use datadog_api_client::datadogV1::model::DashboardLayoutType; use datadog_api_client::datadogV1::model::DistributionWidgetDefinition; use datadog_api_client::datadogV1::model::DistributionWidgetDefinitionType; use datadog_api_client::datadogV1::model::DistributionWidgetHistogramRequestQuery; -use datadog_api_client::datadogV1::model::DistributionWidgetHistogramRequestType; use datadog_api_client::datadogV1::model::DistributionWidgetRequest; use datadog_api_client::datadogV1::model::DistributionWidgetXAxis; use datadog_api_client::datadogV1::model::DistributionWidgetYAxis; @@ -16,6 +15,7 @@ use datadog_api_client::datadogV1::model::FormulaAndFunctionApmResourceStatsData use datadog_api_client::datadogV1::model::FormulaAndFunctionApmResourceStatsQueryDefinition; use datadog_api_client::datadogV1::model::Widget; use datadog_api_client::datadogV1::model::WidgetDefinition; +use datadog_api_client::datadogV1::model::WidgetHistogramRequestType; use datadog_api_client::datadogV1::model::WidgetLayout; use datadog_api_client::datadogV1::model::WidgetStyle; use datadog_api_client::datadogV1::model::WidgetTextAlign; @@ -52,7 +52,7 @@ async fn main() { ), ), ) - .request_type(DistributionWidgetHistogramRequestType::HISTOGRAM) + .request_type(WidgetHistogramRequestType::HISTOGRAM) .style(WidgetStyle::new().palette("dog_classic".to_string())) ], DistributionWidgetDefinitionType::DISTRIBUTION, diff --git a/examples/v1_dashboards_CreateDashboard_1617893815.rs b/examples/v1_dashboards_CreateDashboard_1617893815.rs new file mode 100644 index 000000000..cb0cda329 --- /dev/null +++ b/examples/v1_dashboards_CreateDashboard_1617893815.rs @@ -0,0 +1,100 @@ +// Create a new dashboard with formula and function distribution widget +use datadog_api_client::datadog; +use datadog_api_client::datadogV1::api_dashboards::DashboardsAPI; +use datadog_api_client::datadogV1::model::Dashboard; +use datadog_api_client::datadogV1::model::DashboardLayoutType; +use datadog_api_client::datadogV1::model::DistributionWidgetDefinition; +use datadog_api_client::datadogV1::model::DistributionWidgetDefinitionType; +use datadog_api_client::datadogV1::model::DistributionWidgetRequest; +use datadog_api_client::datadogV1::model::FormulaAndFunctionEventAggregation; +use datadog_api_client::datadogV1::model::FormulaAndFunctionEventQueryDefinition; +use datadog_api_client::datadogV1::model::FormulaAndFunctionEventQueryDefinitionCompute; +use datadog_api_client::datadogV1::model::FormulaAndFunctionEventQueryDefinitionSearch; +use datadog_api_client::datadogV1::model::FormulaAndFunctionEventQueryGroupBy; +use datadog_api_client::datadogV1::model::FormulaAndFunctionEventQueryGroupBySort; +use datadog_api_client::datadogV1::model::FormulaAndFunctionEventsDataSource; +use datadog_api_client::datadogV1::model::FormulaAndFunctionQueryDefinition; +use datadog_api_client::datadogV1::model::FormulaAndFunctionResponseFormat; +use datadog_api_client::datadogV1::model::QuerySortOrder; +use datadog_api_client::datadogV1::model::Widget; +use datadog_api_client::datadogV1::model::WidgetDefinition; +use datadog_api_client::datadogV1::model::WidgetLayout; +use datadog_api_client::datadogV1::model::WidgetLegacyLiveSpan; +use datadog_api_client::datadogV1::model::WidgetTextAlign; +use datadog_api_client::datadogV1::model::WidgetTime; + +#[tokio::main] +async fn main() { + let body = + Dashboard::new( + DashboardLayoutType::FREE, + "Example-Dashboard".to_string(), + vec![ + Widget::new( + WidgetDefinition::DistributionWidgetDefinition( + Box::new( + DistributionWidgetDefinition::new( + vec![ + DistributionWidgetRequest::new() + .queries( + vec![ + FormulaAndFunctionQueryDefinition + ::FormulaAndFunctionEventQueryDefinition( + Box::new( + FormulaAndFunctionEventQueryDefinition::new( + FormulaAndFunctionEventQueryDefinitionCompute::new( + FormulaAndFunctionEventAggregation::AVG, + ).metric("@duration".to_string()), + FormulaAndFunctionEventsDataSource::LOGS, + "query1".to_string(), + ) + .group_by( + vec![ + FormulaAndFunctionEventQueryGroupBy::new( + "service".to_string(), + ) + .limit(1000) + .sort( + FormulaAndFunctionEventQueryGroupBySort + ::new( + FormulaAndFunctionEventAggregation + ::COUNT, + ).order(QuerySortOrder::DESC), + ) + ], + ) + .indexes(vec!["*".to_string()]) + .search( + FormulaAndFunctionEventQueryDefinitionSearch::new( + "".to_string(), + ), + ) + .storage("hot".to_string()), + ), + ) + ], + ) + .response_format(FormulaAndFunctionResponseFormat::SCALAR) + ], + DistributionWidgetDefinitionType::DISTRIBUTION, + ) + .time(WidgetTime::WidgetLegacyLiveSpan(Box::new(WidgetLegacyLiveSpan::new()))) + .title("".to_string()) + .title_align(WidgetTextAlign::LEFT) + .title_size("16".to_string()), + ), + ), + ).layout(WidgetLayout::new(15, 47, 0, 0)) + ], + ) + .notify_list(Some(vec![])) + .template_variables(Some(vec![])); + let configuration = datadog::Configuration::new(); + let api = DashboardsAPI::with_config(configuration); + let resp = api.create_dashboard(body).await; + if let Ok(value) = resp { + println!("{:#?}", value); + } else { + println!("{:#?}", resp.unwrap_err()); + } +} diff --git a/examples/v1_dashboards_CreateDashboard_252716965.rs b/examples/v1_dashboards_CreateDashboard_252716965.rs index c88320b02..897eeb057 100644 --- a/examples/v1_dashboards_CreateDashboard_252716965.rs +++ b/examples/v1_dashboards_CreateDashboard_252716965.rs @@ -7,7 +7,6 @@ use datadog_api_client::datadogV1::model::DashboardLayoutType; use datadog_api_client::datadogV1::model::DistributionWidgetDefinition; use datadog_api_client::datadogV1::model::DistributionWidgetDefinitionType; use datadog_api_client::datadogV1::model::DistributionWidgetHistogramRequestQuery; -use datadog_api_client::datadogV1::model::DistributionWidgetHistogramRequestType; use datadog_api_client::datadogV1::model::DistributionWidgetRequest; use datadog_api_client::datadogV1::model::DistributionWidgetXAxis; use datadog_api_client::datadogV1::model::DistributionWidgetYAxis; @@ -16,6 +15,7 @@ use datadog_api_client::datadogV1::model::FormulaAndFunctionMetricQueryDefinitio use datadog_api_client::datadogV1::model::Widget; use datadog_api_client::datadogV1::model::WidgetCustomLink; use datadog_api_client::datadogV1::model::WidgetDefinition; +use datadog_api_client::datadogV1::model::WidgetHistogramRequestType; use datadog_api_client::datadogV1::model::WidgetLayout; use datadog_api_client::datadogV1::model::WidgetStyle; use datadog_api_client::datadogV1::model::WidgetTextAlign; @@ -45,7 +45,7 @@ async fn main() { ), ), ) - .request_type(DistributionWidgetHistogramRequestType::HISTOGRAM) + .request_type(WidgetHistogramRequestType::HISTOGRAM) .style(WidgetStyle::new().palette("dog_classic".to_string())) ], DistributionWidgetDefinitionType::DISTRIBUTION, diff --git a/examples/v1_dashboards_CreateDashboard_2823363212.rs b/examples/v1_dashboards_CreateDashboard_2823363212.rs new file mode 100644 index 000000000..ef2f51e51 --- /dev/null +++ b/examples/v1_dashboards_CreateDashboard_2823363212.rs @@ -0,0 +1,64 @@ +// Create a new dashboard with heatmap widget with markers and num_buckets +use datadog_api_client::datadog; +use datadog_api_client::datadogV1::api_dashboards::DashboardsAPI; +use datadog_api_client::datadogV1::model::Dashboard; +use datadog_api_client::datadogV1::model::DashboardLayoutType; +use datadog_api_client::datadogV1::model::FormulaAndFunctionMetricDataSource; +use datadog_api_client::datadogV1::model::FormulaAndFunctionMetricQueryDefinition; +use datadog_api_client::datadogV1::model::HeatMapWidgetDefinition; +use datadog_api_client::datadogV1::model::HeatMapWidgetDefinitionType; +use datadog_api_client::datadogV1::model::HeatMapWidgetRequest; +use datadog_api_client::datadogV1::model::HeatMapWidgetXAxis; +use datadog_api_client::datadogV1::model::Widget; +use datadog_api_client::datadogV1::model::WidgetAxis; +use datadog_api_client::datadogV1::model::WidgetDefinition; +use datadog_api_client::datadogV1::model::WidgetHistogramRequestType; +use datadog_api_client::datadogV1::model::WidgetLayout; +use datadog_api_client::datadogV1::model::WidgetMarker; +use datadog_api_client::datadogV1::model::WidgetTextAlign; + +#[tokio::main] +async fn main() { + let body = Dashboard::new( + DashboardLayoutType::ORDERED, + "Example-Dashboard".to_string(), + vec![ + Widget::new(WidgetDefinition::HeatMapWidgetDefinition(Box::new( + HeatMapWidgetDefinition::new( + vec![HeatMapWidgetRequest::new() + .query(FormulaAndFunctionMetricQueryDefinition::new( + FormulaAndFunctionMetricDataSource::METRICS, + "query1".to_string(), + "histogram:trace.servlet.request{*}".to_string(), + )) + .request_type(WidgetHistogramRequestType::HISTOGRAM)], + HeatMapWidgetDefinitionType::HEATMAP, + ) + .markers(vec![ + WidgetMarker::new("50".to_string()).display_type("percentile".to_string()), + WidgetMarker::new("99".to_string()).display_type("percentile".to_string()), + ]) + .title("".to_string()) + .title_align(WidgetTextAlign::LEFT) + .title_size("16".to_string()) + .xaxis(HeatMapWidgetXAxis::new().num_buckets(75)) + .yaxis( + WidgetAxis::new() + .include_zero(true) + .max("auto".to_string()) + .min("auto".to_string()) + .scale("linear".to_string()), + ), + ))) + .layout(WidgetLayout::new(4, 4, 0, 0)), + ], + ); + let configuration = datadog::Configuration::new(); + let api = DashboardsAPI::with_config(configuration); + let resp = api.create_dashboard(body).await; + if let Ok(value) = resp { + println!("{:#?}", value); + } else { + println!("{:#?}", resp.unwrap_err()); + } +} diff --git a/examples/v1_dashboards_CreateDashboard_3882428227.rs b/examples/v1_dashboards_CreateDashboard_3882428227.rs index 4ebc0fb55..d68ab20ad 100644 --- a/examples/v1_dashboards_CreateDashboard_3882428227.rs +++ b/examples/v1_dashboards_CreateDashboard_3882428227.rs @@ -7,7 +7,6 @@ use datadog_api_client::datadogV1::model::DashboardLayoutType; use datadog_api_client::datadogV1::model::DistributionWidgetDefinition; use datadog_api_client::datadogV1::model::DistributionWidgetDefinitionType; use datadog_api_client::datadogV1::model::DistributionWidgetHistogramRequestQuery; -use datadog_api_client::datadogV1::model::DistributionWidgetHistogramRequestType; use datadog_api_client::datadogV1::model::DistributionWidgetRequest; use datadog_api_client::datadogV1::model::DistributionWidgetXAxis; use datadog_api_client::datadogV1::model::DistributionWidgetYAxis; @@ -18,6 +17,7 @@ use datadog_api_client::datadogV1::model::FormulaAndFunctionEventQueryDefinition use datadog_api_client::datadogV1::model::FormulaAndFunctionEventsDataSource; use datadog_api_client::datadogV1::model::Widget; use datadog_api_client::datadogV1::model::WidgetDefinition; +use datadog_api_client::datadogV1::model::WidgetHistogramRequestType; use datadog_api_client::datadogV1::model::WidgetLayout; use datadog_api_client::datadogV1::model::WidgetTextAlign; @@ -55,7 +55,7 @@ async fn main() { ), ), ) - .request_type(DistributionWidgetHistogramRequestType::HISTOGRAM) + .request_type(WidgetHistogramRequestType::HISTOGRAM) ], DistributionWidgetDefinitionType::DISTRIBUTION, ) diff --git a/src/datadogV1/model/mod.rs b/src/datadogV1/model/mod.rs index 8fd073565..97987b5df 100644 --- a/src/datadogV1/model/mod.rs +++ b/src/datadogV1/model/mod.rs @@ -268,8 +268,8 @@ pub mod model_apm_stats_query_row_type; pub use self::model_apm_stats_query_row_type::ApmStatsQueryRowType; pub mod model_distribution_widget_histogram_request_query; pub use self::model_distribution_widget_histogram_request_query::DistributionWidgetHistogramRequestQuery; -pub mod model_distribution_widget_histogram_request_type; -pub use self::model_distribution_widget_histogram_request_type::DistributionWidgetHistogramRequestType; +pub mod model_widget_histogram_request_type; +pub use self::model_widget_histogram_request_type::WidgetHistogramRequestType; pub mod model_widget_style; pub use self::model_widget_style::WidgetStyle; pub mod model_distribution_widget_definition_type; @@ -380,6 +380,8 @@ pub mod model_event_query_definition; pub use self::model_event_query_definition::EventQueryDefinition; pub mod model_heat_map_widget_definition_type; pub use self::model_heat_map_widget_definition_type::HeatMapWidgetDefinitionType; +pub mod model_heat_map_widget_x_axis; +pub use self::model_heat_map_widget_x_axis::HeatMapWidgetXAxis; pub mod model_widget_axis; pub use self::model_widget_axis::WidgetAxis; pub mod model_host_map_widget_definition; diff --git a/src/datadogV1/model/model_distribution_widget_request.rs b/src/datadogV1/model/model_distribution_widget_request.rs index 18901911e..71fc1c8a2 100644 --- a/src/datadogV1/model/model_distribution_widget_request.rs +++ b/src/datadogV1/model/model_distribution_widget_request.rs @@ -20,6 +20,9 @@ pub struct DistributionWidgetRequest { /// The log query. #[serde(rename = "event_query")] pub event_query: Option, + /// List of formulas that operate on queries. + #[serde(rename = "formulas")] + pub formulas: Option>, /// The log query. #[serde(rename = "log_query")] pub log_query: Option, @@ -35,12 +38,18 @@ pub struct DistributionWidgetRequest { /// Widget query. #[serde(rename = "q")] pub q: Option, + /// List of queries that can be returned directly or used in formulas. + #[serde(rename = "queries")] + pub queries: Option>, /// Query definition for Distribution Widget Histogram Request #[serde(rename = "query")] pub query: Option, /// Request type for the histogram request. #[serde(rename = "request_type")] - pub request_type: Option, + pub request_type: Option, + /// Timeseries, scalar, or event list response. Event list response formats are supported by Geomap widgets. + #[serde(rename = "response_format")] + pub response_format: Option, /// The log query. #[serde(rename = "rum_query")] pub rum_query: Option, @@ -63,13 +72,16 @@ impl DistributionWidgetRequest { apm_query: None, apm_stats_query: None, event_query: None, + formulas: None, log_query: None, network_query: None, process_query: None, profile_metrics_query: None, q: None, + queries: None, query: None, request_type: None, + response_format: None, rum_query: None, security_query: None, style: None, @@ -96,6 +108,11 @@ impl DistributionWidgetRequest { self } + pub fn formulas(mut self, value: Vec) -> Self { + self.formulas = Some(value); + self + } + pub fn log_query(mut self, value: crate::datadogV1::model::LogQueryDefinition) -> Self { self.log_query = Some(value); self @@ -124,6 +141,14 @@ impl DistributionWidgetRequest { self } + pub fn queries( + mut self, + value: Vec, + ) -> Self { + self.queries = Some(value); + self + } + pub fn query( mut self, value: crate::datadogV1::model::DistributionWidgetHistogramRequestQuery, @@ -134,12 +159,20 @@ impl DistributionWidgetRequest { pub fn request_type( mut self, - value: crate::datadogV1::model::DistributionWidgetHistogramRequestType, + value: crate::datadogV1::model::WidgetHistogramRequestType, ) -> Self { self.request_type = Some(value); self } + pub fn response_format( + mut self, + value: crate::datadogV1::model::FormulaAndFunctionResponseFormat, + ) -> Self { + self.response_format = Some(value); + self + } + pub fn rum_query(mut self, value: crate::datadogV1::model::LogQueryDefinition) -> Self { self.rum_query = Some(value); self @@ -191,6 +224,7 @@ impl<'de> Deserialize<'de> for DistributionWidgetRequest { let mut apm_stats_query: Option = None; let mut event_query: Option = None; + let mut formulas: Option> = None; let mut log_query: Option = None; let mut network_query: Option = None; let mut process_query: Option = @@ -198,11 +232,16 @@ impl<'de> Deserialize<'de> for DistributionWidgetRequest { let mut profile_metrics_query: Option = None; let mut q: Option = None; + let mut queries: Option< + Vec, + > = None; let mut query: Option< crate::datadogV1::model::DistributionWidgetHistogramRequestQuery, > = None; - let mut request_type: Option< - crate::datadogV1::model::DistributionWidgetHistogramRequestType, + let mut request_type: Option = + None; + let mut response_format: Option< + crate::datadogV1::model::FormulaAndFunctionResponseFormat, > = None; let mut rum_query: Option = None; let mut security_query: Option = None; @@ -235,6 +274,12 @@ impl<'de> Deserialize<'de> for DistributionWidgetRequest { event_query = Some(serde_json::from_value(v).map_err(M::Error::custom)?); } + "formulas" => { + if v.is_null() { + continue; + } + formulas = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } "log_query" => { if v.is_null() { continue; @@ -268,6 +313,12 @@ impl<'de> Deserialize<'de> for DistributionWidgetRequest { } q = Some(serde_json::from_value(v).map_err(M::Error::custom)?); } + "queries" => { + if v.is_null() { + continue; + } + queries = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } "query" => { if v.is_null() { continue; @@ -290,7 +341,22 @@ impl<'de> Deserialize<'de> for DistributionWidgetRequest { Some(serde_json::from_value(v).map_err(M::Error::custom)?); if let Some(ref _request_type) = request_type { match _request_type { - crate::datadogV1::model::DistributionWidgetHistogramRequestType::UnparsedObject(_request_type) => { + crate::datadogV1::model::WidgetHistogramRequestType::UnparsedObject(_request_type) => { + _unparsed = true; + }, + _ => {} + } + } + } + "response_format" => { + if v.is_null() { + continue; + } + response_format = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _response_format) = response_format { + match _response_format { + crate::datadogV1::model::FormulaAndFunctionResponseFormat::UnparsedObject(_response_format) => { _unparsed = true; }, _ => {} @@ -328,13 +394,16 @@ impl<'de> Deserialize<'de> for DistributionWidgetRequest { 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, diff --git a/src/datadogV1/model/model_distribution_widget_x_axis.rs b/src/datadogV1/model/model_distribution_widget_x_axis.rs index 32c982d87..6023d1705 100644 --- a/src/datadogV1/model/model_distribution_widget_x_axis.rs +++ b/src/datadogV1/model/model_distribution_widget_x_axis.rs @@ -20,6 +20,9 @@ pub struct DistributionWidgetXAxis { /// Specifies minimum value to show on the x-axis. It takes a number, percentile (p90 === 90th percentile), or auto for default behavior. #[serde(rename = "min")] pub min: Option, + /// Number of value buckets to target, also known as the resolution of the value bins. + #[serde(rename = "num_buckets")] + pub num_buckets: Option, /// Specifies the scale type. Possible values are `linear`. #[serde(rename = "scale")] pub scale: Option, @@ -36,6 +39,7 @@ impl DistributionWidgetXAxis { include_zero: None, max: None, min: None, + num_buckets: None, scale: None, additional_properties: std::collections::BTreeMap::new(), _unparsed: false, @@ -57,6 +61,11 @@ impl DistributionWidgetXAxis { self } + pub fn num_buckets(mut self, value: i64) -> Self { + self.num_buckets = Some(value); + self + } + pub fn scale(mut self, value: String) -> Self { self.scale = Some(value); self @@ -97,6 +106,7 @@ impl<'de> Deserialize<'de> for DistributionWidgetXAxis { let mut include_zero: Option = None; let mut max: Option = None; let mut min: Option = None; + let mut num_buckets: Option = None; let mut scale: Option = None; let mut additional_properties: std::collections::BTreeMap< String, @@ -125,6 +135,13 @@ impl<'de> Deserialize<'de> for DistributionWidgetXAxis { } min = Some(serde_json::from_value(v).map_err(M::Error::custom)?); } + "num_buckets" => { + if v.is_null() { + continue; + } + num_buckets = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } "scale" => { if v.is_null() { continue; @@ -143,6 +160,7 @@ impl<'de> Deserialize<'de> for DistributionWidgetXAxis { include_zero, max, min, + num_buckets, scale, additional_properties, _unparsed, diff --git a/src/datadogV1/model/model_heat_map_widget_definition.rs b/src/datadogV1/model/model_heat_map_widget_definition.rs index b3fc9206f..ee822024c 100644 --- a/src/datadogV1/model/model_heat_map_widget_definition.rs +++ b/src/datadogV1/model/model_heat_map_widget_definition.rs @@ -20,6 +20,9 @@ pub struct HeatMapWidgetDefinition { /// Available legend sizes for a widget. Should be one of "0", "2", "4", "8", "16", or "auto". #[serde(rename = "legend_size")] pub legend_size: Option, + /// List of markers. + #[serde(rename = "markers")] + pub markers: Option>, /// List of widget types. #[serde(rename = "requests")] pub requests: Vec, @@ -41,6 +44,9 @@ pub struct HeatMapWidgetDefinition { /// Type of the heat map widget. #[serde(rename = "type")] pub type_: crate::datadogV1::model::HeatMapWidgetDefinitionType, + /// X Axis controls for the heat map widget. + #[serde(rename = "xaxis")] + pub xaxis: Option, /// Axis controls for the widget. #[serde(rename = "yaxis")] pub yaxis: Option, @@ -60,6 +66,7 @@ impl HeatMapWidgetDefinition { custom_links: None, events: None, legend_size: None, + markers: None, requests, show_legend: None, time: None, @@ -67,6 +74,7 @@ impl HeatMapWidgetDefinition { title_align: None, title_size: None, type_, + xaxis: None, yaxis: None, additional_properties: std::collections::BTreeMap::new(), _unparsed: false, @@ -88,6 +96,11 @@ impl HeatMapWidgetDefinition { self } + pub fn markers(mut self, value: Vec) -> Self { + self.markers = Some(value); + self + } + pub fn show_legend(mut self, value: bool) -> Self { self.show_legend = Some(value); self @@ -113,6 +126,11 @@ impl HeatMapWidgetDefinition { self } + pub fn xaxis(mut self, value: crate::datadogV1::model::HeatMapWidgetXAxis) -> Self { + self.xaxis = Some(value); + self + } + pub fn yaxis(mut self, value: crate::datadogV1::model::WidgetAxis) -> Self { self.yaxis = Some(value); self @@ -147,6 +165,7 @@ impl<'de> Deserialize<'de> for HeatMapWidgetDefinition { let mut custom_links: Option> = None; let mut events: Option> = None; let mut legend_size: Option = None; + let mut markers: Option> = None; let mut requests: Option> = None; let mut show_legend: Option = None; let mut time: Option = None; @@ -154,6 +173,7 @@ impl<'de> Deserialize<'de> for HeatMapWidgetDefinition { let mut title_align: Option = None; let mut title_size: Option = None; let mut type_: Option = None; + let mut xaxis: Option = None; let mut yaxis: Option = None; let mut additional_properties: std::collections::BTreeMap< String, @@ -183,6 +203,12 @@ impl<'de> Deserialize<'de> for HeatMapWidgetDefinition { legend_size = Some(serde_json::from_value(v).map_err(M::Error::custom)?); } + "markers" => { + if v.is_null() { + continue; + } + markers = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } "requests" => { requests = Some(serde_json::from_value(v).map_err(M::Error::custom)?); } @@ -247,6 +273,12 @@ impl<'de> Deserialize<'de> for HeatMapWidgetDefinition { } } } + "xaxis" => { + if v.is_null() { + continue; + } + xaxis = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } "yaxis" => { if v.is_null() { continue; @@ -267,6 +299,7 @@ impl<'de> Deserialize<'de> for HeatMapWidgetDefinition { custom_links, events, legend_size, + markers, requests, show_legend, time, @@ -274,6 +307,7 @@ impl<'de> Deserialize<'de> for HeatMapWidgetDefinition { title_align, title_size, type_, + xaxis, yaxis, additional_properties, _unparsed, diff --git a/src/datadogV1/model/model_heat_map_widget_request.rs b/src/datadogV1/model/model_heat_map_widget_request.rs index f6cecb773..affcf917c 100644 --- a/src/datadogV1/model/model_heat_map_widget_request.rs +++ b/src/datadogV1/model/model_heat_map_widget_request.rs @@ -38,6 +38,12 @@ pub struct HeatMapWidgetRequest { /// List of queries that can be returned directly or used in formulas. #[serde(rename = "queries")] pub queries: Option>, + /// A formula and functions metrics query. + #[serde(rename = "query")] + pub query: Option, + /// Request type for the histogram request. + #[serde(rename = "request_type")] + pub request_type: Option, /// Timeseries, scalar, or event list response. Event list response formats are supported by Geomap widgets. #[serde(rename = "response_format")] pub response_format: Option, @@ -69,6 +75,8 @@ impl HeatMapWidgetRequest { profile_metrics_query: None, q: None, queries: None, + query: None, + request_type: None, response_format: None, rum_query: None, security_query: None, @@ -129,6 +137,22 @@ impl HeatMapWidgetRequest { self } + pub fn query( + mut self, + value: crate::datadogV1::model::FormulaAndFunctionMetricQueryDefinition, + ) -> Self { + self.query = Some(value); + self + } + + pub fn request_type( + mut self, + value: crate::datadogV1::model::WidgetHistogramRequestType, + ) -> Self { + self.request_type = Some(value); + self + } + pub fn response_format( mut self, value: crate::datadogV1::model::FormulaAndFunctionResponseFormat, @@ -197,6 +221,11 @@ impl<'de> Deserialize<'de> for HeatMapWidgetRequest { let mut queries: Option< Vec, > = None; + let mut query: Option< + crate::datadogV1::model::FormulaAndFunctionMetricQueryDefinition, + > = None; + let mut request_type: Option = + None; let mut response_format: Option< crate::datadogV1::model::FormulaAndFunctionResponseFormat, > = None; @@ -269,6 +298,27 @@ impl<'de> Deserialize<'de> for HeatMapWidgetRequest { } queries = Some(serde_json::from_value(v).map_err(M::Error::custom)?); } + "query" => { + if v.is_null() { + continue; + } + query = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "request_type" => { + if v.is_null() { + continue; + } + request_type = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _request_type) = request_type { + match _request_type { + crate::datadogV1::model::WidgetHistogramRequestType::UnparsedObject(_request_type) => { + _unparsed = true; + }, + _ => {} + } + } + } "response_format" => { if v.is_null() { continue; @@ -321,6 +371,8 @@ impl<'de> Deserialize<'de> for HeatMapWidgetRequest { profile_metrics_query, q, queries, + query, + request_type, response_format, rum_query, security_query, diff --git a/src/datadogV1/model/model_heat_map_widget_x_axis.rs b/src/datadogV1/model/model_heat_map_widget_x_axis.rs new file mode 100644 index 000000000..d2b9b8512 --- /dev/null +++ b/src/datadogV1/model/model_heat_map_widget_x_axis.rs @@ -0,0 +1,106 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// X Axis controls for the heat map widget. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct HeatMapWidgetXAxis { + /// 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). + #[serde(rename = "num_buckets")] + pub num_buckets: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl HeatMapWidgetXAxis { + pub fn new() -> HeatMapWidgetXAxis { + HeatMapWidgetXAxis { + num_buckets: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn num_buckets(mut self, value: i64) -> Self { + self.num_buckets = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for HeatMapWidgetXAxis { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for HeatMapWidgetXAxis { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct HeatMapWidgetXAxisVisitor; + impl<'a> Visitor<'a> for HeatMapWidgetXAxisVisitor { + type Value = HeatMapWidgetXAxis; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut num_buckets: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "num_buckets" => { + if v.is_null() { + continue; + } + num_buckets = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = HeatMapWidgetXAxis { + num_buckets, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(HeatMapWidgetXAxisVisitor) + } +} diff --git a/src/datadogV1/model/model_distribution_widget_histogram_request_type.rs b/src/datadogV1/model/model_widget_histogram_request_type.rs similarity index 84% rename from src/datadogV1/model/model_distribution_widget_histogram_request_type.rs rename to src/datadogV1/model/model_widget_histogram_request_type.rs index ef490b90e..2ddc266ea 100644 --- a/src/datadogV1/model/model_distribution_widget_histogram_request_type.rs +++ b/src/datadogV1/model/model_widget_histogram_request_type.rs @@ -6,12 +6,12 @@ use serde::{Deserialize, Deserializer, Serialize, Serializer}; #[non_exhaustive] #[derive(Clone, Debug, Eq, PartialEq)] -pub enum DistributionWidgetHistogramRequestType { +pub enum WidgetHistogramRequestType { HISTOGRAM, UnparsedObject(crate::datadog::UnparsedObject), } -impl ToString for DistributionWidgetHistogramRequestType { +impl ToString for WidgetHistogramRequestType { fn to_string(&self) -> String { match self { Self::HISTOGRAM => String::from("histogram"), @@ -20,7 +20,7 @@ impl ToString for DistributionWidgetHistogramRequestType { } } -impl Serialize for DistributionWidgetHistogramRequestType { +impl Serialize for WidgetHistogramRequestType { fn serialize(&self, serializer: S) -> Result where S: Serializer, @@ -32,7 +32,7 @@ impl Serialize for DistributionWidgetHistogramRequestType { } } -impl<'de> Deserialize<'de> for DistributionWidgetHistogramRequestType { +impl<'de> Deserialize<'de> for WidgetHistogramRequestType { fn deserialize(deserializer: D) -> Result where D: Deserializer<'de>, diff --git a/src/datadogV1/model/model_widget_marker.rs b/src/datadogV1/model/model_widget_marker.rs index e3d686014..37b9c4bc7 100644 --- a/src/datadogV1/model/model_widget_marker.rs +++ b/src/datadogV1/model/model_widget_marker.rs @@ -14,7 +14,7 @@ pub struct 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`. #[serde(rename = "display_type")] pub display_type: Option, /// Label to display over the marker. @@ -24,6 +24,7 @@ pub struct WidgetMarker { #[serde(rename = "time")] pub time: Option, /// 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). #[serde(rename = "value")] pub value: String, #[serde(flatten)] diff --git a/tests/scenarios/cassettes/v1/dashboards/Create-a-new-dashboard-with-distribution-widget-with-markers-and-num-buckets.frozen b/tests/scenarios/cassettes/v1/dashboards/Create-a-new-dashboard-with-distribution-widget-with-markers-and-num-buckets.frozen new file mode 100644 index 000000000..957e38ac2 --- /dev/null +++ b/tests/scenarios/cassettes/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/tests/scenarios/cassettes/v1/dashboards/Create-a-new-dashboard-with-distribution-widget-with-markers-and-num-buckets.json b/tests/scenarios/cassettes/v1/dashboards/Create-a-new-dashboard-with-distribution-widget-with-markers-and-num-buckets.json new file mode 100644 index 000000000..22ff3793d --- /dev/null +++ b/tests/scenarios/cassettes/v1/dashboards/Create-a-new-dashboard-with-distribution-widget-with-markers-and-num-buckets.json @@ -0,0 +1,67 @@ +{ + "http_interactions": [ + { + "request": { + "body": { + "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}}]}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "post", + "uri": "https://api.datadoghq.com/api/v1/dashboard" + }, + "response": { + "body": { + "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\":[]}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Thu, 04 Dec 2025 23:08:04 GMT" + }, + { + "request": { + "body": "", + "headers": { + "Accept": [ + "application/json" + ] + }, + "method": "delete", + "uri": "https://api.datadoghq.com/api/v1/dashboard/ved-atm-2g5" + }, + "response": { + "body": { + "string": "{\"deleted_dashboard_id\":\"ved-atm-2g5\"}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Thu, 04 Dec 2025 23:08:04 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v1/dashboards/Create-a-new-dashboard-with-formula-and-function-distribution-widget.frozen b/tests/scenarios/cassettes/v1/dashboards/Create-a-new-dashboard-with-formula-and-function-distribution-widget.frozen new file mode 100644 index 000000000..028130f6b --- /dev/null +++ b/tests/scenarios/cassettes/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/tests/scenarios/cassettes/v1/dashboards/Create-a-new-dashboard-with-formula-and-function-distribution-widget.json b/tests/scenarios/cassettes/v1/dashboards/Create-a-new-dashboard-with-formula-and-function-distribution-widget.json new file mode 100644 index 000000000..14935f912 --- /dev/null +++ b/tests/scenarios/cassettes/v1/dashboards/Create-a-new-dashboard-with-formula-and-function-distribution-widget.json @@ -0,0 +1,67 @@ +{ + "http_interactions": [ + { + "request": { + "body": { + "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}}]}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "post", + "uri": "https://api.datadoghq.com/api/v1/dashboard" + }, + "response": { + "body": { + "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\":[]}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Mon, 15 Dec 2025 17:03:52 GMT" + }, + { + "request": { + "body": "", + "headers": { + "Accept": [ + "application/json" + ] + }, + "method": "delete", + "uri": "https://api.datadoghq.com/api/v1/dashboard/ii3-z6t-p8x" + }, + "response": { + "body": { + "string": "{\"deleted_dashboard_id\":\"ii3-z6t-p8x\"}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Mon, 15 Dec 2025 17:03:52 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v1/dashboards/Create-a-new-dashboard-with-heatmap-widget-with-markers-and-num-buckets.frozen b/tests/scenarios/cassettes/v1/dashboards/Create-a-new-dashboard-with-heatmap-widget-with-markers-and-num-buckets.frozen new file mode 100644 index 000000000..502143efd --- /dev/null +++ b/tests/scenarios/cassettes/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/tests/scenarios/cassettes/v1/dashboards/Create-a-new-dashboard-with-heatmap-widget-with-markers-and-num-buckets.json b/tests/scenarios/cassettes/v1/dashboards/Create-a-new-dashboard-with-heatmap-widget-with-markers-and-num-buckets.json new file mode 100644 index 000000000..b5c9eda32 --- /dev/null +++ b/tests/scenarios/cassettes/v1/dashboards/Create-a-new-dashboard-with-heatmap-widget-with-markers-and-num-buckets.json @@ -0,0 +1,67 @@ +{ + "http_interactions": [ + { + "request": { + "body": { + "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}}]}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "post", + "uri": "https://api.datadoghq.com/api/v1/dashboard" + }, + "response": { + "body": { + "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\":[]}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Mon, 15 Dec 2025 17:39:03 GMT" + }, + { + "request": { + "body": "", + "headers": { + "Accept": [ + "application/json" + ] + }, + "method": "delete", + "uri": "https://api.datadoghq.com/api/v1/dashboard/r3p-kik-ven" + }, + "response": { + "body": { + "string": "{\"deleted_dashboard_id\":\"r3p-kik-ven\"}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Mon, 15 Dec 2025 17:39:03 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/features/v1/dashboards.feature b/tests/scenarios/features/v1/dashboards.feature index 588c609ce..076546114 100644 --- a/tests/scenarios/features/v1/dashboards.feature +++ b/tests/scenarios/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