Struct ScatterplotWidgetFormula

Source
#[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

Source

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
Hide additional 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}
Source

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
Hide additional 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}
Source

pub fn additional_properties(self, value: BTreeMap<String, Value>) -> Self

Trait Implementations§

Source§

impl Clone for ScatterplotWidgetFormula

Source§

fn clone(&self) -> ScatterplotWidgetFormula

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ScatterplotWidgetFormula

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for ScatterplotWidgetFormula

Source§

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

Source§

fn eq(&self, other: &ScatterplotWidgetFormula) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for ScatterplotWidgetFormula

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for ScatterplotWidgetFormula

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> ErasedDestructor for T
where T: 'static,