Skip to content

Commit 58e6148

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit 26d28d09 of spec repo
1 parent 5a3b049 commit 58e6148

File tree

35 files changed

+417
-58
lines changed

35 files changed

+417
-58
lines changed

.apigentools-info

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
"spec_versions": {
55
"v1": {
66
"apigentools_version": "1.6.6",
7-
"regenerated": "2025-04-07 18:49:34.690356",
8-
"spec_repo_commit": "d0287df0"
7+
"regenerated": "2025-04-08 11:56:36.625221",
8+
"spec_repo_commit": "26d28d09"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.6",
12-
"regenerated": "2025-04-07 18:49:34.706605",
13-
"spec_repo_commit": "d0287df0"
12+
"regenerated": "2025-04-08 11:56:36.643861",
13+
"spec_repo_commit": "26d28d09"
1414
}
1515
}
1616
}

.generator/schemas/v2/openapi.yaml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25238,6 +25238,14 @@ components:
2523825238
example: 1.0
2523925239
format: double
2524025240
type: number
25241+
trace_rate:
25242+
description: 'Sample rate to apply to traces containing spans going through
25243+
this retention filter,
25244+
25245+
a value of 1.0 keeps all traces with spans matching the query.'
25246+
example: 1.0
25247+
format: double
25248+
type: number
2524125249
type: object
2524225250
RetentionFilterAllType:
2524325251
default: spans-sampling-processor
@@ -25297,6 +25305,14 @@ components:
2529725305
example: 1.0
2529825306
format: double
2529925307
type: number
25308+
trace_rate:
25309+
description: 'Sample rate to apply to traces containing spans going through
25310+
this retention filter,
25311+
25312+
a value of 1.0 keeps all traces with spans matching the query.'
25313+
example: 1.0
25314+
format: double
25315+
type: number
2530025316
type: object
2530125317
RetentionFilterCreateAttributes:
2530225318
description: The object describing the configuration of the retention filter
@@ -25322,6 +25338,14 @@ components:
2532225338
example: 1.0
2532325339
format: double
2532425340
type: number
25341+
trace_rate:
25342+
description: 'Sample rate to apply to traces containing spans going through
25343+
this retention filter,
25344+
25345+
a value of 1.0 keeps all traces with spans matching the query.'
25346+
example: 1.0
25347+
format: double
25348+
type: number
2532525349
required:
2532625350
- name
2532725351
- filter
@@ -25393,6 +25417,14 @@ components:
2539325417
example: 1.0
2539425418
format: double
2539525419
type: number
25420+
trace_rate:
25421+
description: 'Sample rate to apply to traces containing spans going through
25422+
this retention filter,
25423+
25424+
a value of 1.0 keeps all traces with spans matching the query.'
25425+
example: 1.0
25426+
format: double
25427+
type: number
2539625428
required:
2539725429
- name
2539825430
- filter
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// Create a retention filter with trace rate returns "OK" response
2+
use datadog_api_client::datadog;
3+
use datadog_api_client::datadogV2::api_apm_retention_filters::APMRetentionFiltersAPI;
4+
use datadog_api_client::datadogV2::model::ApmRetentionFilterType;
5+
use datadog_api_client::datadogV2::model::RetentionFilterCreateAttributes;
6+
use datadog_api_client::datadogV2::model::RetentionFilterCreateData;
7+
use datadog_api_client::datadogV2::model::RetentionFilterCreateRequest;
8+
use datadog_api_client::datadogV2::model::RetentionFilterType;
9+
use datadog_api_client::datadogV2::model::SpansFilterCreate;
10+
11+
#[tokio::main]
12+
async fn main() {
13+
let body = RetentionFilterCreateRequest::new(RetentionFilterCreateData::new(
14+
RetentionFilterCreateAttributes::new(
15+
true,
16+
SpansFilterCreate::new("@http.status_code:200 service:my-service".to_string()),
17+
RetentionFilterType::SPANS_SAMPLING_PROCESSOR,
18+
"my retention filter".to_string(),
19+
1.0,
20+
)
21+
.trace_rate(1.0 as f64),
22+
ApmRetentionFilterType::apm_retention_filter,
23+
));
24+
let configuration = datadog::Configuration::new();
25+
let api = APMRetentionFiltersAPI::with_config(configuration);
26+
let resp = api.create_apm_retention_filter(body).await;
27+
if let Ok(value) = resp {
28+
println!("{:#?}", value);
29+
} else {
30+
println!("{:#?}", resp.unwrap_err());
31+
}
32+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// Update a retention filter with trace rate returns "OK" response
2+
use datadog_api_client::datadog;
3+
use datadog_api_client::datadogV2::api_apm_retention_filters::APMRetentionFiltersAPI;
4+
use datadog_api_client::datadogV2::model::ApmRetentionFilterType;
5+
use datadog_api_client::datadogV2::model::RetentionFilterAllType;
6+
use datadog_api_client::datadogV2::model::RetentionFilterUpdateAttributes;
7+
use datadog_api_client::datadogV2::model::RetentionFilterUpdateData;
8+
use datadog_api_client::datadogV2::model::RetentionFilterUpdateRequest;
9+
use datadog_api_client::datadogV2::model::SpansFilterCreate;
10+
11+
#[tokio::main]
12+
async fn main() {
13+
// there is a valid "retention_filter" in the system
14+
let retention_filter_data_id = std::env::var("RETENTION_FILTER_DATA_ID").unwrap();
15+
let body = RetentionFilterUpdateRequest::new(RetentionFilterUpdateData::new(
16+
RetentionFilterUpdateAttributes::new(
17+
true,
18+
SpansFilterCreate::new("@_top_level:1 test:service-demo".to_string()),
19+
RetentionFilterAllType::SPANS_SAMPLING_PROCESSOR,
20+
"test".to_string(),
21+
0.9,
22+
)
23+
.trace_rate(1.0 as f64),
24+
"test-id".to_string(),
25+
ApmRetentionFilterType::apm_retention_filter,
26+
));
27+
let configuration = datadog::Configuration::new();
28+
let api = APMRetentionFiltersAPI::with_config(configuration);
29+
let resp = api
30+
.update_apm_retention_filter(retention_filter_data_id.clone(), body)
31+
.await;
32+
if let Ok(value) = resp {
33+
println!("{:#?}", value);
34+
} else {
35+
println!("{:#?}", resp.unwrap_err());
36+
}
37+
}

src/datadogV2/model/model_retention_filter_all_attributes.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ pub struct RetentionFilterAllAttributes {
4545
/// a value of 1.0 keeps all spans matching the query.
4646
#[serde(rename = "rate")]
4747
pub rate: Option<f64>,
48+
/// Sample rate to apply to traces containing spans going through this retention filter,
49+
/// a value of 1.0 keeps all traces with spans matching the query.
50+
#[serde(rename = "trace_rate")]
51+
pub trace_rate: Option<f64>,
4852
#[serde(flatten)]
4953
pub additional_properties: std::collections::BTreeMap<String, serde_json::Value>,
5054
#[serde(skip)]
@@ -66,6 +70,7 @@ impl RetentionFilterAllAttributes {
6670
modified_by: None,
6771
name: None,
6872
rate: None,
73+
trace_rate: None,
6974
additional_properties: std::collections::BTreeMap::new(),
7075
_unparsed: false,
7176
}
@@ -126,6 +131,11 @@ impl RetentionFilterAllAttributes {
126131
self
127132
}
128133

134+
pub fn trace_rate(mut self, value: f64) -> Self {
135+
self.trace_rate = Some(value);
136+
self
137+
}
138+
129139
pub fn additional_properties(
130140
mut self,
131141
value: std::collections::BTreeMap<String, serde_json::Value>,
@@ -169,6 +179,7 @@ impl<'de> Deserialize<'de> for RetentionFilterAllAttributes {
169179
let mut modified_by: Option<String> = None;
170180
let mut name: Option<String> = None;
171181
let mut rate: Option<f64> = None;
182+
let mut trace_rate: Option<f64> = None;
172183
let mut additional_properties: std::collections::BTreeMap<
173184
String,
174185
serde_json::Value,
@@ -255,6 +266,12 @@ impl<'de> Deserialize<'de> for RetentionFilterAllAttributes {
255266
}
256267
rate = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
257268
}
269+
"trace_rate" => {
270+
if v.is_null() {
271+
continue;
272+
}
273+
trace_rate = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
274+
}
258275
&_ => {
259276
if let Ok(value) = serde_json::from_value(v.clone()) {
260277
additional_properties.insert(k, value);
@@ -275,6 +292,7 @@ impl<'de> Deserialize<'de> for RetentionFilterAllAttributes {
275292
modified_by,
276293
name,
277294
rate,
295+
trace_rate,
278296
additional_properties,
279297
_unparsed,
280298
};

src/datadogV2/model/model_retention_filter_attributes.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ pub struct RetentionFilterAttributes {
4545
/// a value of 1.0 keeps all spans matching the query.
4646
#[serde(rename = "rate")]
4747
pub rate: Option<f64>,
48+
/// Sample rate to apply to traces containing spans going through this retention filter,
49+
/// a value of 1.0 keeps all traces with spans matching the query.
50+
#[serde(rename = "trace_rate")]
51+
pub trace_rate: Option<f64>,
4852
#[serde(flatten)]
4953
pub additional_properties: std::collections::BTreeMap<String, serde_json::Value>,
5054
#[serde(skip)]
@@ -66,6 +70,7 @@ impl RetentionFilterAttributes {
6670
modified_by: None,
6771
name: None,
6872
rate: None,
73+
trace_rate: None,
6974
additional_properties: std::collections::BTreeMap::new(),
7075
_unparsed: false,
7176
}
@@ -126,6 +131,11 @@ impl RetentionFilterAttributes {
126131
self
127132
}
128133

134+
pub fn trace_rate(mut self, value: f64) -> Self {
135+
self.trace_rate = Some(value);
136+
self
137+
}
138+
129139
pub fn additional_properties(
130140
mut self,
131141
value: std::collections::BTreeMap<String, serde_json::Value>,
@@ -169,6 +179,7 @@ impl<'de> Deserialize<'de> for RetentionFilterAttributes {
169179
let mut modified_by: Option<String> = None;
170180
let mut name: Option<String> = None;
171181
let mut rate: Option<f64> = None;
182+
let mut trace_rate: Option<f64> = None;
172183
let mut additional_properties: std::collections::BTreeMap<
173184
String,
174185
serde_json::Value,
@@ -255,6 +266,12 @@ impl<'de> Deserialize<'de> for RetentionFilterAttributes {
255266
}
256267
rate = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
257268
}
269+
"trace_rate" => {
270+
if v.is_null() {
271+
continue;
272+
}
273+
trace_rate = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
274+
}
258275
&_ => {
259276
if let Ok(value) = serde_json::from_value(v.clone()) {
260277
additional_properties.insert(k, value);
@@ -275,6 +292,7 @@ impl<'de> Deserialize<'de> for RetentionFilterAttributes {
275292
modified_by,
276293
name,
277294
rate,
295+
trace_rate,
278296
additional_properties,
279297
_unparsed,
280298
};

src/datadogV2/model/model_retention_filter_create_attributes.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ pub struct RetentionFilterCreateAttributes {
2727
/// a value of 1.0 keeps all spans matching the query.
2828
#[serde(rename = "rate")]
2929
pub rate: f64,
30+
/// Sample rate to apply to traces containing spans going through this retention filter,
31+
/// a value of 1.0 keeps all traces with spans matching the query.
32+
#[serde(rename = "trace_rate")]
33+
pub trace_rate: Option<f64>,
3034
#[serde(flatten)]
3135
pub additional_properties: std::collections::BTreeMap<String, serde_json::Value>,
3236
#[serde(skip)]
@@ -48,11 +52,17 @@ impl RetentionFilterCreateAttributes {
4852
filter_type,
4953
name,
5054
rate,
55+
trace_rate: None,
5156
additional_properties: std::collections::BTreeMap::new(),
5257
_unparsed: false,
5358
}
5459
}
5560

61+
pub fn trace_rate(mut self, value: f64) -> Self {
62+
self.trace_rate = Some(value);
63+
self
64+
}
65+
5666
pub fn additional_properties(
5767
mut self,
5868
value: std::collections::BTreeMap<String, serde_json::Value>,
@@ -84,6 +94,7 @@ impl<'de> Deserialize<'de> for RetentionFilterCreateAttributes {
8494
let mut filter_type: Option<crate::datadogV2::model::RetentionFilterType> = None;
8595
let mut name: Option<String> = None;
8696
let mut rate: Option<f64> = None;
97+
let mut trace_rate: Option<f64> = None;
8798
let mut additional_properties: std::collections::BTreeMap<
8899
String,
89100
serde_json::Value,
@@ -116,6 +127,12 @@ impl<'de> Deserialize<'de> for RetentionFilterCreateAttributes {
116127
"rate" => {
117128
rate = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
118129
}
130+
"trace_rate" => {
131+
if v.is_null() {
132+
continue;
133+
}
134+
trace_rate = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
135+
}
119136
&_ => {
120137
if let Ok(value) = serde_json::from_value(v.clone()) {
121138
additional_properties.insert(k, value);
@@ -136,6 +153,7 @@ impl<'de> Deserialize<'de> for RetentionFilterCreateAttributes {
136153
filter_type,
137154
name,
138155
rate,
156+
trace_rate,
139157
additional_properties,
140158
_unparsed,
141159
};

src/datadogV2/model/model_retention_filter_update_attributes.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ pub struct RetentionFilterUpdateAttributes {
2727
/// a value of 1.0 keeps all spans matching the query.
2828
#[serde(rename = "rate")]
2929
pub rate: f64,
30+
/// Sample rate to apply to traces containing spans going through this retention filter,
31+
/// a value of 1.0 keeps all traces with spans matching the query.
32+
#[serde(rename = "trace_rate")]
33+
pub trace_rate: Option<f64>,
3034
#[serde(flatten)]
3135
pub additional_properties: std::collections::BTreeMap<String, serde_json::Value>,
3236
#[serde(skip)]
@@ -48,11 +52,17 @@ impl RetentionFilterUpdateAttributes {
4852
filter_type,
4953
name,
5054
rate,
55+
trace_rate: None,
5156
additional_properties: std::collections::BTreeMap::new(),
5257
_unparsed: false,
5358
}
5459
}
5560

61+
pub fn trace_rate(mut self, value: f64) -> Self {
62+
self.trace_rate = Some(value);
63+
self
64+
}
65+
5666
pub fn additional_properties(
5767
mut self,
5868
value: std::collections::BTreeMap<String, serde_json::Value>,
@@ -84,6 +94,7 @@ impl<'de> Deserialize<'de> for RetentionFilterUpdateAttributes {
8494
let mut filter_type: Option<crate::datadogV2::model::RetentionFilterAllType> = None;
8595
let mut name: Option<String> = None;
8696
let mut rate: Option<f64> = None;
97+
let mut trace_rate: Option<f64> = None;
8798
let mut additional_properties: std::collections::BTreeMap<
8899
String,
89100
serde_json::Value,
@@ -116,6 +127,12 @@ impl<'de> Deserialize<'de> for RetentionFilterUpdateAttributes {
116127
"rate" => {
117128
rate = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
118129
}
130+
"trace_rate" => {
131+
if v.is_null() {
132+
continue;
133+
}
134+
trace_rate = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
135+
}
119136
&_ => {
120137
if let Ok(value) = serde_json::from_value(v.clone()) {
121138
additional_properties.insert(k, value);
@@ -136,6 +153,7 @@ impl<'de> Deserialize<'de> for RetentionFilterUpdateAttributes {
136153
filter_type,
137154
name,
138155
rate,
156+
trace_rate,
139157
additional_properties,
140158
_unparsed,
141159
};
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2024-04-10T12:31:19.300Z
1+
2025-04-08T11:32:44.101Z

tests/scenarios/cassettes/v2/apm_retention_filters/Create-a-default-retention-filter-returns-Bad-Request-response.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
"message": "Bad Request"
3333
}
3434
},
35-
"recorded_at": "Wed, 10 Apr 2024 12:31:19 GMT"
35+
"recorded_at": "Tue, 08 Apr 2025 11:32:44 GMT"
3636
}
3737
],
3838
"recorded_with": "VCR 6.0.0"

0 commit comments

Comments
 (0)