Class: DatadogAPIClient::V2::ProductAnalyticsAPI

Inherits:
Object
  • Object
show all
Defined in:
lib/datadog_api_client/v2/api/product_analytics_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = DatadogAPIClient::APIClient.default) ⇒ ProductAnalyticsAPI

Returns a new instance of ProductAnalyticsAPI.



22
23
24
# File 'lib/datadog_api_client/v2/api/product_analytics_api.rb', line 22

def initialize(api_client = DatadogAPIClient::APIClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



20
21
22
# File 'lib/datadog_api_client/v2/api/product_analytics_api.rb', line 20

def api_client
  @api_client
end

Instance Method Details

#query_product_analytics_scalar(body, opts = {}) ⇒ Object

Compute scalar analytics.



29
30
31
32
# File 'lib/datadog_api_client/v2/api/product_analytics_api.rb', line 29

def query_product_analytics_scalar(body, opts = {})
  data, _status_code, _headers = query_product_analytics_scalar_with_http_info(body, opts)
  data
end

#query_product_analytics_scalar_with_http_info(body, opts = {}) ⇒ Array<(ProductAnalyticsScalarResponse, Integer, Hash)>

Compute scalar analytics.

Compute scalar analytics results for Product Analytics data. Returns aggregated values (counts, averages, percentiles) optionally grouped by facets.

Parameters:

Returns:



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/datadog_api_client/v2/api/product_analytics_api.rb', line 42

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

#query_product_analytics_timeseries(body, opts = {}) ⇒ Object

Compute timeseries analytics.



97
98
99
100
# File 'lib/datadog_api_client/v2/api/product_analytics_api.rb', line 97

def query_product_analytics_timeseries(body, opts = {})
  data, _status_code, _headers = query_product_analytics_timeseries_with_http_info(body, opts)
  data
end

#query_product_analytics_timeseries_with_http_info(body, opts = {}) ⇒ Array<(ProductAnalyticsTimeseriesResponse, Integer, Hash)>

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.

Parameters:

Returns:



111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
# File 'lib/datadog_api_client/v2/api/product_analytics_api.rb', line 111

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

#submit_product_analytics_event(body, opts = {}) ⇒ Object

Send server-side events.



166
167
168
169
# File 'lib/datadog_api_client/v2/api/product_analytics_api.rb', line 166

def submit_product_analytics_event(body, opts = {})
  data, _status_code, _headers = submit_product_analytics_event_with_http_info(body, opts)
  data
end

#submit_product_analytics_event_with_http_info(body, opts = {}) ⇒ Array<(Object, Integer, Hash)>

Send server-side events.

Send server-side events to Product Analytics. Server-side events are retained for 15 months.

Server-Side events in Product Analytics are helpful for tracking events that occur on the server, as opposed to client-side events, which are captured by Real User Monitoring (RUM) SDKs. This allows for a more comprehensive view of the user journey by including actions that happen on the server. Typical examples could be checkout.completed or payment.processed.

Ingested server-side events are integrated into Product Analytics to allow users to select and filter these events in the event picker, similar to how views or actions are handled.

Requirements:

  • At least one of usr, account, or session must be provided with a valid ID.

  • The application.id must reference a Product Analytics-enabled application.

**Custom Attributes:** Any additional fields in the payload are flattened and searchable as facets. For example, a payload with ‘{“tier”: “premium”}` is searchable with the syntax `@customer.tier:premium` in Datadog.

The status codes answered by the HTTP API are:

  • 202: Accepted: The request has been accepted for processing

  • 400: Bad request (likely an issue in the payload formatting)

  • 401: Unauthorized (likely a missing API Key)

  • 403: Permission issue (likely using an invalid API Key)

  • 408: Request Timeout, request should be retried after some time

  • 413: Payload too large (batch is above 5MB uncompressed)

  • 429: Too Many Requests, request should be retried after some time

  • 500: Internal Server Error, the server encountered an unexpected condition that prevented it from fulfilling the request, request should be retried after some time

  • 503: Service Unavailable, the server is not ready to handle the request probably because it is overloaded, request should be retried after some time

Parameters:

Returns:

  • (Array<(Object, Integer, Hash)>)

    Object data, response status code and response headers



206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
# File 'lib/datadog_api_client/v2/api/product_analytics_api.rb', line 206

def submit_product_analytics_event_with_http_info(body, opts = {})

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ProductAnalyticsAPI.submit_product_analytics_event ...'
  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.submit_product_analytics_event"
  end
  # resource path
  local_var_path = '/api/v2/prodlytics'

  # 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] || 'Object'

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

  new_options = opts.merge(
    :operation => :submit_product_analytics_event,
    :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#submit_product_analytics_event\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end