Skip to content

Commit ac173a4

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
and
ci.datadog-api-spec
authored
Update retention filters public API (#1594)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com> Co-authored-by: api-clients-generation-pipeline[bot] <54105614+api-clients-generation-pipeline[bot]@users.noreply.github.com>
1 parent dc91a19 commit ac173a4

File tree

10 files changed

+232
-11
lines changed

10 files changed

+232
-11
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": "2024-04-10 19:44:51.330205",
8-
"spec_repo_commit": "3fb610b5"
7+
"regenerated": "2024-04-11 15:35:24.319441",
8+
"spec_repo_commit": "8ffb168c"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.6",
12-
"regenerated": "2024-04-10 19:44:51.348296",
13-
"spec_repo_commit": "3fb610b5"
12+
"regenerated": "2024-04-11 15:35:24.337042",
13+
"spec_repo_commit": "8ffb168c"
1414
}
1515
}
1616
}

.generator/schemas/v2/openapi.yaml

Lines changed: 48 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16072,6 +16072,7 @@ components:
1607216072
- spans-sampling-processor
1607316073
- spans-errors-sampling-processor
1607416074
- spans-appsec-sampling-processor
16075+
example: spans-sampling-processor
1607516076
type: string
1607616077
x-enum-varnames:
1607716078
- SPANS_SAMPLING_PROCESSOR
@@ -16188,11 +16189,42 @@ components:
1618816189
type: string
1618916190
x-enum-varnames:
1619016191
- SPANS_SAMPLING_PROCESSOR
16192+
RetentionFilterUpdateAttributes:
16193+
description: The object describing the configuration of the retention filter
16194+
to create/update.
16195+
properties:
16196+
enabled:
16197+
description: Enable/Disable the retention filter.
16198+
example: true
16199+
type: boolean
16200+
filter:
16201+
$ref: '#/components/schemas/SpansFilterCreate'
16202+
filter_type:
16203+
$ref: '#/components/schemas/RetentionFilterAllType'
16204+
name:
16205+
description: The name of the retention filter.
16206+
example: my retention filter
16207+
type: string
16208+
rate:
16209+
description: 'Sample rate to apply to spans going through this retention
16210+
filter,
16211+
16212+
a value of 1.0 keeps all spans matching the query.'
16213+
example: 1.0
16214+
format: double
16215+
type: number
16216+
required:
16217+
- name
16218+
- filter
16219+
- enabled
16220+
- filter_type
16221+
- rate
16222+
type: object
1619116223
RetentionFilterUpdateData:
1619216224
description: The body of the retention filter to be updated.
1619316225
properties:
1619416226
attributes:
16195-
$ref: '#/components/schemas/RetentionFilterCreateAttributes'
16227+
$ref: '#/components/schemas/RetentionFilterUpdateAttributes'
1619616228
id:
1619716229
description: The ID of the retention filter.
1619816230
example: retention-filter-id
@@ -23271,7 +23303,11 @@ paths:
2327123303
post:
2327223304
description: 'Create a retention filter to index spans in your organization.
2327323305

23274-
Returns the retention filter definition when the request is successful.'
23306+
Returns the retention filter definition when the request is successful.
23307+
23308+
23309+
Default filters with types spans-errors-sampling-processor and spans-appsec-sampling-processor
23310+
cannot be created.'
2327523311
operationId: CreateApmRetentionFilter
2327623312
requestBody:
2327723313
content:
@@ -23325,7 +23361,11 @@ paths:
2332523361
x-codegen-request-body-name: body
2332623362
/api/v2/apm/config/retention-filters/{filter_id}:
2332723363
delete:
23328-
description: Delete a specific retention filter from your organization.
23364+
description: 'Delete a specific retention filter from your organization.
23365+
23366+
23367+
Default filters with types spans-errors-sampling-processor and spans-appsec-sampling-processor
23368+
cannot be deleted.'
2332923369
operationId: DeleteApmRetentionFilter
2333023370
parameters:
2333123371
- $ref: '#/components/parameters/RetentionFilterIdParam'
@@ -23363,7 +23403,11 @@ paths:
2336323403
tags:
2336423404
- APM Retention Filters
2336523405
put:
23366-
description: Update a retention filter from your organization.
23406+
description: 'Update a retention filter from your organization.
23407+
23408+
23409+
Default filters (filters with types spans-errors-sampling-processor and spans-appsec-sampling-processor)
23410+
cannot be renamed or removed.'
2336723411
operationId: UpdateApmRetentionFilter
2336823412
parameters:
2336923413
- $ref: '#/components/parameters/RetentionFilterIdParam'
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"2024-04-10T12:31:19.300Z"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
{
2+
"log": {
3+
"_recordingName": "APM Retention Filters/Create a default retention filter returns \"Bad Request\" response",
4+
"creator": {
5+
"comment": "persister:fs",
6+
"name": "Polly.JS",
7+
"version": "6.0.5"
8+
},
9+
"entries": [
10+
{
11+
"_id": "23cb9ef503c91078cfb54a6f43add906",
12+
"_order": 0,
13+
"cache": {},
14+
"request": {
15+
"bodySize": 218,
16+
"cookies": [],
17+
"headers": [
18+
{
19+
"_fromType": "array",
20+
"name": "accept",
21+
"value": "application/json"
22+
},
23+
{
24+
"_fromType": "array",
25+
"name": "content-type",
26+
"value": "application/json"
27+
}
28+
],
29+
"headersSize": 587,
30+
"httpVersion": "HTTP/1.1",
31+
"method": "POST",
32+
"postData": {
33+
"mimeType": "application/json",
34+
"params": [],
35+
"text": "{\"data\":{\"attributes\":{\"enabled\":true,\"filter\":{\"query\":\"@http.status_code:200 service:my-service\"},\"filter_type\":\"spans-errors-sampling-processor\",\"name\":\"my retention filter\",\"rate\":1},\"type\":\"apm_retention_filter\"}}"
36+
},
37+
"queryString": [],
38+
"url": "https://api.datadoghq.com/api/v2/apm/config/retention-filters"
39+
},
40+
"response": {
41+
"bodySize": 91,
42+
"content": {
43+
"mimeType": "application/json",
44+
"size": 91,
45+
"text": "{\"errors\":[\"Field 'filter_type' is invalid, expected value is 'spans-sampling-processor'\"]}"
46+
},
47+
"cookies": [],
48+
"headers": [
49+
{
50+
"name": "content-type",
51+
"value": "application/json"
52+
}
53+
],
54+
"headersSize": 516,
55+
"httpVersion": "HTTP/1.1",
56+
"redirectURL": "",
57+
"status": 400,
58+
"statusText": "Bad Request"
59+
},
60+
"startedDateTime": "2024-04-10T12:31:19.304Z",
61+
"time": 436
62+
}
63+
],
64+
"pages": [],
65+
"version": "1.2"
66+
}
67+
}

features/v2/apm_retention_filters.feature

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,13 @@ Feature: APM Retention Filters
1212
And a valid "appKeyAuth" key in the system
1313
And an instance of "APMRetentionFilters" API
1414

15+
@team:DataDog/apm-trace-intake
16+
Scenario: Create a default retention filter returns "Bad Request" response
17+
Given new "CreateApmRetentionFilter" request
18+
And body with value {"data": {"attributes": {"enabled": true, "filter": {"query": "@http.status_code:200 service:my-service"}, "filter_type": "spans-errors-sampling-processor", "name": "my retention filter", "rate": 1.0}, "type": "apm_retention_filter"}}
19+
When the request is sent
20+
Then the response status is 400 Bad Request
21+
1522
@team:DataDog/apm-trace-intake
1623
Scenario: Create a retention filter returns "Bad Request" response
1724
Given new "CreateApmRetentionFilter" request

packages/datadog-api-client-v2/apis/APMRetentionFiltersApi.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -679,6 +679,8 @@ export class APMRetentionFiltersApi {
679679
/**
680680
* Create a retention filter to index spans in your organization.
681681
* Returns the retention filter definition when the request is successful.
682+
*
683+
* Default filters with types spans-errors-sampling-processor and spans-appsec-sampling-processor cannot be created.
682684
* @param param The request object
683685
*/
684686
public createApmRetentionFilter(
@@ -702,6 +704,8 @@ export class APMRetentionFiltersApi {
702704

703705
/**
704706
* Delete a specific retention filter from your organization.
707+
*
708+
* Default filters with types spans-errors-sampling-processor and spans-appsec-sampling-processor cannot be deleted.
705709
* @param param The request object
706710
*/
707711
public deleteApmRetentionFilter(
@@ -787,6 +791,8 @@ export class APMRetentionFiltersApi {
787791

788792
/**
789793
* Update a retention filter from your organization.
794+
*
795+
* Default filters (filters with types spans-errors-sampling-processor and spans-appsec-sampling-processor) cannot be renamed or removed.
790796
* @param param The request object
791797
*/
792798
public updateApmRetentionFilter(

packages/datadog-api-client-v2/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1480,6 +1480,7 @@ export { RetentionFilterCreateRequest } from "./models/RetentionFilterCreateRequ
14801480
export { RetentionFilterResponse } from "./models/RetentionFilterResponse";
14811481
export { RetentionFiltersResponse } from "./models/RetentionFiltersResponse";
14821482
export { RetentionFilterType } from "./models/RetentionFilterType";
1483+
export { RetentionFilterUpdateAttributes } from "./models/RetentionFilterUpdateAttributes";
14831484
export { RetentionFilterUpdateData } from "./models/RetentionFilterUpdateData";
14841485
export { RetentionFilterUpdateRequest } from "./models/RetentionFilterUpdateRequest";
14851486
export { RetentionFilterWithoutAttributes } from "./models/RetentionFilterWithoutAttributes";

packages/datadog-api-client-v2/models/ObjectSerializer.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -791,6 +791,7 @@ import { RetentionFilterCreateAttributes } from "./RetentionFilterCreateAttribut
791791
import { RetentionFilterCreateData } from "./RetentionFilterCreateData";
792792
import { RetentionFilterCreateRequest } from "./RetentionFilterCreateRequest";
793793
import { RetentionFilterResponse } from "./RetentionFilterResponse";
794+
import { RetentionFilterUpdateAttributes } from "./RetentionFilterUpdateAttributes";
794795
import { RetentionFilterUpdateData } from "./RetentionFilterUpdateData";
795796
import { RetentionFilterUpdateRequest } from "./RetentionFilterUpdateRequest";
796797
import { RetentionFilterWithoutAttributes } from "./RetentionFilterWithoutAttributes";
@@ -2584,6 +2585,7 @@ const typeMap: { [index: string]: any } = {
25842585
RetentionFilterCreateData: RetentionFilterCreateData,
25852586
RetentionFilterCreateRequest: RetentionFilterCreateRequest,
25862587
RetentionFilterResponse: RetentionFilterResponse,
2588+
RetentionFilterUpdateAttributes: RetentionFilterUpdateAttributes,
25872589
RetentionFilterUpdateData: RetentionFilterUpdateData,
25882590
RetentionFilterUpdateRequest: RetentionFilterUpdateRequest,
25892591
RetentionFilterWithoutAttributes: RetentionFilterWithoutAttributes,
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
/**
2+
* Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
3+
* This product includes software developed at Datadog (https://www.datadoghq.com/).
4+
* Copyright 2020-Present Datadog, Inc.
5+
*/
6+
import { RetentionFilterAllType } from "./RetentionFilterAllType";
7+
import { SpansFilterCreate } from "./SpansFilterCreate";
8+
9+
import { AttributeTypeMap } from "../../datadog-api-client-common/util";
10+
11+
/**
12+
* The object describing the configuration of the retention filter to create/update.
13+
*/
14+
export class RetentionFilterUpdateAttributes {
15+
/**
16+
* Enable/Disable the retention filter.
17+
*/
18+
"enabled": boolean;
19+
/**
20+
* The spans filter. Spans matching this filter will be indexed and stored.
21+
*/
22+
"filter": SpansFilterCreate;
23+
/**
24+
* The type of retention filter.
25+
*/
26+
"filterType": RetentionFilterAllType;
27+
/**
28+
* The name of the retention filter.
29+
*/
30+
"name": string;
31+
/**
32+
* Sample rate to apply to spans going through this retention filter,
33+
* a value of 1.0 keeps all spans matching the query.
34+
*/
35+
"rate": number;
36+
37+
/**
38+
* A container for additional, undeclared properties.
39+
* This is a holder for any undeclared properties as specified with
40+
* the 'additionalProperties' keyword in the OAS document.
41+
*/
42+
"additionalProperties"?: { [key: string]: any };
43+
44+
/**
45+
* @ignore
46+
*/
47+
"_unparsed"?: boolean;
48+
49+
/**
50+
* @ignore
51+
*/
52+
static readonly attributeTypeMap: AttributeTypeMap = {
53+
enabled: {
54+
baseName: "enabled",
55+
type: "boolean",
56+
required: true,
57+
},
58+
filter: {
59+
baseName: "filter",
60+
type: "SpansFilterCreate",
61+
required: true,
62+
},
63+
filterType: {
64+
baseName: "filter_type",
65+
type: "RetentionFilterAllType",
66+
required: true,
67+
},
68+
name: {
69+
baseName: "name",
70+
type: "string",
71+
required: true,
72+
},
73+
rate: {
74+
baseName: "rate",
75+
type: "number",
76+
required: true,
77+
format: "double",
78+
},
79+
additionalProperties: {
80+
baseName: "additionalProperties",
81+
type: "any",
82+
},
83+
};
84+
85+
/**
86+
* @ignore
87+
*/
88+
static getAttributeTypeMap(): AttributeTypeMap {
89+
return RetentionFilterUpdateAttributes.attributeTypeMap;
90+
}
91+
92+
public constructor() {}
93+
}

packages/datadog-api-client-v2/models/RetentionFilterUpdateData.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* Copyright 2020-Present Datadog, Inc.
55
*/
66
import { ApmRetentionFilterType } from "./ApmRetentionFilterType";
7-
import { RetentionFilterCreateAttributes } from "./RetentionFilterCreateAttributes";
7+
import { RetentionFilterUpdateAttributes } from "./RetentionFilterUpdateAttributes";
88

99
import { AttributeTypeMap } from "../../datadog-api-client-common/util";
1010

@@ -15,7 +15,7 @@ export class RetentionFilterUpdateData {
1515
/**
1616
* The object describing the configuration of the retention filter to create/update.
1717
*/
18-
"attributes": RetentionFilterCreateAttributes;
18+
"attributes": RetentionFilterUpdateAttributes;
1919
/**
2020
* The ID of the retention filter.
2121
*/
@@ -43,7 +43,7 @@ export class RetentionFilterUpdateData {
4343
static readonly attributeTypeMap: AttributeTypeMap = {
4444
attributes: {
4545
baseName: "attributes",
46-
type: "RetentionFilterCreateAttributes",
46+
type: "RetentionFilterUpdateAttributes",
4747
required: true,
4848
},
4949
id: {

0 commit comments

Comments
 (0)