#[non_exhaustive]pub struct ScatterplotWidgetFormula {
pub alias: Option<String>,
pub dimension: ScatterplotDimension,
pub formula: String,
pub additional_properties: BTreeMap<String, Value>,
/* private fields */
}
Expand description
Formula to be used in a Scatterplot widget query.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. }
syntax; cannot be matched against without a wildcard ..
; and struct update syntax will not work.alias: Option<String>
Expression alias.
dimension: ScatterplotDimension
Dimension of the Scatterplot.
formula: String
String expression built from queries, formulas, and functions.
additional_properties: BTreeMap<String, Value>
Implementations§
Source§impl ScatterplotWidgetFormula
impl ScatterplotWidgetFormula
Sourcepub fn new(
dimension: ScatterplotDimension,
formula: String,
) -> ScatterplotWidgetFormula
pub fn new( dimension: ScatterplotDimension, formula: String, ) -> ScatterplotWidgetFormula
Examples found in repository?
examples/v1_dashboards_CreateDashboard_2104498738.rs (lines 38-41)
23async fn main() {
24 let body =
25 Dashboard::new(
26 DashboardLayoutType::ORDERED,
27 "Example-Dashboard".to_string(),
28 vec![
29 Widget::new(
30 WidgetDefinition::ScatterPlotWidgetDefinition(
31 Box::new(
32 ScatterPlotWidgetDefinition::new(
33 ScatterPlotWidgetDefinitionRequests
34 ::new().table(
35 ScatterplotTableRequest::new()
36 .formulas(
37 vec![
38 ScatterplotWidgetFormula::new(
39 ScatterplotDimension::X,
40 "query1".to_string(),
41 ).alias("my-query1".to_string()),
42 ScatterplotWidgetFormula::new(
43 ScatterplotDimension::Y,
44 "query2".to_string(),
45 ).alias("my-query2".to_string())
46 ],
47 )
48 .queries(
49 vec![
50 FormulaAndFunctionQueryDefinition
51 ::FormulaAndFunctionMetricQueryDefinition(
52 Box::new(
53 FormulaAndFunctionMetricQueryDefinition::new(
54 FormulaAndFunctionMetricDataSource::METRICS,
55 "query1".to_string(),
56 "avg:system.cpu.user{*} by {service}".to_string(),
57 ).aggregator(FormulaAndFunctionMetricAggregation::AVG),
58 ),
59 ),
60 FormulaAndFunctionQueryDefinition
61 ::FormulaAndFunctionMetricQueryDefinition(
62 Box::new(
63 FormulaAndFunctionMetricQueryDefinition::new(
64 FormulaAndFunctionMetricDataSource::METRICS,
65 "query2".to_string(),
66 "avg:system.mem.used{*} by {service}".to_string(),
67 ).aggregator(FormulaAndFunctionMetricAggregation::AVG),
68 ),
69 )
70 ],
71 )
72 .response_format(FormulaAndFunctionResponseFormat::SCALAR),
73 ),
74 ScatterPlotWidgetDefinitionType::SCATTERPLOT,
75 )
76 .title("".to_string())
77 .title_align(WidgetTextAlign::LEFT)
78 .title_size("16".to_string()),
79 ),
80 ),
81 )
82 .id(5346764334358972)
83 .layout(WidgetLayout::new(2, 4, 0, 0))
84 ],
85 );
86 let configuration = datadog::Configuration::new();
87 let api = DashboardsAPI::with_config(configuration);
88 let resp = api.create_dashboard(body).await;
89 if let Ok(value) = resp {
90 println!("{:#?}", value);
91 } else {
92 println!("{:#?}", resp.unwrap_err());
93 }
94}
More examples
examples/v1_dashboards_CreateDashboard_2342457693.rs (lines 41-44)
26async fn main() {
27 let body =
28 Dashboard::new(
29 DashboardLayoutType::FREE,
30 "Example-Dashboard".to_string(),
31 vec![
32 Widget::new(
33 WidgetDefinition::ScatterPlotWidgetDefinition(
34 Box::new(
35 ScatterPlotWidgetDefinition::new(
36 ScatterPlotWidgetDefinitionRequests
37 ::new().table(
38 ScatterplotTableRequest::new()
39 .formulas(
40 vec![
41 ScatterplotWidgetFormula::new(
42 ScatterplotDimension::X,
43 "query1".to_string(),
44 ).alias("".to_string()),
45 ScatterplotWidgetFormula::new(
46 ScatterplotDimension::Y,
47 "query2".to_string(),
48 ).alias("".to_string())
49 ],
50 )
51 .queries(
52 vec![
53 FormulaAndFunctionQueryDefinition
54 ::FormulaAndFunctionMetricQueryDefinition(
55 Box::new(
56 FormulaAndFunctionMetricQueryDefinition::new(
57 FormulaAndFunctionMetricDataSource::METRICS,
58 "query1".to_string(),
59 "avg:system.cpu.user{*} by {service}".to_string(),
60 ).aggregator(FormulaAndFunctionMetricAggregation::AVG),
61 ),
62 ),
63 FormulaAndFunctionQueryDefinition
64 ::FormulaAndFunctionMetricQueryDefinition(
65 Box::new(
66 FormulaAndFunctionMetricQueryDefinition::new(
67 FormulaAndFunctionMetricDataSource::METRICS,
68 "query2".to_string(),
69 "avg:system.mem.used{*} by {service}".to_string(),
70 ).aggregator(FormulaAndFunctionMetricAggregation::AVG),
71 ),
72 )
73 ],
74 )
75 .response_format(FormulaAndFunctionResponseFormat::SCALAR),
76 ),
77 ScatterPlotWidgetDefinitionType::SCATTERPLOT,
78 )
79 .color_by_groups(vec![])
80 .time(WidgetTime::WidgetLegacyLiveSpan(Box::new(WidgetLegacyLiveSpan::new())))
81 .title("".to_string())
82 .title_align(WidgetTextAlign::LEFT)
83 .title_size("16".to_string())
84 .xaxis(
85 WidgetAxis::new()
86 .include_zero(true)
87 .max("auto".to_string())
88 .min("auto".to_string())
89 .scale("linear".to_string()),
90 )
91 .yaxis(
92 WidgetAxis::new()
93 .include_zero(true)
94 .max("auto".to_string())
95 .min("auto".to_string())
96 .scale("linear".to_string()),
97 ),
98 ),
99 ),
100 ).layout(WidgetLayout::new(15, 47, 0, 0))
101 ],
102 )
103 .description(Some("".to_string()))
104 .notify_list(Some(vec![]))
105 .template_variables(Some(vec![]));
106 let configuration = datadog::Configuration::new();
107 let api = DashboardsAPI::with_config(configuration);
108 let resp = api.create_dashboard(body).await;
109 if let Ok(value) = resp {
110 println!("{:#?}", value);
111 } else {
112 println!("{:#?}", resp.unwrap_err());
113 }
114}
Sourcepub fn alias(self, value: String) -> Self
pub fn alias(self, value: String) -> Self
Examples found in repository?
examples/v1_dashboards_CreateDashboard_2104498738.rs (line 41)
23async fn main() {
24 let body =
25 Dashboard::new(
26 DashboardLayoutType::ORDERED,
27 "Example-Dashboard".to_string(),
28 vec![
29 Widget::new(
30 WidgetDefinition::ScatterPlotWidgetDefinition(
31 Box::new(
32 ScatterPlotWidgetDefinition::new(
33 ScatterPlotWidgetDefinitionRequests
34 ::new().table(
35 ScatterplotTableRequest::new()
36 .formulas(
37 vec![
38 ScatterplotWidgetFormula::new(
39 ScatterplotDimension::X,
40 "query1".to_string(),
41 ).alias("my-query1".to_string()),
42 ScatterplotWidgetFormula::new(
43 ScatterplotDimension::Y,
44 "query2".to_string(),
45 ).alias("my-query2".to_string())
46 ],
47 )
48 .queries(
49 vec![
50 FormulaAndFunctionQueryDefinition
51 ::FormulaAndFunctionMetricQueryDefinition(
52 Box::new(
53 FormulaAndFunctionMetricQueryDefinition::new(
54 FormulaAndFunctionMetricDataSource::METRICS,
55 "query1".to_string(),
56 "avg:system.cpu.user{*} by {service}".to_string(),
57 ).aggregator(FormulaAndFunctionMetricAggregation::AVG),
58 ),
59 ),
60 FormulaAndFunctionQueryDefinition
61 ::FormulaAndFunctionMetricQueryDefinition(
62 Box::new(
63 FormulaAndFunctionMetricQueryDefinition::new(
64 FormulaAndFunctionMetricDataSource::METRICS,
65 "query2".to_string(),
66 "avg:system.mem.used{*} by {service}".to_string(),
67 ).aggregator(FormulaAndFunctionMetricAggregation::AVG),
68 ),
69 )
70 ],
71 )
72 .response_format(FormulaAndFunctionResponseFormat::SCALAR),
73 ),
74 ScatterPlotWidgetDefinitionType::SCATTERPLOT,
75 )
76 .title("".to_string())
77 .title_align(WidgetTextAlign::LEFT)
78 .title_size("16".to_string()),
79 ),
80 ),
81 )
82 .id(5346764334358972)
83 .layout(WidgetLayout::new(2, 4, 0, 0))
84 ],
85 );
86 let configuration = datadog::Configuration::new();
87 let api = DashboardsAPI::with_config(configuration);
88 let resp = api.create_dashboard(body).await;
89 if let Ok(value) = resp {
90 println!("{:#?}", value);
91 } else {
92 println!("{:#?}", resp.unwrap_err());
93 }
94}
More examples
examples/v1_dashboards_CreateDashboard_2342457693.rs (line 44)
26async fn main() {
27 let body =
28 Dashboard::new(
29 DashboardLayoutType::FREE,
30 "Example-Dashboard".to_string(),
31 vec![
32 Widget::new(
33 WidgetDefinition::ScatterPlotWidgetDefinition(
34 Box::new(
35 ScatterPlotWidgetDefinition::new(
36 ScatterPlotWidgetDefinitionRequests
37 ::new().table(
38 ScatterplotTableRequest::new()
39 .formulas(
40 vec![
41 ScatterplotWidgetFormula::new(
42 ScatterplotDimension::X,
43 "query1".to_string(),
44 ).alias("".to_string()),
45 ScatterplotWidgetFormula::new(
46 ScatterplotDimension::Y,
47 "query2".to_string(),
48 ).alias("".to_string())
49 ],
50 )
51 .queries(
52 vec![
53 FormulaAndFunctionQueryDefinition
54 ::FormulaAndFunctionMetricQueryDefinition(
55 Box::new(
56 FormulaAndFunctionMetricQueryDefinition::new(
57 FormulaAndFunctionMetricDataSource::METRICS,
58 "query1".to_string(),
59 "avg:system.cpu.user{*} by {service}".to_string(),
60 ).aggregator(FormulaAndFunctionMetricAggregation::AVG),
61 ),
62 ),
63 FormulaAndFunctionQueryDefinition
64 ::FormulaAndFunctionMetricQueryDefinition(
65 Box::new(
66 FormulaAndFunctionMetricQueryDefinition::new(
67 FormulaAndFunctionMetricDataSource::METRICS,
68 "query2".to_string(),
69 "avg:system.mem.used{*} by {service}".to_string(),
70 ).aggregator(FormulaAndFunctionMetricAggregation::AVG),
71 ),
72 )
73 ],
74 )
75 .response_format(FormulaAndFunctionResponseFormat::SCALAR),
76 ),
77 ScatterPlotWidgetDefinitionType::SCATTERPLOT,
78 )
79 .color_by_groups(vec![])
80 .time(WidgetTime::WidgetLegacyLiveSpan(Box::new(WidgetLegacyLiveSpan::new())))
81 .title("".to_string())
82 .title_align(WidgetTextAlign::LEFT)
83 .title_size("16".to_string())
84 .xaxis(
85 WidgetAxis::new()
86 .include_zero(true)
87 .max("auto".to_string())
88 .min("auto".to_string())
89 .scale("linear".to_string()),
90 )
91 .yaxis(
92 WidgetAxis::new()
93 .include_zero(true)
94 .max("auto".to_string())
95 .min("auto".to_string())
96 .scale("linear".to_string()),
97 ),
98 ),
99 ),
100 ).layout(WidgetLayout::new(15, 47, 0, 0))
101 ],
102 )
103 .description(Some("".to_string()))
104 .notify_list(Some(vec![]))
105 .template_variables(Some(vec![]));
106 let configuration = datadog::Configuration::new();
107 let api = DashboardsAPI::with_config(configuration);
108 let resp = api.create_dashboard(body).await;
109 if let Ok(value) = resp {
110 println!("{:#?}", value);
111 } else {
112 println!("{:#?}", resp.unwrap_err());
113 }
114}
pub fn additional_properties(self, value: BTreeMap<String, Value>) -> Self
Trait Implementations§
Source§impl Clone for ScatterplotWidgetFormula
impl Clone for ScatterplotWidgetFormula
Source§fn clone(&self) -> ScatterplotWidgetFormula
fn clone(&self) -> ScatterplotWidgetFormula
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for ScatterplotWidgetFormula
impl Debug for ScatterplotWidgetFormula
Source§impl<'de> Deserialize<'de> for ScatterplotWidgetFormula
impl<'de> Deserialize<'de> for ScatterplotWidgetFormula
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for ScatterplotWidgetFormula
impl PartialEq for ScatterplotWidgetFormula
Source§impl Serialize for ScatterplotWidgetFormula
impl Serialize for ScatterplotWidgetFormula
impl StructuralPartialEq for ScatterplotWidgetFormula
Auto Trait Implementations§
impl Freeze for ScatterplotWidgetFormula
impl RefUnwindSafe for ScatterplotWidgetFormula
impl Send for ScatterplotWidgetFormula
impl Sync for ScatterplotWidgetFormula
impl Unpin for ScatterplotWidgetFormula
impl UnwindSafe for ScatterplotWidgetFormula
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more