Skip to content

Commit

Permalink
Update retention filters public API (#1594)
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
api-clients-generation-pipeline[bot] and ci.datadog-api-spec authored Apr 11, 2024
1 parent dc91a19 commit ac173a4
Show file tree
Hide file tree
Showing 10 changed files with 232 additions and 11 deletions.
8 changes: 4 additions & 4 deletions .apigentools-info
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
"spec_versions": {
"v1": {
"apigentools_version": "1.6.6",
"regenerated": "2024-04-10 19:44:51.330205",
"spec_repo_commit": "3fb610b5"
"regenerated": "2024-04-11 15:35:24.319441",
"spec_repo_commit": "8ffb168c"
},
"v2": {
"apigentools_version": "1.6.6",
"regenerated": "2024-04-10 19:44:51.348296",
"spec_repo_commit": "3fb610b5"
"regenerated": "2024-04-11 15:35:24.337042",
"spec_repo_commit": "8ffb168c"
}
}
}
52 changes: 48 additions & 4 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16072,6 +16072,7 @@ components:
- spans-sampling-processor
- spans-errors-sampling-processor
- spans-appsec-sampling-processor
example: spans-sampling-processor
type: string
x-enum-varnames:
- SPANS_SAMPLING_PROCESSOR
Expand Down Expand Up @@ -16188,11 +16189,42 @@ components:
type: string
x-enum-varnames:
- SPANS_SAMPLING_PROCESSOR
RetentionFilterUpdateAttributes:
description: The object describing the configuration of the retention filter
to create/update.
properties:
enabled:
description: Enable/Disable the retention filter.
example: true
type: boolean
filter:
$ref: '#/components/schemas/SpansFilterCreate'
filter_type:
$ref: '#/components/schemas/RetentionFilterAllType'
name:
description: The name of the retention filter.
example: my retention filter
type: string
rate:
description: 'Sample rate to apply to spans going through this retention
filter,

a value of 1.0 keeps all spans matching the query.'
example: 1.0
format: double
type: number
required:
- name
- filter
- enabled
- filter_type
- rate
type: object
RetentionFilterUpdateData:
description: The body of the retention filter to be updated.
properties:
attributes:
$ref: '#/components/schemas/RetentionFilterCreateAttributes'
$ref: '#/components/schemas/RetentionFilterUpdateAttributes'
id:
description: The ID of the retention filter.
example: retention-filter-id
Expand Down Expand Up @@ -23271,7 +23303,11 @@ paths:
post:
description: 'Create a retention filter to index spans in your organization.

Returns the retention filter definition when the request is successful.'
Returns the retention filter definition when the request is successful.


Default filters with types spans-errors-sampling-processor and spans-appsec-sampling-processor
cannot be created.'
operationId: CreateApmRetentionFilter
requestBody:
content:
Expand Down Expand Up @@ -23325,7 +23361,11 @@ paths:
x-codegen-request-body-name: body
/api/v2/apm/config/retention-filters/{filter_id}:
delete:
description: Delete a specific retention filter from your organization.
description: 'Delete a specific retention filter from your organization.


Default filters with types spans-errors-sampling-processor and spans-appsec-sampling-processor
cannot be deleted.'
operationId: DeleteApmRetentionFilter
parameters:
- $ref: '#/components/parameters/RetentionFilterIdParam'
Expand Down Expand Up @@ -23363,7 +23403,11 @@ paths:
tags:
- APM Retention Filters
put:
description: Update a retention filter from your organization.
description: 'Update a retention filter from your organization.


Default filters (filters with types spans-errors-sampling-processor and spans-appsec-sampling-processor)
cannot be renamed or removed.'
operationId: UpdateApmRetentionFilter
parameters:
- $ref: '#/components/parameters/RetentionFilterIdParam'
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"2024-04-10T12:31:19.300Z"
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
{
"log": {
"_recordingName": "APM Retention Filters/Create a default retention filter returns \"Bad Request\" response",
"creator": {
"comment": "persister:fs",
"name": "Polly.JS",
"version": "6.0.5"
},
"entries": [
{
"_id": "23cb9ef503c91078cfb54a6f43add906",
"_order": 0,
"cache": {},
"request": {
"bodySize": 218,
"cookies": [],
"headers": [
{
"_fromType": "array",
"name": "accept",
"value": "application/json"
},
{
"_fromType": "array",
"name": "content-type",
"value": "application/json"
}
],
"headersSize": 587,
"httpVersion": "HTTP/1.1",
"method": "POST",
"postData": {
"mimeType": "application/json",
"params": [],
"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\"}}"
},
"queryString": [],
"url": "https://api.datadoghq.com/api/v2/apm/config/retention-filters"
},
"response": {
"bodySize": 91,
"content": {
"mimeType": "application/json",
"size": 91,
"text": "{\"errors\":[\"Field 'filter_type' is invalid, expected value is 'spans-sampling-processor'\"]}"
},
"cookies": [],
"headers": [
{
"name": "content-type",
"value": "application/json"
}
],
"headersSize": 516,
"httpVersion": "HTTP/1.1",
"redirectURL": "",
"status": 400,
"statusText": "Bad Request"
},
"startedDateTime": "2024-04-10T12:31:19.304Z",
"time": 436
}
],
"pages": [],
"version": "1.2"
}
}
7 changes: 7 additions & 0 deletions features/v2/apm_retention_filters.feature
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@ Feature: APM Retention Filters
And a valid "appKeyAuth" key in the system
And an instance of "APMRetentionFilters" API

@team:DataDog/apm-trace-intake
Scenario: Create a default retention filter returns "Bad Request" response
Given new "CreateApmRetentionFilter" request
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"}}
When the request is sent
Then the response status is 400 Bad Request

@team:DataDog/apm-trace-intake
Scenario: Create a retention filter returns "Bad Request" response
Given new "CreateApmRetentionFilter" request
Expand Down
6 changes: 6 additions & 0 deletions packages/datadog-api-client-v2/apis/APMRetentionFiltersApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -679,6 +679,8 @@ export class APMRetentionFiltersApi {
/**
* Create a retention filter to index spans in your organization.
* Returns the retention filter definition when the request is successful.
*
* Default filters with types spans-errors-sampling-processor and spans-appsec-sampling-processor cannot be created.
* @param param The request object
*/
public createApmRetentionFilter(
Expand All @@ -702,6 +704,8 @@ export class APMRetentionFiltersApi {

/**
* Delete a specific retention filter from your organization.
*
* Default filters with types spans-errors-sampling-processor and spans-appsec-sampling-processor cannot be deleted.
* @param param The request object
*/
public deleteApmRetentionFilter(
Expand Down Expand Up @@ -787,6 +791,8 @@ export class APMRetentionFiltersApi {

/**
* Update a retention filter from your organization.
*
* Default filters (filters with types spans-errors-sampling-processor and spans-appsec-sampling-processor) cannot be renamed or removed.
* @param param The request object
*/
public updateApmRetentionFilter(
Expand Down
1 change: 1 addition & 0 deletions packages/datadog-api-client-v2/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1480,6 +1480,7 @@ export { RetentionFilterCreateRequest } from "./models/RetentionFilterCreateRequ
export { RetentionFilterResponse } from "./models/RetentionFilterResponse";
export { RetentionFiltersResponse } from "./models/RetentionFiltersResponse";
export { RetentionFilterType } from "./models/RetentionFilterType";
export { RetentionFilterUpdateAttributes } from "./models/RetentionFilterUpdateAttributes";
export { RetentionFilterUpdateData } from "./models/RetentionFilterUpdateData";
export { RetentionFilterUpdateRequest } from "./models/RetentionFilterUpdateRequest";
export { RetentionFilterWithoutAttributes } from "./models/RetentionFilterWithoutAttributes";
Expand Down
2 changes: 2 additions & 0 deletions packages/datadog-api-client-v2/models/ObjectSerializer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -791,6 +791,7 @@ import { RetentionFilterCreateAttributes } from "./RetentionFilterCreateAttribut
import { RetentionFilterCreateData } from "./RetentionFilterCreateData";
import { RetentionFilterCreateRequest } from "./RetentionFilterCreateRequest";
import { RetentionFilterResponse } from "./RetentionFilterResponse";
import { RetentionFilterUpdateAttributes } from "./RetentionFilterUpdateAttributes";
import { RetentionFilterUpdateData } from "./RetentionFilterUpdateData";
import { RetentionFilterUpdateRequest } from "./RetentionFilterUpdateRequest";
import { RetentionFilterWithoutAttributes } from "./RetentionFilterWithoutAttributes";
Expand Down Expand Up @@ -2584,6 +2585,7 @@ const typeMap: { [index: string]: any } = {
RetentionFilterCreateData: RetentionFilterCreateData,
RetentionFilterCreateRequest: RetentionFilterCreateRequest,
RetentionFilterResponse: RetentionFilterResponse,
RetentionFilterUpdateAttributes: RetentionFilterUpdateAttributes,
RetentionFilterUpdateData: RetentionFilterUpdateData,
RetentionFilterUpdateRequest: RetentionFilterUpdateRequest,
RetentionFilterWithoutAttributes: RetentionFilterWithoutAttributes,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
/**
* 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 2020-Present Datadog, Inc.
*/
import { RetentionFilterAllType } from "./RetentionFilterAllType";
import { SpansFilterCreate } from "./SpansFilterCreate";

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

/**
* The object describing the configuration of the retention filter to create/update.
*/
export class RetentionFilterUpdateAttributes {
/**
* Enable/Disable the retention filter.
*/
"enabled": boolean;
/**
* The spans filter. Spans matching this filter will be indexed and stored.
*/
"filter": SpansFilterCreate;
/**
* The type of retention filter.
*/
"filterType": RetentionFilterAllType;
/**
* The name of the retention filter.
*/
"name": string;
/**
* Sample rate to apply to spans going through this retention filter,
* a value of 1.0 keeps all spans matching the query.
*/
"rate": number;

/**
* A container for additional, undeclared properties.
* This is a holder for any undeclared properties as specified with
* the 'additionalProperties' keyword in the OAS document.
*/
"additionalProperties"?: { [key: string]: any };

/**
* @ignore
*/
"_unparsed"?: boolean;

/**
* @ignore
*/
static readonly attributeTypeMap: AttributeTypeMap = {
enabled: {
baseName: "enabled",
type: "boolean",
required: true,
},
filter: {
baseName: "filter",
type: "SpansFilterCreate",
required: true,
},
filterType: {
baseName: "filter_type",
type: "RetentionFilterAllType",
required: true,
},
name: {
baseName: "name",
type: "string",
required: true,
},
rate: {
baseName: "rate",
type: "number",
required: true,
format: "double",
},
additionalProperties: {
baseName: "additionalProperties",
type: "any",
},
};

/**
* @ignore
*/
static getAttributeTypeMap(): AttributeTypeMap {
return RetentionFilterUpdateAttributes.attributeTypeMap;
}

public constructor() {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Copyright 2020-Present Datadog, Inc.
*/
import { ApmRetentionFilterType } from "./ApmRetentionFilterType";
import { RetentionFilterCreateAttributes } from "./RetentionFilterCreateAttributes";
import { RetentionFilterUpdateAttributes } from "./RetentionFilterUpdateAttributes";

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

Expand All @@ -15,7 +15,7 @@ export class RetentionFilterUpdateData {
/**
* The object describing the configuration of the retention filter to create/update.
*/
"attributes": RetentionFilterCreateAttributes;
"attributes": RetentionFilterUpdateAttributes;
/**
* The ID of the retention filter.
*/
Expand Down Expand Up @@ -43,7 +43,7 @@ export class RetentionFilterUpdateData {
static readonly attributeTypeMap: AttributeTypeMap = {
attributes: {
baseName: "attributes",
type: "RetentionFilterCreateAttributes",
type: "RetentionFilterUpdateAttributes",
required: true,
},
id: {
Expand Down

0 comments on commit ac173a4

Please sign in to comment.