Skip to content

Commit 8554c28

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
feat(product-analytics): add analytics scalar and timeseries endpoints (#3534)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent 0f6a0b7 commit 8554c28

File tree

46 files changed

+2814
-3
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+2814
-3
lines changed

.generator/schemas/v2/openapi.yaml

Lines changed: 562 additions & 0 deletions
Large diffs are not rendered by default.

features/v2/product_analytics.feature

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,25 +11,63 @@ Feature: Product Analytics
1111
Background:
1212
Given a valid "apiKeyAuth" key in the system
1313
And an instance of "ProductAnalytics" API
14-
And new "SubmitProductAnalyticsEvent" request
15-
And body with value {"account": {"id": "account-67890"}, "application": {"id": "123abcde-123a-123b-1234-123456789abc"}, "event": {"name": "payment.processed"}, "session": {"id": "session-abcdef"}, "type": "server", "usr": {"id": "user-12345"}}
14+
15+
@generated @skip @team:DataDog/product-analytics-backend
16+
Scenario: Compute scalar analytics returns "Bad Request" response
17+
Given a valid "appKeyAuth" key in the system
18+
And new "QueryProductAnalyticsScalar" request
19+
And body with value {"data": {"attributes": {"from": 1771232048460, "query": {"compute": {"aggregation": "count"}, "query": {"data_source": "product_analytics", "search": {"query": "@type:view"}}}, "to": 1771836848262}, "type": "formula_analytics_extended_request"}}
20+
When the request is sent
21+
Then the response status is 400 Bad Request
22+
23+
@generated @skip @team:DataDog/product-analytics-backend
24+
Scenario: Compute scalar analytics returns "OK" response
25+
Given a valid "appKeyAuth" key in the system
26+
And new "QueryProductAnalyticsScalar" request
27+
And body with value {"data": {"attributes": {"from": 1771232048460, "query": {"compute": {"aggregation": "count"}, "query": {"data_source": "product_analytics", "search": {"query": "@type:view"}}}, "to": 1771836848262}, "type": "formula_analytics_extended_request"}}
28+
When the request is sent
29+
Then the response status is 200 OK
30+
31+
@generated @skip @team:DataDog/product-analytics-backend
32+
Scenario: Compute timeseries analytics returns "Bad Request" response
33+
Given a valid "appKeyAuth" key in the system
34+
And new "QueryProductAnalyticsTimeseries" request
35+
And body with value {"data": {"attributes": {"from": 1771232048460, "query": {"compute": {"aggregation": "count"}, "query": {"data_source": "product_analytics", "search": {"query": "@type:view"}}}, "to": 1771836848262}, "type": "formula_analytics_extended_request"}}
36+
When the request is sent
37+
Then the response status is 400 Bad Request
38+
39+
@generated @skip @team:DataDog/product-analytics-backend
40+
Scenario: Compute timeseries analytics returns "OK" response
41+
Given a valid "appKeyAuth" key in the system
42+
And new "QueryProductAnalyticsTimeseries" request
43+
And body with value {"data": {"attributes": {"from": 1771232048460, "query": {"compute": {"aggregation": "count"}, "query": {"data_source": "product_analytics", "search": {"query": "@type:view"}}}, "to": 1771836848262}, "type": "formula_analytics_extended_request"}}
44+
When the request is sent
45+
Then the response status is 200 OK
1646

1747
@generated @skip @team:DataDog/product-analytics-backend
1848
Scenario: Send server-side events returns "Bad Request" response
49+
Given new "SubmitProductAnalyticsEvent" request
50+
And body with value {"account": {"id": "account-67890"}, "application": {"id": "123abcde-123a-123b-1234-123456789abc"}, "event": {"name": "payment.processed"}, "session": {"id": "session-abcdef"}, "type": "server", "usr": {"id": "user-12345"}}
1951
When the request is sent
2052
Then the response status is 400 Bad Request
2153

2254
@generated @skip @team:DataDog/product-analytics-backend
2355
Scenario: Send server-side events returns "Payload Too Large" response
56+
Given new "SubmitProductAnalyticsEvent" request
57+
And body with value {"account": {"id": "account-67890"}, "application": {"id": "123abcde-123a-123b-1234-123456789abc"}, "event": {"name": "payment.processed"}, "session": {"id": "session-abcdef"}, "type": "server", "usr": {"id": "user-12345"}}
2458
When the request is sent
2559
Then the response status is 413 Payload Too Large
2660

2761
@generated @skip @team:DataDog/product-analytics-backend
2862
Scenario: Send server-side events returns "Request Timeout" response
63+
Given new "SubmitProductAnalyticsEvent" request
64+
And body with value {"account": {"id": "account-67890"}, "application": {"id": "123abcde-123a-123b-1234-123456789abc"}, "event": {"name": "payment.processed"}, "session": {"id": "session-abcdef"}, "type": "server", "usr": {"id": "user-12345"}}
2965
When the request is sent
3066
Then the response status is 408 Request Timeout
3167

3268
@generated @skip @team:DataDog/product-analytics-backend
3369
Scenario: Send server-side events returns "Request accepted for processing (always 202 empty JSON)." response
70+
Given new "SubmitProductAnalyticsEvent" request
71+
And body with value {"account": {"id": "account-67890"}, "application": {"id": "123abcde-123a-123b-1234-123456789abc"}, "event": {"name": "payment.processed"}, "session": {"id": "session-abcdef"}, "type": "server", "usr": {"id": "user-12345"}}
3472
When the request is sent
3573
Then the response status is 202 Request accepted for processing (always 202 empty JSON).

features/v2/undo.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3719,6 +3719,18 @@
37193719
"type": "unsafe"
37203720
}
37213721
},
3722+
"QueryProductAnalyticsScalar": {
3723+
"tag": "Product Analytics",
3724+
"undo": {
3725+
"type": "safe"
3726+
}
3727+
},
3728+
"QueryProductAnalyticsTimeseries": {
3729+
"tag": "Product Analytics",
3730+
"undo": {
3731+
"type": "safe"
3732+
}
3733+
},
37223734
"QueryEventFilteredUsers": {
37233735
"tag": "Rum Audience Management",
37243736
"undo": {

private/bdd_runner/src/support/scenarios_model_mapping.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8797,6 +8797,20 @@ export const ScenariosModelMappings: { [key: string]: OperationMapping } = {
87978797
},
87988798
operationResponseType: "any",
87998799
},
8800+
"ProductAnalyticsApi.V2.QueryProductAnalyticsScalar": {
8801+
body: {
8802+
type: "ProductAnalyticsAnalyticsRequest",
8803+
format: "",
8804+
},
8805+
operationResponseType: "ProductAnalyticsScalarResponse",
8806+
},
8807+
"ProductAnalyticsApi.V2.QueryProductAnalyticsTimeseries": {
8808+
body: {
8809+
type: "ProductAnalyticsAnalyticsRequest",
8810+
format: "",
8811+
},
8812+
operationResponseType: "ProductAnalyticsTimeseriesResponse",
8813+
},
88008814
"RumAudienceManagementApi.V2.GetAccountFacetInfo": {
88018815
body: {
88028816
type: "FacetInfoRequest",

0 commit comments

Comments
 (0)