Skip to main content

nominal_api/conjure/objects/scout/compute/api/
summarize_series.rs

1/// Summarizes the output of a series node. The output can be a numeric, enum, log, or cartesian series.
2/// Summarization strategy should be specified.
3#[derive(
4    Debug,
5    Clone,
6    conjure_object::serde::Serialize,
7    conjure_object::serde::Deserialize,
8    conjure_object::private::DeriveWith
9)]
10#[serde(crate = "conjure_object::serde")]
11#[derive_with(PartialEq, Eq, PartialOrd, Ord, Hash)]
12#[conjure_object::private::staged_builder::staged_builder]
13#[builder(crate = conjure_object::private::staged_builder, update, inline)]
14pub struct SummarizeSeries {
15    #[builder(custom(type = super::Series, convert = Box::new))]
16    #[serde(rename = "input")]
17    input: Box<super::Series>,
18    #[builder(default, into)]
19    #[serde(rename = "outputFormat", skip_serializing_if = "Option::is_none", default)]
20    output_format: Option<super::OutputFormat>,
21    #[builder(default, into)]
22    #[serde(
23        rename = "numericOutputFields",
24        skip_serializing_if = "Option::is_none",
25        default
26    )]
27    numeric_output_fields: Option<std::collections::BTreeSet<super::NumericOutputField>>,
28    #[builder(
29        default,
30        map(key(type = String, into), value(type = super::NumericAggregationOperator))
31    )]
32    #[serde(
33        rename = "numericAggregations",
34        skip_serializing_if = "std::collections::BTreeMap::is_empty",
35        default
36    )]
37    numeric_aggregations: std::collections::BTreeMap<
38        String,
39        super::NumericAggregationOperator,
40    >,
41    #[builder(default, into)]
42    #[serde(rename = "resolution", skip_serializing_if = "Option::is_none", default)]
43    resolution: Option<conjure_object::SafeLong>,
44    #[builder(default, into)]
45    #[serde(rename = "buckets", skip_serializing_if = "Option::is_none", default)]
46    buckets: Option<i32>,
47    #[builder(
48        default,
49        custom(
50            type = impl
51            Into<Option<super::SummarizationStrategy>>,
52            convert = |v|v.into().map(Box::new)
53        )
54    )]
55    #[serde(
56        rename = "summarizationStrategy",
57        skip_serializing_if = "Option::is_none",
58        default
59    )]
60    summarization_strategy: Option<Box<super::SummarizationStrategy>>,
61}
62impl SummarizeSeries {
63    /// Constructs a new instance of the type.
64    #[inline]
65    pub fn new(input: super::Series) -> Self {
66        Self::builder().input(input).build()
67    }
68    #[inline]
69    pub fn input(&self) -> &super::Series {
70        &*self.input
71    }
72    /// The output format of the response. Defaults to LEGACY.
73    #[inline]
74    pub fn output_format(&self) -> Option<&super::OutputFormat> {
75        self.output_format.as_ref().map(|o| &*o)
76    }
77    /// The fields to output from the summarization. Applies only to Arrow format numeric series.
78    #[inline]
79    pub fn numeric_output_fields(
80        &self,
81    ) -> Option<&std::collections::BTreeSet<super::NumericOutputField>> {
82        self.numeric_output_fields.as_ref().map(|o| &*o)
83    }
84    /// Additional numeric aggregations per decimation bucket (e.g. percentiles). Map key is the name of the column in the result.
85    #[inline]
86    pub fn numeric_aggregations(
87        &self,
88    ) -> &std::collections::BTreeMap<String, super::NumericAggregationOperator> {
89        &self.numeric_aggregations
90    }
91    /// Resolution of the output series specifying time interval between decimated points, in nanoseconds.
92    #[deprecated(note = "Use summarizationStrategy instead.\n")]
93    #[inline]
94    pub fn resolution(&self) -> Option<conjure_object::SafeLong> {
95        self.resolution.as_ref().map(|o| *o)
96    }
97    /// Number of points to generate in the output series.
98    #[deprecated(note = "Use summarizationStrategy instead.\n")]
99    #[inline]
100    pub fn buckets(&self) -> Option<i32> {
101        self.buckets.as_ref().map(|o| *o)
102    }
103    /// The strategy to use when summarizing the series.
104    #[inline]
105    pub fn summarization_strategy(&self) -> Option<&super::SummarizationStrategy> {
106        self.summarization_strategy.as_ref().map(|o| &**o)
107    }
108}