Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 69 additions & 0 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50374,6 +50374,69 @@ components:
type: string
x-enum-varnames:
- RULESET
RumCrossProductSampling:
description: 'Configuration for additional APM Trace data retention for sessions
matching this retention filter.

When a session matches the filter and is retained (based on sample_rate),
you can configure

what percentage of retained sessions with ingested traces should have their
traces indexed.'
properties:
trace_enabled:
description: Whether Trace cross-product sampling is enabled. When false,
no traces are indexed regardless of trace_sample_rate.
example: true
type: boolean
trace_sample_rate:
description: 'The percentage (0-100) of retained sessions with ingested
traces for which traces are indexed.

For example, 25.0 means 25% of retained sessions with ingested traces
will have their traces indexed.'
example: 25.0
format: double
maximum: 100
minimum: 0
type: number
type: object
RumCrossProductSamplingCreate:
description: Configuration for cross-product sampling when creating a retention
filter.
properties:
trace_enabled:
description: Whether Trace cross-product sampling is enabled.
example: true
type: boolean
trace_sample_rate:
description: The percentage (0-100) of retained sessions with ingested traces
for which traces are indexed.
example: 25.0
format: double
maximum: 100
minimum: 0
type: number
required:
- trace_sample_rate
type: object
RumCrossProductSamplingUpdate:
description: Configuration for cross-product sampling when updating a retention
filter. All fields are optional for partial updates.
properties:
trace_enabled:
description: Whether Trace cross-product sampling is enabled.
example: true
type: boolean
trace_sample_rate:
description: The percentage (0-100) of retained sessions with ingested traces
for which traces are indexed.
example: 25.0
format: double
maximum: 100
minimum: 0
type: number
type: object
RumMetricCompute:
description: The compute rule to compute the rum-based metric.
properties:
Expand Down Expand Up @@ -50661,6 +50724,8 @@ components:
RumRetentionFilterAttributes:
description: The object describing attributes of a RUM retention filter.
properties:
cross_product_sampling:
$ref: '#/components/schemas/RumCrossProductSampling'
enabled:
$ref: '#/components/schemas/RumRetentionFilterEnabled'
event_type:
Expand All @@ -50675,6 +50740,8 @@ components:
RumRetentionFilterCreateAttributes:
description: The object describing attributes of a RUM retention filter to create.
properties:
cross_product_sampling:
$ref: '#/components/schemas/RumCrossProductSamplingCreate'
enabled:
$ref: '#/components/schemas/RumRetentionFilterEnabled'
event_type:
Expand Down Expand Up @@ -50776,6 +50843,8 @@ components:
RumRetentionFilterUpdateAttributes:
description: The object describing attributes of a RUM retention filter to update.
properties:
cross_product_sampling:
$ref: '#/components/schemas/RumCrossProductSamplingUpdate'
enabled:
$ref: '#/components/schemas/RumRetentionFilterEnabled'
event_type:
Expand Down
6 changes: 6 additions & 0 deletions src/datadogV2/model/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6136,6 +6136,8 @@ pub mod model_rum_retention_filter_data;
pub use self::model_rum_retention_filter_data::RumRetentionFilterData;
pub mod model_rum_retention_filter_attributes;
pub use self::model_rum_retention_filter_attributes::RumRetentionFilterAttributes;
pub mod model_rum_cross_product_sampling;
pub use self::model_rum_cross_product_sampling::RumCrossProductSampling;
pub mod model_rum_retention_filter_event_type;
pub use self::model_rum_retention_filter_event_type::RumRetentionFilterEventType;
pub mod model_rum_retention_filter_create_request;
Expand All @@ -6144,6 +6146,8 @@ pub mod model_rum_retention_filter_create_data;
pub use self::model_rum_retention_filter_create_data::RumRetentionFilterCreateData;
pub mod model_rum_retention_filter_create_attributes;
pub use self::model_rum_retention_filter_create_attributes::RumRetentionFilterCreateAttributes;
pub mod model_rum_cross_product_sampling_create;
pub use self::model_rum_cross_product_sampling_create::RumCrossProductSamplingCreate;
pub mod model_rum_retention_filter_response;
pub use self::model_rum_retention_filter_response::RumRetentionFilterResponse;
pub mod model_rum_retention_filter_update_request;
Expand All @@ -6152,6 +6156,8 @@ pub mod model_rum_retention_filter_update_data;
pub use self::model_rum_retention_filter_update_data::RumRetentionFilterUpdateData;
pub mod model_rum_retention_filter_update_attributes;
pub use self::model_rum_retention_filter_update_attributes::RumRetentionFilterUpdateAttributes;
pub mod model_rum_cross_product_sampling_update;
pub use self::model_rum_cross_product_sampling_update::RumCrossProductSamplingUpdate;
pub mod model_rum_application_update_request;
pub use self::model_rum_application_update_request::RUMApplicationUpdateRequest;
pub mod model_rum_application_update;
Expand Down
127 changes: 127 additions & 0 deletions src/datadogV2/model/model_rum_cross_product_sampling.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
// 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};

/// Configuration for additional APM Trace data retention for sessions matching this retention filter.
/// When a session matches the filter and is retained (based on sample_rate), you can configure
/// what percentage of retained sessions with ingested traces should have their traces indexed.
#[non_exhaustive]
#[skip_serializing_none]
#[derive(Clone, Debug, PartialEq, Serialize)]
pub struct RumCrossProductSampling {
/// Whether Trace cross-product sampling is enabled. When false, no traces are indexed regardless of trace_sample_rate.
#[serde(rename = "trace_enabled")]
pub trace_enabled: Option<bool>,
/// The percentage (0-100) of retained sessions with ingested traces for which traces are indexed.
/// For example, 25.0 means 25% of retained sessions with ingested traces will have their traces indexed.
#[serde(rename = "trace_sample_rate")]
pub trace_sample_rate: Option<f64>,
#[serde(flatten)]
pub additional_properties: std::collections::BTreeMap<String, serde_json::Value>,
#[serde(skip)]
#[serde(default)]
pub(crate) _unparsed: bool,
}

impl RumCrossProductSampling {
pub fn new() -> RumCrossProductSampling {
RumCrossProductSampling {
trace_enabled: None,
trace_sample_rate: None,
additional_properties: std::collections::BTreeMap::new(),
_unparsed: false,
}
}

pub fn trace_enabled(mut self, value: bool) -> Self {
self.trace_enabled = Some(value);
self
}

pub fn trace_sample_rate(mut self, value: f64) -> Self {
self.trace_sample_rate = Some(value);
self
}

pub fn additional_properties(
mut self,
value: std::collections::BTreeMap<String, serde_json::Value>,
) -> Self {
self.additional_properties = value;
self
}
}

impl Default for RumCrossProductSampling {
fn default() -> Self {
Self::new()
}
}

impl<'de> Deserialize<'de> for RumCrossProductSampling {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: Deserializer<'de>,
{
struct RumCrossProductSamplingVisitor;
impl<'a> Visitor<'a> for RumCrossProductSamplingVisitor {
type Value = RumCrossProductSampling;

fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result {
f.write_str("a mapping")
}

fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
where
M: MapAccess<'a>,
{
let mut trace_enabled: Option<bool> = None;
let mut trace_sample_rate: Option<f64> = 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::<String, serde_json::Value>()? {
match k.as_str() {
"trace_enabled" => {
if v.is_null() {
continue;
}
trace_enabled =
Some(serde_json::from_value(v).map_err(M::Error::custom)?);
}
"trace_sample_rate" => {
if v.is_null() {
continue;
}
trace_sample_rate =
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 = RumCrossProductSampling {
trace_enabled,
trace_sample_rate,
additional_properties,
_unparsed,
};

Ok(content)
}
}

deserializer.deserialize_any(RumCrossProductSamplingVisitor)
}
}
112 changes: 112 additions & 0 deletions src/datadogV2/model/model_rum_cross_product_sampling_create.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
// 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};

/// Configuration for cross-product sampling when creating a retention filter.
#[non_exhaustive]
#[skip_serializing_none]
#[derive(Clone, Debug, PartialEq, Serialize)]
pub struct RumCrossProductSamplingCreate {
/// Whether Trace cross-product sampling is enabled.
#[serde(rename = "trace_enabled")]
pub trace_enabled: Option<bool>,
/// The percentage (0-100) of retained sessions with ingested traces for which traces are indexed.
#[serde(rename = "trace_sample_rate")]
pub trace_sample_rate: f64,
#[serde(flatten)]
pub additional_properties: std::collections::BTreeMap<String, serde_json::Value>,
#[serde(skip)]
#[serde(default)]
pub(crate) _unparsed: bool,
}

impl RumCrossProductSamplingCreate {
pub fn new(trace_sample_rate: f64) -> RumCrossProductSamplingCreate {
RumCrossProductSamplingCreate {
trace_enabled: None,
trace_sample_rate,
additional_properties: std::collections::BTreeMap::new(),
_unparsed: false,
}
}

pub fn trace_enabled(mut self, value: bool) -> Self {
self.trace_enabled = Some(value);
self
}

pub fn additional_properties(
mut self,
value: std::collections::BTreeMap<String, serde_json::Value>,
) -> Self {
self.additional_properties = value;
self
}
}

impl<'de> Deserialize<'de> for RumCrossProductSamplingCreate {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: Deserializer<'de>,
{
struct RumCrossProductSamplingCreateVisitor;
impl<'a> Visitor<'a> for RumCrossProductSamplingCreateVisitor {
type Value = RumCrossProductSamplingCreate;

fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result {
f.write_str("a mapping")
}

fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
where
M: MapAccess<'a>,
{
let mut trace_enabled: Option<bool> = None;
let mut trace_sample_rate: Option<f64> = 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::<String, serde_json::Value>()? {
match k.as_str() {
"trace_enabled" => {
if v.is_null() {
continue;
}
trace_enabled =
Some(serde_json::from_value(v).map_err(M::Error::custom)?);
}
"trace_sample_rate" => {
trace_sample_rate =
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 trace_sample_rate = trace_sample_rate
.ok_or_else(|| M::Error::missing_field("trace_sample_rate"))?;

let content = RumCrossProductSamplingCreate {
trace_enabled,
trace_sample_rate,
additional_properties,
_unparsed,
};

Ok(content)
}
}

deserializer.deserialize_any(RumCrossProductSamplingCreateVisitor)
}
}
Loading
Loading