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
1,032 changes: 1,032 additions & 0 deletions .generator/schemas/v2/openapi.yaml

Large diffs are not rendered by default.

167 changes: 167 additions & 0 deletions features/v2/rum_user_segments.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
@endpoint(rum-user-segments) @endpoint(rum-user-segments-v2)
Feature: RUM User Segments
Manage RUM user segments for audience targeting and analysis.

Background:
Given a valid "apiKeyAuth" key in the system
And a valid "appKeyAuth" key in the system
And an instance of "RUMUserSegments" API

@generated @skip @team:DataDog/product-analytics-backend
Scenario: Create a RUM segment returns "Bad Request" response
Given operation "CreateRumSegment" enabled
And new "CreateRumSegment" request
And body with value {"data": {"attributes": {"data_query": {"combination": "(logs && apm_home) && NOT(apm_trace)", "event_platforms": [{"facet": "@usr.id", "from": 1709888355000, "name": "logs", "query": "@type:view @view.url_path:/logs", "to": 1710493155000}], "journeys": [{"conversion_type": "any", "group_by": "@usr.id", "name": "my_journey", "search": "@type:view"}], "reference_tables": [{"columns": [{"name": "user_id"}], "filter_query": "", "join_condition": {"column_name": "user_id", "facet": "@usr.id"}, "name": "my_ref_table", "table_name": "my_table"}], "static": [{"id": "static-list-1", "name": "My Static List", "user_count": 500}], "templates": [{"from": 1709888355000, "parameters": {"threshold": "5"}, "template_id": "stickiness-v1", "to": 1710493155000}]}, "description": "Users who visited the homepage.", "name": "My Segment", "tags": ["team:frontend"]}, "type": "segment"}}
When the request is sent
Then the response status is 400 Bad Request

@generated @skip @team:DataDog/product-analytics-backend
Scenario: Create a RUM segment returns "Conflict" response
Given operation "CreateRumSegment" enabled
And new "CreateRumSegment" request
And body with value {"data": {"attributes": {"data_query": {"combination": "(logs && apm_home) && NOT(apm_trace)", "event_platforms": [{"facet": "@usr.id", "from": 1709888355000, "name": "logs", "query": "@type:view @view.url_path:/logs", "to": 1710493155000}], "journeys": [{"conversion_type": "any", "group_by": "@usr.id", "name": "my_journey", "search": "@type:view"}], "reference_tables": [{"columns": [{"name": "user_id"}], "filter_query": "", "join_condition": {"column_name": "user_id", "facet": "@usr.id"}, "name": "my_ref_table", "table_name": "my_table"}], "static": [{"id": "static-list-1", "name": "My Static List", "user_count": 500}], "templates": [{"from": 1709888355000, "parameters": {"threshold": "5"}, "template_id": "stickiness-v1", "to": 1710493155000}]}, "description": "Users who visited the homepage.", "name": "My Segment", "tags": ["team:frontend"]}, "type": "segment"}}
When the request is sent
Then the response status is 409 Conflict

@generated @skip @team:DataDog/product-analytics-backend
Scenario: Create a RUM segment returns "Created" response
Given operation "CreateRumSegment" enabled
And new "CreateRumSegment" request
And body with value {"data": {"attributes": {"data_query": {"combination": "(logs && apm_home) && NOT(apm_trace)", "event_platforms": [{"facet": "@usr.id", "from": 1709888355000, "name": "logs", "query": "@type:view @view.url_path:/logs", "to": 1710493155000}], "journeys": [{"conversion_type": "any", "group_by": "@usr.id", "name": "my_journey", "search": "@type:view"}], "reference_tables": [{"columns": [{"name": "user_id"}], "filter_query": "", "join_condition": {"column_name": "user_id", "facet": "@usr.id"}, "name": "my_ref_table", "table_name": "my_table"}], "static": [{"id": "static-list-1", "name": "My Static List", "user_count": 500}], "templates": [{"from": 1709888355000, "parameters": {"threshold": "5"}, "template_id": "stickiness-v1", "to": 1710493155000}]}, "description": "Users who visited the homepage.", "name": "My Segment", "tags": ["team:frontend"]}, "type": "segment"}}
When the request is sent
Then the response status is 201 Created

@generated @skip @team:DataDog/product-analytics-backend
Scenario: Create a static RUM segment returns "Bad Request" response
Given operation "CreateRumStaticSegment" enabled
And new "CreateRumStaticSegment" request
And body with value {"data": {"attributes": {"description": "Users from a specific journey.", "journey_query_object": {"nodes": [{"filters": [{"attribute": "@type", "value": "view"}]}]}, "name": "My Static Segment", "tags": ["team:frontend"]}, "type": "create_static_segment_request"}}
When the request is sent
Then the response status is 400 Bad Request

@generated @skip @team:DataDog/product-analytics-backend
Scenario: Create a static RUM segment returns "Conflict" response
Given operation "CreateRumStaticSegment" enabled
And new "CreateRumStaticSegment" request
And body with value {"data": {"attributes": {"description": "Users from a specific journey.", "journey_query_object": {"nodes": [{"filters": [{"attribute": "@type", "value": "view"}]}]}, "name": "My Static Segment", "tags": ["team:frontend"]}, "type": "create_static_segment_request"}}
When the request is sent
Then the response status is 409 Conflict

@generated @skip @team:DataDog/product-analytics-backend
Scenario: Create a static RUM segment returns "Created" response
Given operation "CreateRumStaticSegment" enabled
And new "CreateRumStaticSegment" request
And body with value {"data": {"attributes": {"description": "Users from a specific journey.", "journey_query_object": {"nodes": [{"filters": [{"attribute": "@type", "value": "view"}]}]}, "name": "My Static Segment", "tags": ["team:frontend"]}, "type": "create_static_segment_request"}}
When the request is sent
Then the response status is 201 Created

@generated @skip @team:DataDog/product-analytics-backend
Scenario: Delete a RUM segment returns "Not Found" response
Given operation "DeleteRumSegment" enabled
And new "DeleteRumSegment" request
And request contains "segment_id" parameter from "REPLACE.ME"
When the request is sent
Then the response status is 404 Not Found

@generated @skip @team:DataDog/product-analytics-backend
Scenario: Delete a RUM segment returns "OK" response
Given operation "DeleteRumSegment" enabled
And new "DeleteRumSegment" request
And request contains "segment_id" parameter from "REPLACE.ME"
When the request is sent
Then the response status is 200 OK

@generated @skip @team:DataDog/product-analytics-backend
Scenario: Get a RUM segment returns "Bad Request" response
Given operation "GetRumSegment" enabled
And new "GetRumSegment" request
And request contains "segment_id" parameter from "REPLACE.ME"
When the request is sent
Then the response status is 400 Bad Request

@generated @skip @team:DataDog/product-analytics-backend
Scenario: Get a RUM segment returns "Not Found" response
Given operation "GetRumSegment" enabled
And new "GetRumSegment" request
And request contains "segment_id" parameter from "REPLACE.ME"
When the request is sent
Then the response status is 404 Not Found

@generated @skip @team:DataDog/product-analytics-backend
Scenario: Get a RUM segment returns "OK" response
Given operation "GetRumSegment" enabled
And new "GetRumSegment" request
And request contains "segment_id" parameter from "REPLACE.ME"
When the request is sent
Then the response status is 200 OK

@generated @skip @team:DataDog/product-analytics-backend
Scenario: Initialize RUM segments returns "OK" response
Given operation "InitializeRumSegments" enabled
And new "InitializeRumSegments" request
When the request is sent
Then the response status is 200 OK

@generated @skip @team:DataDog/product-analytics-backend
Scenario: List RUM segment templates returns "Bad Request" response
Given operation "ListRumSegmentTemplates" enabled
And new "ListRumSegmentTemplates" request
When the request is sent
Then the response status is 400 Bad Request

@generated @skip @team:DataDog/product-analytics-backend
Scenario: List RUM segment templates returns "OK" response
Given operation "ListRumSegmentTemplates" enabled
And new "ListRumSegmentTemplates" request
When the request is sent
Then the response status is 200 OK

@generated @skip @team:DataDog/product-analytics-backend
Scenario: List all RUM segments returns "Bad Request" response
Given operation "ListRumSegments" enabled
And new "ListRumSegments" request
When the request is sent
Then the response status is 400 Bad Request

@generated @skip @team:DataDog/product-analytics-backend
Scenario: List all RUM segments returns "OK" response
Given operation "ListRumSegments" enabled
And new "ListRumSegments" request
When the request is sent
Then the response status is 200 OK

@generated @skip @team:DataDog/product-analytics-backend
Scenario: Update a RUM segment returns "Bad Request" response
Given operation "UpdateRumSegment" enabled
And new "UpdateRumSegment" request
And request contains "segment_id" parameter from "REPLACE.ME"
And body with value {"data": {"attributes": {"data_query": {"combination": "(logs && apm_home) && NOT(apm_trace)", "event_platforms": [{"facet": "@usr.id", "from": 1709888355000, "name": "logs", "query": "@type:view @view.url_path:/logs", "to": 1710493155000}], "journeys": [{"conversion_type": "any", "group_by": "@usr.id", "name": "my_journey", "search": "@type:view"}], "reference_tables": [{"columns": [{"name": "user_id"}], "filter_query": "", "join_condition": {"column_name": "user_id", "facet": "@usr.id"}, "name": "my_ref_table", "table_name": "my_table"}], "static": [{"id": "static-list-1", "name": "My Static List", "user_count": 500}], "templates": [{"from": 1709888355000, "parameters": {"threshold": "5"}, "template_id": "stickiness-v1", "to": 1710493155000}]}, "description": "Updated description.", "name": "Updated Segment Name", "tags": ["team:backend"]}, "id": "a1b2c3d4-1234-5678-9abc-123456789abc", "type": "segment"}}
When the request is sent
Then the response status is 400 Bad Request

@generated @skip @team:DataDog/product-analytics-backend
Scenario: Update a RUM segment returns "Conflict" response
Given operation "UpdateRumSegment" enabled
And new "UpdateRumSegment" request
And request contains "segment_id" parameter from "REPLACE.ME"
And body with value {"data": {"attributes": {"data_query": {"combination": "(logs && apm_home) && NOT(apm_trace)", "event_platforms": [{"facet": "@usr.id", "from": 1709888355000, "name": "logs", "query": "@type:view @view.url_path:/logs", "to": 1710493155000}], "journeys": [{"conversion_type": "any", "group_by": "@usr.id", "name": "my_journey", "search": "@type:view"}], "reference_tables": [{"columns": [{"name": "user_id"}], "filter_query": "", "join_condition": {"column_name": "user_id", "facet": "@usr.id"}, "name": "my_ref_table", "table_name": "my_table"}], "static": [{"id": "static-list-1", "name": "My Static List", "user_count": 500}], "templates": [{"from": 1709888355000, "parameters": {"threshold": "5"}, "template_id": "stickiness-v1", "to": 1710493155000}]}, "description": "Updated description.", "name": "Updated Segment Name", "tags": ["team:backend"]}, "id": "a1b2c3d4-1234-5678-9abc-123456789abc", "type": "segment"}}
When the request is sent
Then the response status is 409 Conflict

@generated @skip @team:DataDog/product-analytics-backend
Scenario: Update a RUM segment returns "No Content" response
Given operation "UpdateRumSegment" enabled
And new "UpdateRumSegment" request
And request contains "segment_id" parameter from "REPLACE.ME"
And body with value {"data": {"attributes": {"data_query": {"combination": "(logs && apm_home) && NOT(apm_trace)", "event_platforms": [{"facet": "@usr.id", "from": 1709888355000, "name": "logs", "query": "@type:view @view.url_path:/logs", "to": 1710493155000}], "journeys": [{"conversion_type": "any", "group_by": "@usr.id", "name": "my_journey", "search": "@type:view"}], "reference_tables": [{"columns": [{"name": "user_id"}], "filter_query": "", "join_condition": {"column_name": "user_id", "facet": "@usr.id"}, "name": "my_ref_table", "table_name": "my_table"}], "static": [{"id": "static-list-1", "name": "My Static List", "user_count": 500}], "templates": [{"from": 1709888355000, "parameters": {"threshold": "5"}, "template_id": "stickiness-v1", "to": 1710493155000}]}, "description": "Updated description.", "name": "Updated Segment Name", "tags": ["team:backend"]}, "id": "a1b2c3d4-1234-5678-9abc-123456789abc", "type": "segment"}}
When the request is sent
Then the response status is 204 No Content

@generated @skip @team:DataDog/product-analytics-backend
Scenario: Update a RUM segment returns "Not Found" response
Given operation "UpdateRumSegment" enabled
And new "UpdateRumSegment" request
And request contains "segment_id" parameter from "REPLACE.ME"
And body with value {"data": {"attributes": {"data_query": {"combination": "(logs && apm_home) && NOT(apm_trace)", "event_platforms": [{"facet": "@usr.id", "from": 1709888355000, "name": "logs", "query": "@type:view @view.url_path:/logs", "to": 1710493155000}], "journeys": [{"conversion_type": "any", "group_by": "@usr.id", "name": "my_journey", "search": "@type:view"}], "reference_tables": [{"columns": [{"name": "user_id"}], "filter_query": "", "join_condition": {"column_name": "user_id", "facet": "@usr.id"}, "name": "my_ref_table", "table_name": "my_table"}], "static": [{"id": "static-list-1", "name": "My Static List", "user_count": 500}], "templates": [{"from": 1709888355000, "parameters": {"threshold": "5"}, "template_id": "stickiness-v1", "to": 1710493155000}]}, "description": "Updated description.", "name": "Updated Segment Name", "tags": ["team:backend"]}, "id": "a1b2c3d4-1234-5678-9abc-123456789abc", "type": "segment"}}
When the request is sent
Then the response status is 404 Not Found
62 changes: 62 additions & 0 deletions features/v2/undo.json
Original file line number Diff line number Diff line change
Expand Up @@ -4249,6 +4249,68 @@
"type": "safe"
}
},
"ListRumSegments": {
"tag": "RUM User Segments",
"undo": {
"type": "safe"
}
},
"CreateRumSegment": {
"tag": "RUM User Segments",
"undo": {
"operationId": "DeleteRumSegment",
"parameters": [
{
"name": "segment_id",
"source": "data.id"
}
],
"type": "unsafe"
}
},
"InitializeRumSegments": {
"tag": "RUM User Segments",
"undo": {
"type": "idempotent"
}
},
"CreateRumStaticSegment": {
"tag": "RUM User Segments",
"undo": {
"operationId": "DeleteRumSegment",
"parameters": [
{
"name": "segment_id",
"source": "data.id"
}
],
"type": "unsafe"
}
},
"ListRumSegmentTemplates": {
"tag": "RUM User Segments",
"undo": {
"type": "safe"
}
},
"DeleteRumSegment": {
"tag": "RUM User Segments",
"undo": {
"type": "idempotent"
}
},
"GetRumSegment": {
"tag": "RUM User Segments",
"undo": {
"type": "safe"
}
},
"UpdateRumSegment": {
"tag": "RUM User Segments",
"undo": {
"type": "idempotent"
}
},
"UploadIdPMetadata": {
"tag": "Organizations",
"undo": {
Expand Down
1 change: 1 addition & 0 deletions packages/datadog-api-client/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,7 @@ apiInstance
| Rum Replay Sessions | @datadog/datadog-api-client-rum-replay-sessions | [README.md](../../services/rum-replay-sessions/README.md) |
| Rum Replay Viewership | @datadog/datadog-api-client-rum-replay-viewership | [README.md](../../services/rum-replay-viewership/README.md) |
| Rum Retention Filters | @datadog/datadog-api-client-rum-retention-filters | [README.md](../../services/rum-retention-filters/README.md) |
| RUM User Segments | @datadog/datadog-api-client-rum-user-segments | [README.md](../../services/rum-user-segments/README.md) |
| Seats | @datadog/datadog-api-client-seats | [README.md](../../services/seats/README.md) |
| Security Monitoring | @datadog/datadog-api-client-security-monitoring | [README.md](../../services/security-monitoring/README.md) |
| Sensitive Data Scanner | @datadog/datadog-api-client-sensitive-data-scanner | [README.md](../../services/sensitive-data-scanner/README.md) |
Expand Down
56 changes: 56 additions & 0 deletions private/bdd_runner/src/support/scenarios_model_mapping.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9460,6 +9460,62 @@ export const ScenariosModelMappings: { [key: string]: OperationMapping } = {
},
operationResponseType: "ViewershipHistorySessionArray",
},
"RUMUserSegmentsApi.V2.ListRumSegments": {
sort: {
type: "string",
format: "",
},
limit: {
type: "number",
format: "",
},
operationResponseType: "RumSegmentListResponse",
},
"RUMUserSegmentsApi.V2.CreateRumSegment": {
body: {
type: "RumSegmentCreateRequest",
format: "",
},
operationResponseType: "RumSegmentResponse",
},
"RUMUserSegmentsApi.V2.InitializeRumSegments": {
operationResponseType: "{}",
},
"RUMUserSegmentsApi.V2.CreateRumStaticSegment": {
body: {
type: "RumStaticSegmentCreateRequest",
format: "",
},
operationResponseType: "RumSegmentResponse",
},
"RUMUserSegmentsApi.V2.ListRumSegmentTemplates": {
operationResponseType: "RumSegmentTemplateListResponse",
},
"RUMUserSegmentsApi.V2.GetRumSegment": {
segmentId: {
type: "string",
format: "",
},
operationResponseType: "RumSegmentResponse",
},
"RUMUserSegmentsApi.V2.UpdateRumSegment": {
segmentId: {
type: "string",
format: "",
},
body: {
type: "RumSegmentUpdateRequest",
format: "",
},
operationResponseType: "{}",
},
"RUMUserSegmentsApi.V2.DeleteRumSegment": {
segmentId: {
type: "string",
format: "",
},
operationResponseType: "RumSegmentDeleteResponse",
},
"ServiceScorecardsApi.V2.ListScorecardOutcomes": {
pageSize: {
type: "number",
Expand Down
1 change: 1 addition & 0 deletions services/rum_user_segments/.yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nodeLinker: node-modules
44 changes: 44 additions & 0 deletions services/rum_user_segments/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# @datadog/datadog-api-client-rum-user-segments

## Description

Manage RUM user segments for audience targeting and analysis.

## Navigation

- [Installation](#installation)
- [Getting Started](#getting-started)

## Installation

```sh
# NPM
npm install @datadog/datadog-api-client-rum-user-segments
# Yarn
yarn add @datadog/datadog-api-client-rum-user-segments
```

## Getting Started
```ts
import { createConfiguration } from "@datadog/datadog-api-client";
import { RUMUserSegmentsApiV2 } from "@datadog/datadog-api-client-rum-user-segments";
import { v2 } from "@datadog/datadog-api-client-rum-user-segments";

const configuration = createConfiguration();
// Enable unstable operations
const configurationOpts = {
unstableOperations: {
"RUMUserSegmentsApi.v2.listRumSegments": true
}
}

const configuration = createConfiguration(configurationOpts);
const apiInstance = new RUMUserSegmentsApiV2(configuration);
const params = {/* parameters */};

apiInstance.listRumSegments(params).then((data) => {
console.log("API called successfully. Returned data: " + JSON.stringify(data));
}).catch((error) => {
console.error("Error calling API: " + error);
});
```
Loading