Skip to content

Commit 59133b0

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
and
ci.datadog-api-spec
authored
Add trace_rate support to APM retention filter APIs (#2793)
Co-authored-by: ci.datadog-api-spec <[email protected]>
1 parent 8fbc547 commit 59133b0

File tree

32 files changed

+465
-59
lines changed

32 files changed

+465
-59
lines changed

.apigentools-info

+4-4
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-08 14:37:45.449200",
8-
"spec_repo_commit": "642b7d0b"
7+
"regenerated": "2025-04-08 20:00:43.803169",
8+
"spec_repo_commit": "3e2afa30"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.6",
12-
"regenerated": "2025-04-08 14:37:45.465050",
13-
"spec_repo_commit": "642b7d0b"
12+
"regenerated": "2025-04-08 20:00:43.818345",
13+
"spec_repo_commit": "3e2afa30"
1414
}
1515
}
1616
}

.generator/schemas/v2/openapi.yaml

+32
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
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
// Create a retention filter with trace rate returns "OK" response
2+
3+
import com.datadog.api.client.ApiClient;
4+
import com.datadog.api.client.ApiException;
5+
import com.datadog.api.client.v2.api.ApmRetentionFiltersApi;
6+
import com.datadog.api.client.v2.model.ApmRetentionFilterType;
7+
import com.datadog.api.client.v2.model.RetentionFilterCreateAttributes;
8+
import com.datadog.api.client.v2.model.RetentionFilterCreateData;
9+
import com.datadog.api.client.v2.model.RetentionFilterCreateRequest;
10+
import com.datadog.api.client.v2.model.RetentionFilterCreateResponse;
11+
import com.datadog.api.client.v2.model.RetentionFilterType;
12+
import com.datadog.api.client.v2.model.SpansFilterCreate;
13+
14+
public class Example {
15+
public static void main(String[] args) {
16+
ApiClient defaultClient = ApiClient.getDefaultApiClient();
17+
ApmRetentionFiltersApi apiInstance = new ApmRetentionFiltersApi(defaultClient);
18+
19+
RetentionFilterCreateRequest body =
20+
new RetentionFilterCreateRequest()
21+
.data(
22+
new RetentionFilterCreateData()
23+
.attributes(
24+
new RetentionFilterCreateAttributes()
25+
.enabled(true)
26+
.filter(
27+
new SpansFilterCreate()
28+
.query("@http.status_code:200 service:my-service"))
29+
.filterType(RetentionFilterType.SPANS_SAMPLING_PROCESSOR)
30+
.name("my retention filter")
31+
.rate(1.0)
32+
.traceRate(1.0))
33+
.type(ApmRetentionFilterType.apm_retention_filter));
34+
35+
try {
36+
RetentionFilterCreateResponse result = apiInstance.createApmRetentionFilter(body);
37+
System.out.println(result);
38+
} catch (ApiException e) {
39+
System.err.println("Exception when calling ApmRetentionFiltersApi#createApmRetentionFilter");
40+
System.err.println("Status code: " + e.getCode());
41+
System.err.println("Reason: " + e.getResponseBody());
42+
System.err.println("Response headers: " + e.getResponseHeaders());
43+
e.printStackTrace();
44+
}
45+
}
46+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
// Update a retention filter with trace rate returns "OK" response
2+
3+
import com.datadog.api.client.ApiClient;
4+
import com.datadog.api.client.ApiException;
5+
import com.datadog.api.client.v2.api.ApmRetentionFiltersApi;
6+
import com.datadog.api.client.v2.model.ApmRetentionFilterType;
7+
import com.datadog.api.client.v2.model.RetentionFilterAllType;
8+
import com.datadog.api.client.v2.model.RetentionFilterResponse;
9+
import com.datadog.api.client.v2.model.RetentionFilterUpdateAttributes;
10+
import com.datadog.api.client.v2.model.RetentionFilterUpdateData;
11+
import com.datadog.api.client.v2.model.RetentionFilterUpdateRequest;
12+
import com.datadog.api.client.v2.model.SpansFilterCreate;
13+
14+
public class Example {
15+
public static void main(String[] args) {
16+
ApiClient defaultClient = ApiClient.getDefaultApiClient();
17+
ApmRetentionFiltersApi apiInstance = new ApmRetentionFiltersApi(defaultClient);
18+
19+
// there is a valid "retention_filter" in the system
20+
String RETENTION_FILTER_DATA_ID = System.getenv("RETENTION_FILTER_DATA_ID");
21+
22+
RetentionFilterUpdateRequest body =
23+
new RetentionFilterUpdateRequest()
24+
.data(
25+
new RetentionFilterUpdateData()
26+
.attributes(
27+
new RetentionFilterUpdateAttributes()
28+
.name("test")
29+
.rate(0.9)
30+
.traceRate(1.0)
31+
.filter(
32+
new SpansFilterCreate().query("@_top_level:1 test:service-demo"))
33+
.enabled(true)
34+
.filterType(RetentionFilterAllType.SPANS_SAMPLING_PROCESSOR))
35+
.id("test-id")
36+
.type(ApmRetentionFilterType.apm_retention_filter));
37+
38+
try {
39+
RetentionFilterResponse result =
40+
apiInstance.updateApmRetentionFilter(RETENTION_FILTER_DATA_ID, body);
41+
System.out.println(result);
42+
} catch (ApiException e) {
43+
System.err.println("Exception when calling ApmRetentionFiltersApi#updateApmRetentionFilter");
44+
System.err.println("Status code: " + e.getCode());
45+
System.err.println("Reason: " + e.getResponseBody());
46+
System.err.println("Response headers: " + e.getResponseHeaders());
47+
e.printStackTrace();
48+
}
49+
}
50+
}

src/main/java/com/datadog/api/client/v2/model/RetentionFilterAllAttributes.java

+30-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@
2828
RetentionFilterAllAttributes.JSON_PROPERTY_MODIFIED_AT,
2929
RetentionFilterAllAttributes.JSON_PROPERTY_MODIFIED_BY,
3030
RetentionFilterAllAttributes.JSON_PROPERTY_NAME,
31-
RetentionFilterAllAttributes.JSON_PROPERTY_RATE
31+
RetentionFilterAllAttributes.JSON_PROPERTY_RATE,
32+
RetentionFilterAllAttributes.JSON_PROPERTY_TRACE_RATE
3233
})
3334
@jakarta.annotation.Generated(
3435
value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator")
@@ -67,6 +68,9 @@ public class RetentionFilterAllAttributes {
6768
public static final String JSON_PROPERTY_RATE = "rate";
6869
private Double rate;
6970

71+
public static final String JSON_PROPERTY_TRACE_RATE = "trace_rate";
72+
private Double traceRate;
73+
7074
public RetentionFilterAllAttributes createdAt(Long createdAt) {
7175
this.createdAt = createdAt;
7276
return this;
@@ -304,6 +308,28 @@ public void setRate(Double rate) {
304308
this.rate = rate;
305309
}
306310

311+
public RetentionFilterAllAttributes traceRate(Double traceRate) {
312+
this.traceRate = traceRate;
313+
return this;
314+
}
315+
316+
/**
317+
* Sample rate to apply to traces containing spans going through this retention filter. A value of
318+
* 1.0 keeps all traces with spans matching the query.
319+
*
320+
* @return traceRate
321+
*/
322+
@jakarta.annotation.Nullable
323+
@JsonProperty(JSON_PROPERTY_TRACE_RATE)
324+
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
325+
public Double getTraceRate() {
326+
return traceRate;
327+
}
328+
329+
public void setTraceRate(Double traceRate) {
330+
this.traceRate = traceRate;
331+
}
332+
307333
/**
308334
* A container for additional, undeclared properties. This is a holder for any undeclared
309335
* properties as specified with the 'additionalProperties' keyword in the OAS document.
@@ -371,6 +397,7 @@ public boolean equals(Object o) {
371397
&& Objects.equals(this.modifiedBy, retentionFilterAllAttributes.modifiedBy)
372398
&& Objects.equals(this.name, retentionFilterAllAttributes.name)
373399
&& Objects.equals(this.rate, retentionFilterAllAttributes.rate)
400+
&& Objects.equals(this.traceRate, retentionFilterAllAttributes.traceRate)
374401
&& Objects.equals(
375402
this.additionalProperties, retentionFilterAllAttributes.additionalProperties);
376403
}
@@ -389,6 +416,7 @@ public int hashCode() {
389416
modifiedBy,
390417
name,
391418
rate,
419+
traceRate,
392420
additionalProperties);
393421
}
394422

@@ -407,6 +435,7 @@ public String toString() {
407435
sb.append(" modifiedBy: ").append(toIndentedString(modifiedBy)).append("\n");
408436
sb.append(" name: ").append(toIndentedString(name)).append("\n");
409437
sb.append(" rate: ").append(toIndentedString(rate)).append("\n");
438+
sb.append(" traceRate: ").append(toIndentedString(traceRate)).append("\n");
410439
sb.append(" additionalProperties: ")
411440
.append(toIndentedString(additionalProperties))
412441
.append("\n");

src/main/java/com/datadog/api/client/v2/model/RetentionFilterAttributes.java

+30-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@
2828
RetentionFilterAttributes.JSON_PROPERTY_MODIFIED_AT,
2929
RetentionFilterAttributes.JSON_PROPERTY_MODIFIED_BY,
3030
RetentionFilterAttributes.JSON_PROPERTY_NAME,
31-
RetentionFilterAttributes.JSON_PROPERTY_RATE
31+
RetentionFilterAttributes.JSON_PROPERTY_RATE,
32+
RetentionFilterAttributes.JSON_PROPERTY_TRACE_RATE
3233
})
3334
@jakarta.annotation.Generated(
3435
value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator")
@@ -67,6 +68,9 @@ public class RetentionFilterAttributes {
6768
public static final String JSON_PROPERTY_RATE = "rate";
6869
private Double rate;
6970

71+
public static final String JSON_PROPERTY_TRACE_RATE = "trace_rate";
72+
private Double traceRate;
73+
7074
public RetentionFilterAttributes createdAt(Long createdAt) {
7175
this.createdAt = createdAt;
7276
return this;
@@ -304,6 +308,28 @@ public void setRate(Double rate) {
304308
this.rate = rate;
305309
}
306310

311+
public RetentionFilterAttributes traceRate(Double traceRate) {
312+
this.traceRate = traceRate;
313+
return this;
314+
}
315+
316+
/**
317+
* Sample rate to apply to traces containing spans going through this retention filter. A value of
318+
* 1.0 keeps all traces with spans matching the query.
319+
*
320+
* @return traceRate
321+
*/
322+
@jakarta.annotation.Nullable
323+
@JsonProperty(JSON_PROPERTY_TRACE_RATE)
324+
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
325+
public Double getTraceRate() {
326+
return traceRate;
327+
}
328+
329+
public void setTraceRate(Double traceRate) {
330+
this.traceRate = traceRate;
331+
}
332+
307333
/**
308334
* A container for additional, undeclared properties. This is a holder for any undeclared
309335
* properties as specified with the 'additionalProperties' keyword in the OAS document.
@@ -371,6 +397,7 @@ public boolean equals(Object o) {
371397
&& Objects.equals(this.modifiedBy, retentionFilterAttributes.modifiedBy)
372398
&& Objects.equals(this.name, retentionFilterAttributes.name)
373399
&& Objects.equals(this.rate, retentionFilterAttributes.rate)
400+
&& Objects.equals(this.traceRate, retentionFilterAttributes.traceRate)
374401
&& Objects.equals(
375402
this.additionalProperties, retentionFilterAttributes.additionalProperties);
376403
}
@@ -389,6 +416,7 @@ public int hashCode() {
389416
modifiedBy,
390417
name,
391418
rate,
419+
traceRate,
392420
additionalProperties);
393421
}
394422

@@ -407,6 +435,7 @@ public String toString() {
407435
sb.append(" modifiedBy: ").append(toIndentedString(modifiedBy)).append("\n");
408436
sb.append(" name: ").append(toIndentedString(name)).append("\n");
409437
sb.append(" rate: ").append(toIndentedString(rate)).append("\n");
438+
sb.append(" traceRate: ").append(toIndentedString(traceRate)).append("\n");
410439
sb.append(" additionalProperties: ")
411440
.append(toIndentedString(additionalProperties))
412441
.append("\n");

src/main/java/com/datadog/api/client/v2/model/RetentionFilterCreateAttributes.java

+30-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@
2323
RetentionFilterCreateAttributes.JSON_PROPERTY_FILTER,
2424
RetentionFilterCreateAttributes.JSON_PROPERTY_FILTER_TYPE,
2525
RetentionFilterCreateAttributes.JSON_PROPERTY_NAME,
26-
RetentionFilterCreateAttributes.JSON_PROPERTY_RATE
26+
RetentionFilterCreateAttributes.JSON_PROPERTY_RATE,
27+
RetentionFilterCreateAttributes.JSON_PROPERTY_TRACE_RATE
2728
})
2829
@jakarta.annotation.Generated(
2930
value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator")
@@ -44,6 +45,9 @@ public class RetentionFilterCreateAttributes {
4445
public static final String JSON_PROPERTY_RATE = "rate";
4546
private Double rate;
4647

48+
public static final String JSON_PROPERTY_TRACE_RATE = "trace_rate";
49+
private Double traceRate;
50+
4751
public RetentionFilterCreateAttributes() {}
4852

4953
@JsonCreator
@@ -169,6 +173,28 @@ public void setRate(Double rate) {
169173
this.rate = rate;
170174
}
171175

176+
public RetentionFilterCreateAttributes traceRate(Double traceRate) {
177+
this.traceRate = traceRate;
178+
return this;
179+
}
180+
181+
/**
182+
* Sample rate to apply to traces containing spans going through this retention filter. A value of
183+
* 1.0 keeps all traces with spans matching the query.
184+
*
185+
* @return traceRate
186+
*/
187+
@jakarta.annotation.Nullable
188+
@JsonProperty(JSON_PROPERTY_TRACE_RATE)
189+
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
190+
public Double getTraceRate() {
191+
return traceRate;
192+
}
193+
194+
public void setTraceRate(Double traceRate) {
195+
this.traceRate = traceRate;
196+
}
197+
172198
/**
173199
* A container for additional, undeclared properties. This is a holder for any undeclared
174200
* properties as specified with the 'additionalProperties' keyword in the OAS document.
@@ -231,13 +257,14 @@ public boolean equals(Object o) {
231257
&& Objects.equals(this.filterType, retentionFilterCreateAttributes.filterType)
232258
&& Objects.equals(this.name, retentionFilterCreateAttributes.name)
233259
&& Objects.equals(this.rate, retentionFilterCreateAttributes.rate)
260+
&& Objects.equals(this.traceRate, retentionFilterCreateAttributes.traceRate)
234261
&& Objects.equals(
235262
this.additionalProperties, retentionFilterCreateAttributes.additionalProperties);
236263
}
237264

238265
@Override
239266
public int hashCode() {
240-
return Objects.hash(enabled, filter, filterType, name, rate, additionalProperties);
267+
return Objects.hash(enabled, filter, filterType, name, rate, traceRate, additionalProperties);
241268
}
242269

243270
@Override
@@ -249,6 +276,7 @@ public String toString() {
249276
sb.append(" filterType: ").append(toIndentedString(filterType)).append("\n");
250277
sb.append(" name: ").append(toIndentedString(name)).append("\n");
251278
sb.append(" rate: ").append(toIndentedString(rate)).append("\n");
279+
sb.append(" traceRate: ").append(toIndentedString(traceRate)).append("\n");
252280
sb.append(" additionalProperties: ")
253281
.append(toIndentedString(additionalProperties))
254282
.append("\n");

0 commit comments

Comments
 (0)