Skip to content
Merged
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
562 changes: 562 additions & 0 deletions .generator/schemas/v2/openapi.yaml

Large diffs are not rendered by default.

26 changes: 26 additions & 0 deletions examples/v2/product-analytics/QueryProductAnalyticsScalar.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Compute scalar analytics returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V2::ProductAnalyticsAPI.new

body = DatadogAPIClient::V2::ProductAnalyticsAnalyticsRequest.new({
data: DatadogAPIClient::V2::ProductAnalyticsAnalyticsRequestData.new({
attributes: DatadogAPIClient::V2::ProductAnalyticsAnalyticsRequestAttributes.new({
from: 1771232048460,
query: DatadogAPIClient::V2::ProductAnalyticsAnalyticsQuery.new({
compute: DatadogAPIClient::V2::ProductAnalyticsCompute.new({
aggregation: "count",
}),
query: DatadogAPIClient::V2::ProductAnalyticsEventQuery.new({
data_source: DatadogAPIClient::V2::ProductAnalyticsEventQueryDataSource::PRODUCT_ANALYTICS,
search: DatadogAPIClient::V2::ProductAnalyticsEventSearch.new({
query: "@type:view",
}),
}),
}),
to: 1771836848262,
}),
type: DatadogAPIClient::V2::ProductAnalyticsAnalyticsRequestType::FORMULA_ANALYTICS_EXTENDED_REQUEST,
}),
})
p api_instance.query_product_analytics_scalar(body)
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Compute timeseries analytics returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V2::ProductAnalyticsAPI.new

body = DatadogAPIClient::V2::ProductAnalyticsAnalyticsRequest.new({
data: DatadogAPIClient::V2::ProductAnalyticsAnalyticsRequestData.new({
attributes: DatadogAPIClient::V2::ProductAnalyticsAnalyticsRequestAttributes.new({
from: 1771232048460,
query: DatadogAPIClient::V2::ProductAnalyticsAnalyticsQuery.new({
compute: DatadogAPIClient::V2::ProductAnalyticsCompute.new({
aggregation: "count",
}),
query: DatadogAPIClient::V2::ProductAnalyticsEventQuery.new({
data_source: DatadogAPIClient::V2::ProductAnalyticsEventQueryDataSource::PRODUCT_ANALYTICS,
search: DatadogAPIClient::V2::ProductAnalyticsEventSearch.new({
query: "@type:view",
}),
}),
}),
to: 1771836848262,
}),
type: DatadogAPIClient::V2::ProductAnalyticsAnalyticsRequestType::FORMULA_ANALYTICS_EXTENDED_REQUEST,
}),
})
p api_instance.query_product_analytics_timeseries(body)
6 changes: 6 additions & 0 deletions features/scenarios_model_mapping.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3114,6 +3114,12 @@
"v2.SubmitProductAnalyticsEvent" => {
"body" => "ProductAnalyticsServerSideEventItem",
},
"v2.QueryProductAnalyticsScalar" => {
"body" => "ProductAnalyticsAnalyticsRequest",
},
"v2.QueryProductAnalyticsTimeseries" => {
"body" => "ProductAnalyticsAnalyticsRequest",
},
"v2.GetAccountFacetInfo" => {
"body" => "FacetInfoRequest",
},
Expand Down
42 changes: 40 additions & 2 deletions features/v2/product_analytics.feature
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,63 @@ Feature: Product Analytics
Background:
Given a valid "apiKeyAuth" key in the system
And an instance of "ProductAnalytics" API
And new "SubmitProductAnalyticsEvent" request
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"}}

@generated @skip @team:DataDog/product-analytics-backend
Scenario: Compute scalar analytics returns "Bad Request" response
Given a valid "appKeyAuth" key in the system
And new "QueryProductAnalyticsScalar" request
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"}}
When the request is sent
Then the response status is 400 Bad Request

@generated @skip @team:DataDog/product-analytics-backend
Scenario: Compute scalar analytics returns "OK" response
Given a valid "appKeyAuth" key in the system
And new "QueryProductAnalyticsScalar" request
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"}}
When the request is sent
Then the response status is 200 OK

@generated @skip @team:DataDog/product-analytics-backend
Scenario: Compute timeseries analytics returns "Bad Request" response
Given a valid "appKeyAuth" key in the system
And new "QueryProductAnalyticsTimeseries" request
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"}}
When the request is sent
Then the response status is 400 Bad Request

@generated @skip @team:DataDog/product-analytics-backend
Scenario: Compute timeseries analytics returns "OK" response
Given a valid "appKeyAuth" key in the system
And new "QueryProductAnalyticsTimeseries" request
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"}}
When the request is sent
Then the response status is 200 OK

@generated @skip @team:DataDog/product-analytics-backend
Scenario: Send server-side events returns "Bad Request" response
Given new "SubmitProductAnalyticsEvent" request
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"}}
When the request is sent
Then the response status is 400 Bad Request

@generated @skip @team:DataDog/product-analytics-backend
Scenario: Send server-side events returns "Payload Too Large" response
Given new "SubmitProductAnalyticsEvent" request
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"}}
When the request is sent
Then the response status is 413 Payload Too Large

@generated @skip @team:DataDog/product-analytics-backend
Scenario: Send server-side events returns "Request Timeout" response
Given new "SubmitProductAnalyticsEvent" request
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"}}
When the request is sent
Then the response status is 408 Request Timeout

@generated @skip @team:DataDog/product-analytics-backend
Scenario: Send server-side events returns "Request accepted for processing (always 202 empty JSON)." response
Given new "SubmitProductAnalyticsEvent" request
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"}}
When the request is sent
Then the response status is 202 Request accepted for processing (always 202 empty JSON).
12 changes: 12 additions & 0 deletions features/v2/undo.json
Original file line number Diff line number Diff line change
Expand Up @@ -3719,6 +3719,18 @@
"type": "unsafe"
}
},
"QueryProductAnalyticsScalar": {
"tag": "Product Analytics",
"undo": {
"type": "safe"
}
},
"QueryProductAnalyticsTimeseries": {
"tag": "Product Analytics",
"undo": {
"type": "safe"
}
},
"QueryEventFilteredUsers": {
"tag": "Rum Audience Management",
"undo": {
Expand Down
37 changes: 37 additions & 0 deletions lib/datadog_api_client/inflector.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3940,6 +3940,38 @@ def overrides
"v2.process_summary" => "ProcessSummary",
"v2.process_summary_attributes" => "ProcessSummaryAttributes",
"v2.process_summary_type" => "ProcessSummaryType",
"v2.product_analytics_analytics_query" => "ProductAnalyticsAnalyticsQuery",
"v2.product_analytics_analytics_request" => "ProductAnalyticsAnalyticsRequest",
"v2.product_analytics_analytics_request_attributes" => "ProductAnalyticsAnalyticsRequestAttributes",
"v2.product_analytics_analytics_request_data" => "ProductAnalyticsAnalyticsRequestData",
"v2.product_analytics_analytics_request_type" => "ProductAnalyticsAnalyticsRequestType",
"v2.product_analytics_audience_account_subquery" => "ProductAnalyticsAudienceAccountSubquery",
"v2.product_analytics_audience_filters" => "ProductAnalyticsAudienceFilters",
"v2.product_analytics_audience_segment_subquery" => "ProductAnalyticsAudienceSegmentSubquery",
"v2.product_analytics_audience_user_subquery" => "ProductAnalyticsAudienceUserSubquery",
"v2.product_analytics_base_query" => "ProductAnalyticsBaseQuery",
"v2.product_analytics_compute" => "ProductAnalyticsCompute",
"v2.product_analytics_event_query" => "ProductAnalyticsEventQuery",
"v2.product_analytics_event_query_data_source" => "ProductAnalyticsEventQueryDataSource",
"v2.product_analytics_event_search" => "ProductAnalyticsEventSearch",
"v2.product_analytics_execution_type" => "ProductAnalyticsExecutionType",
"v2.product_analytics_group_by" => "ProductAnalyticsGroupBy",
"v2.product_analytics_group_by_sort" => "ProductAnalyticsGroupBySort",
"v2.product_analytics_interval" => "ProductAnalyticsInterval",
"v2.product_analytics_occurrence_filter" => "ProductAnalyticsOccurrenceFilter",
"v2.product_analytics_occurrence_query" => "ProductAnalyticsOccurrenceQuery",
"v2.product_analytics_occurrence_query_data_source" => "ProductAnalyticsOccurrenceQueryDataSource",
"v2.product_analytics_occurrence_search" => "ProductAnalyticsOccurrenceSearch",
"v2.product_analytics_response_meta" => "ProductAnalyticsResponseMeta",
"v2.product_analytics_response_meta_status" => "ProductAnalyticsResponseMetaStatus",
"v2.product_analytics_scalar_column" => "ProductAnalyticsScalarColumn",
"v2.product_analytics_scalar_column_meta" => "ProductAnalyticsScalarColumnMeta",
"v2.product_analytics_scalar_column_type" => "ProductAnalyticsScalarColumnType",
"v2.product_analytics_scalar_response" => "ProductAnalyticsScalarResponse",
"v2.product_analytics_scalar_response_attributes" => "ProductAnalyticsScalarResponseAttributes",
"v2.product_analytics_scalar_response_data" => "ProductAnalyticsScalarResponseData",
"v2.product_analytics_scalar_response_type" => "ProductAnalyticsScalarResponseType",
"v2.product_analytics_serie" => "ProductAnalyticsSerie",
"v2.product_analytics_server_side_event_error" => "ProductAnalyticsServerSideEventError",
"v2.product_analytics_server_side_event_errors" => "ProductAnalyticsServerSideEventErrors",
"v2.product_analytics_server_side_event_item" => "ProductAnalyticsServerSideEventItem",
Expand All @@ -3949,6 +3981,11 @@ def overrides
"v2.product_analytics_server_side_event_item_session" => "ProductAnalyticsServerSideEventItemSession",
"v2.product_analytics_server_side_event_item_type" => "ProductAnalyticsServerSideEventItemType",
"v2.product_analytics_server_side_event_item_usr" => "ProductAnalyticsServerSideEventItemUsr",
"v2.product_analytics_timeseries_response" => "ProductAnalyticsTimeseriesResponse",
"v2.product_analytics_timeseries_response_attributes" => "ProductAnalyticsTimeseriesResponseAttributes",
"v2.product_analytics_timeseries_response_data" => "ProductAnalyticsTimeseriesResponseData",
"v2.product_analytics_timeseries_response_type" => "ProductAnalyticsTimeseriesResponseType",
"v2.product_analytics_unit" => "ProductAnalyticsUnit",
"v2.project" => "Project",
"v2.project_attributes" => "ProjectAttributes",
"v2.project_columns_config" => "ProjectColumnsConfig",
Expand Down
137 changes: 137 additions & 0 deletions lib/datadog_api_client/v2/api/product_analytics_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,143 @@ def initialize(api_client = DatadogAPIClient::APIClient.default)
@api_client = api_client
end

# Compute scalar analytics.
#
# @see #query_product_analytics_scalar_with_http_info
def query_product_analytics_scalar(body, opts = {})
data, _status_code, _headers = query_product_analytics_scalar_with_http_info(body, opts)
data
end

# Compute scalar analytics.
#
# Compute scalar analytics results for Product Analytics data.
# Returns aggregated values (counts, averages, percentiles) optionally grouped by facets.
#
# @param body [ProductAnalyticsAnalyticsRequest]
# @param opts [Hash] the optional parameters
# @return [Array<(ProductAnalyticsScalarResponse, Integer, Hash)>] ProductAnalyticsScalarResponse data, response status code and response headers
def query_product_analytics_scalar_with_http_info(body, opts = {})

if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ProductAnalyticsAPI.query_product_analytics_scalar ...'
end
# verify the required parameter 'body' is set
if @api_client.config.client_side_validation && body.nil?
fail ArgumentError, "Missing the required parameter 'body' when calling ProductAnalyticsAPI.query_product_analytics_scalar"
end
# resource path
local_var_path = '/api/v2/product-analytics/analytics/scalar'

# query parameters
query_params = opts[:query_params] || {}

# header parameters
header_params = opts[:header_params] || {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# HTTP header 'Content-Type'
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

# form parameters
form_params = opts[:form_params] || {}

# http body (model)
post_body = opts[:debug_body] || @api_client.object_to_http_body(body)

# return_type
return_type = opts[:debug_return_type] || 'ProductAnalyticsScalarResponse'

# auth_names
auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth]

new_options = opts.merge(
:operation => :query_product_analytics_scalar,
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type,
:api_version => "V2"
)

data, status_code, headers = @api_client.call_api(Net::HTTP::Post, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ProductAnalyticsAPI#query_product_analytics_scalar\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end

# Compute timeseries analytics.
#
# @see #query_product_analytics_timeseries_with_http_info
def query_product_analytics_timeseries(body, opts = {})
data, _status_code, _headers = query_product_analytics_timeseries_with_http_info(body, opts)
data
end

# Compute timeseries analytics.
#
# Compute timeseries analytics results for Product Analytics data.
# Returns time-bucketed values for charts and trend analysis.
# The `compute.interval` field (milliseconds) is required for time bucketing.
#
# @param body [ProductAnalyticsAnalyticsRequest]
# @param opts [Hash] the optional parameters
# @return [Array<(ProductAnalyticsTimeseriesResponse, Integer, Hash)>] ProductAnalyticsTimeseriesResponse data, response status code and response headers
def query_product_analytics_timeseries_with_http_info(body, opts = {})

if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ProductAnalyticsAPI.query_product_analytics_timeseries ...'
end
# verify the required parameter 'body' is set
if @api_client.config.client_side_validation && body.nil?
fail ArgumentError, "Missing the required parameter 'body' when calling ProductAnalyticsAPI.query_product_analytics_timeseries"
end
# resource path
local_var_path = '/api/v2/product-analytics/analytics/timeseries'

# query parameters
query_params = opts[:query_params] || {}

# header parameters
header_params = opts[:header_params] || {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# HTTP header 'Content-Type'
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

# form parameters
form_params = opts[:form_params] || {}

# http body (model)
post_body = opts[:debug_body] || @api_client.object_to_http_body(body)

# return_type
return_type = opts[:debug_return_type] || 'ProductAnalyticsTimeseriesResponse'

# auth_names
auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth]

new_options = opts.merge(
:operation => :query_product_analytics_timeseries,
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type,
:api_version => "V2"
)

data, status_code, headers = @api_client.call_api(Net::HTTP::Post, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ProductAnalyticsAPI#query_product_analytics_timeseries\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end

# Send server-side events.
#
# @see #submit_product_analytics_event_with_http_info
Expand Down
Loading
Loading