Skip to main content

nominal_api_conjure/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(
43        rename = "numericOutputFieldsV2",
44        skip_serializing_if = "Option::is_none",
45        default
46    )]
47    numeric_output_fields_v2: Option<Vec<super::NumericOutputFieldV2>>,
48    #[builder(default, into)]
49    #[serde(rename = "resolution", skip_serializing_if = "Option::is_none", default)]
50    resolution: Option<conjure_object::SafeLong>,
51    #[builder(default, into)]
52    #[serde(rename = "buckets", skip_serializing_if = "Option::is_none", default)]
53    buckets: Option<i32>,
54    #[builder(
55        default,
56        custom(
57            type = impl
58            Into<Option<super::SummarizationStrategy>>,
59            convert = |v|v.into().map(Box::new)
60        )
61    )]
62    #[serde(
63        rename = "summarizationStrategy",
64        skip_serializing_if = "Option::is_none",
65        default
66    )]
67    summarization_strategy: Option<Box<super::SummarizationStrategy>>,
68}
69impl SummarizeSeries {
70    /// Constructs a new instance of the type.
71    #[inline]
72    pub fn new(input: super::Series) -> Self {
73        Self::builder().input(input).build()
74    }
75    #[inline]
76    pub fn input(&self) -> &super::Series {
77        &*self.input
78    }
79    /// The output format of the response. Defaults to LEGACY.
80    #[inline]
81    pub fn output_format(&self) -> Option<&super::OutputFormat> {
82        self.output_format.as_ref().map(|o| &*o)
83    }
84    /// The fields to output from the summarization. Applies only to Arrow format numeric series.
85    #[deprecated(note = "Use numericOutputFieldsV2 instead.\n")]
86    #[inline]
87    pub fn numeric_output_fields(
88        &self,
89    ) -> Option<&std::collections::BTreeSet<super::NumericOutputField>> {
90        self.numeric_output_fields.as_ref().map(|o| &*o)
91    }
92    /// Additional numeric aggregations per decimation bucket (e.g. percentiles). Map key is the name of the column in the result.
93    #[inline]
94    pub fn numeric_aggregations(
95        &self,
96    ) -> &std::collections::BTreeMap<String, super::NumericAggregationOperator> {
97        &self.numeric_aggregations
98    }
99    /// Numeric bucket output fields to return. Applies only to Arrow format numeric series.
100    /// Defaults to MEAN when no numeric output selector is specified.
101    /// Mutually exclusive with numericOutputFields and numericAggregations.
102    #[inline]
103    pub fn numeric_output_fields_v2(&self) -> Option<&[super::NumericOutputFieldV2]> {
104        self.numeric_output_fields_v2.as_ref().map(|o| &**o)
105    }
106    /// Resolution of the output series specifying time interval between decimated points, in nanoseconds.
107    #[deprecated(note = "Use summarizationStrategy instead.\n")]
108    #[inline]
109    pub fn resolution(&self) -> Option<conjure_object::SafeLong> {
110        self.resolution.as_ref().map(|o| *o)
111    }
112    /// Number of points to generate in the output series.
113    #[deprecated(note = "Use summarizationStrategy instead.\n")]
114    #[inline]
115    pub fn buckets(&self) -> Option<i32> {
116        self.buckets.as_ref().map(|o| *o)
117    }
118    /// The strategy to use when summarizing the series.
119    #[inline]
120    pub fn summarization_strategy(&self) -> Option<&super::SummarizationStrategy> {
121        self.summarization_strategy.as_ref().map(|o| &**o)
122    }
123}