Class: DatadogAPIClient::V2::ExperimentsAPI

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of ExperimentsAPI.



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

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

Instance Attribute Details

#api_client ⇒ Object

Returns the value of attribute api_client.



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

def api_client
  @api_client
end

Instance Method Details

#archive_exposure_sql_model(exposure_sql_model_id, opts = {}) ⇒ Object

Archive exposure SQL model.



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

def archive_exposure_sql_model(exposure_sql_model_id, opts = {})
  archive_exposure_sql_model_with_http_info(exposure_sql_model_id, opts)
  nil
end

#archive_exposure_sql_model_with_http_info(exposure_sql_model_id, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Archive exposure SQL model.

Archive an exposure SQL model. Archived models are hidden from the default list and are no longer refreshed for new feature flags. Experiments already reading from the model keep working. Archiving is how a model that is in use by an experiment, and therefore cannot be deleted, is retired.

Parameters:

  • exposure_sql_model_id (UUID) —

    The UUID of the exposure SQL model.

  • opts (Hash) (defaults to: {}) —

    the optional parameters

Returns:

  • (Array<(nil, Integer, Hash)>) —

    nil, response status code and response headers



41
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
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 41

def archive_exposure_sql_model_with_http_info(exposure_sql_model_id, opts = {})

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ExperimentsAPI.archive_exposure_sql_model ...'
  end
  # verify the required parameter 'exposure_sql_model_id' is set
  if @api_client.config.client_side_validation && exposure_sql_model_id.nil?
    fail ArgumentError, "Missing the required parameter 'exposure_sql_model_id' when calling ExperimentsAPI.archive_exposure_sql_model"
  end
  # resource path
  local_var_path = '/api/v2/experiments/exposure-sql-models/{exposure_sql_model_id}/archive'.sub('{exposure_sql_model_id}', CGI.escape(exposure_sql_model_id.to_s).gsub('%2F', '/'))

  # 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(['*/*'])

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

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type]

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

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

#cancel_experiment(experiment_id, body, opts = {}) ⇒ Object

Cancel experiment.



94
95
96
97
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 94

def cancel_experiment(experiment_id, body, opts = {})
  cancel_experiment_with_http_info(experiment_id, body, opts)
  nil
end

#cancel_experiment_with_http_info(experiment_id, body, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Cancel experiment.

Cancel an experiment, ending it without a winning variant. The experiment moves to CANCELLED status, the supplied reason is recorded in its conclusion as the decision reason, and the experiment is unlinked from the feature flag allocations that exposed it, which stops its exposure. An experiment that has already completed its rollout, had its code removed, or been canceled cannot be canceled again. Canceling is not reversible: an experiment cannot be returned to a running state afterward. It is also not idempotent: canceling an already-canceled experiment returns 409, so a retry after a timeout cannot be distinguished from a cancellation made by someone else.

Parameters:

Returns:

  • (Array<(nil, Integer, Hash)>) —

    nil, response status code and response headers



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
162
163
164
165
166
167
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 113

def cancel_experiment_with_http_info(experiment_id, body, opts = {})

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ExperimentsAPI.cancel_experiment ...'
  end
  # verify the required parameter 'experiment_id' is set
  if @api_client.config.client_side_validation && experiment_id.nil?
    fail ArgumentError, "Missing the required parameter 'experiment_id' when calling ExperimentsAPI.cancel_experiment"
  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 ExperimentsAPI.cancel_experiment"
  end
  # resource path
  local_var_path = '/api/v2/experiments/{experiment_id}/cancel'.sub('{experiment_id}', CGI.escape(experiment_id.to_s).gsub('%2F', '/'))

  # 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(['*/*'])
  # 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]

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

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

#conclude_experiment(experiment_id, body, opts = {}) ⇒ Object

Conclude experiment.



172
173
174
175
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 172

def conclude_experiment(experiment_id, body, opts = {})
  conclude_experiment_with_http_info(experiment_id, body, opts)
  nil
end

#conclude_experiment_with_http_info(experiment_id, body, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Conclude experiment.

Conclude an experiment on a winning variant. The experiment moves to DECISION_MADE status, the outcome is recorded in its conclusion, and for a flag-backed experiment the winning variant is rolled out to 100% of the linked feature flag allocation. decision_variant_key must match a variant in the experiment. Only an experiment that is currently running or ready for a decision can be concluded. Concluding is not reversible and is not idempotent: concluding an already-concluded experiment returns 409.

Parameters:

Returns:

  • (Array<(nil, Integer, Hash)>) —

    nil, response status code and response headers



185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
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
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 185

def conclude_experiment_with_http_info(experiment_id, body, opts = {})

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ExperimentsAPI.conclude_experiment ...'
  end
  # verify the required parameter 'experiment_id' is set
  if @api_client.config.client_side_validation && experiment_id.nil?
    fail ArgumentError, "Missing the required parameter 'experiment_id' when calling ExperimentsAPI.conclude_experiment"
  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 ExperimentsAPI.conclude_experiment"
  end
  # resource path
  local_var_path = '/api/v2/experiments/{experiment_id}/conclude'.sub('{experiment_id}', CGI.escape(experiment_id.to_s).gsub('%2F', '/'))

  # 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(['*/*'])
  # 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]

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

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

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

Create experiment.



244
245
246
247
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 244

def create_experiment(body, opts = {})
  data, _status_code, _headers = create_experiment_with_http_info(body, opts)
  data
end

#create_experiment_metric_group(experiment_id, body, opts = {}) ⇒ Object

Create experiment metric group.



311
312
313
314
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 311

def create_experiment_metric_group(experiment_id, body, opts = {})
  data, _status_code, _headers = create_experiment_metric_group_with_http_info(experiment_id, body, opts)
  data
end

#create_experiment_metric_group_from_collection(experiment_id, metric_collection_id, opts = {}) ⇒ Object

Create experiment metric group from collection.



383
384
385
386
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 383

def create_experiment_metric_group_from_collection(experiment_id, metric_collection_id, opts = {})
  data, _status_code, _headers = create_experiment_metric_group_from_collection_with_http_info(experiment_id, metric_collection_id, opts)
  data
end

#create_experiment_metric_group_from_collection_with_http_info(experiment_id, metric_collection_id, opts = {}) ⇒ Array<(ExperimentsExperimentMetricGroupMutationV2, Integer, Hash)>

Create experiment metric group from collection.

Copy a metric collection into a new non-decision metric group. The group is a request-time snapshot: later changes to the collection do not affect the experiment. Metric order is preserved. The operation is not idempotent, and incompatible or empty collections are rejected without creating a group.

Parameters:

  • experiment_id (UUID) —

    The UUID of the experiment.

  • metric_collection_id (UUID) —

    The UUID of the metric collection.

  • opts (Hash) (defaults to: {}) —

    the optional parameters

Returns:



396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 396

def create_experiment_metric_group_from_collection_with_http_info(experiment_id, metric_collection_id, opts = {})

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ExperimentsAPI.create_experiment_metric_group_from_collection ...'
  end
  # verify the required parameter 'experiment_id' is set
  if @api_client.config.client_side_validation && experiment_id.nil?
    fail ArgumentError, "Missing the required parameter 'experiment_id' when calling ExperimentsAPI.create_experiment_metric_group_from_collection"
  end
  # verify the required parameter 'metric_collection_id' is set
  if @api_client.config.client_side_validation && metric_collection_id.nil?
    fail ArgumentError, "Missing the required parameter 'metric_collection_id' when calling ExperimentsAPI.create_experiment_metric_group_from_collection"
  end
  # resource path
  local_var_path = '/api/v2/experiments/{experiment_id}/metric-groups/from-collection/{metric_collection_id}'.sub('{experiment_id}', CGI.escape(experiment_id.to_s).gsub('%2F', '/')).sub('{metric_collection_id}', CGI.escape(metric_collection_id.to_s).gsub('%2F', '/'))

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

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

  # http body (model)
  post_body = opts[:debug_body]

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

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

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

#create_experiment_metric_group_with_http_info(experiment_id, body, opts = {}) ⇒ Array<(ExperimentsExperimentMetricGroupMutationV2, Integer, Hash)>

Create experiment metric group.

Create a non-decision metric group. The optional metrics array is ordered. Decision groups remain managed through decision_metrics on the experiment resource. This operation does not synchronously recompute results.

Parameters:

Returns:



324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 324

def create_experiment_metric_group_with_http_info(experiment_id, body, opts = {})

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ExperimentsAPI.create_experiment_metric_group ...'
  end
  # verify the required parameter 'experiment_id' is set
  if @api_client.config.client_side_validation && experiment_id.nil?
    fail ArgumentError, "Missing the required parameter 'experiment_id' when calling ExperimentsAPI.create_experiment_metric_group"
  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 ExperimentsAPI.create_experiment_metric_group"
  end
  # resource path
  local_var_path = '/api/v2/experiments/{experiment_id}/metric-groups'.sub('{experiment_id}', CGI.escape(experiment_id.to_s).gsub('%2F', '/'))

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

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

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

#create_experiment_with_http_info(body, opts = {}) ⇒ Array<(ExperimentsExperimentV2DTO, Integer, Hash)>

Create experiment.

Create a draft experiment. name is required. structured_metadata identifies each metadata field by field_key; use freetext_value for free-text fields and enum_values for enum fields. When this attribute is present, the request must include a value for every required metadata field. When protocol_id is present, the published protocol supplies the subject type, decision metrics, analysis-plan defaults, and configuration and enforcement baselines. The request may also include hypothesis, tags, teams, related links, and assignment or event date overrides that satisfy the protocol's duration rules; omit subject_type_id, decision_metrics, variants, warehouse_exposure_configuration, datadog_flag_configuration, traffic_exposure, split_by_properties, and structured_metadata. The protocol association cannot be changed after creation. Without protocol_id, a complete Warehouse or Datadog configuration saves the experiment and its configuration in one transaction. For Datadog flag configuration, send name, subject_type_id, decision_metrics, variants, traffic_exposure, assignments_start_date, assignments_end_date, events_start_date, and events_end_date. The four date fields can be null. Inside datadog_flag_configuration, send feature_flag_id, environment_id, targeting_rules, and entry_point. Use targeting_rules: [] and entry_point: null when unused. This creates one saved draft allocation that does not serve traffic. Omit all configuration fields to create an experiment without an allocation. This endpoint is not idempotent.

Parameters:

Returns:

  • (Array<(ExperimentsExperimentV2DTO, Integer, Hash)>) —

    ExperimentsExperimentV2DTO data, response status code and response headers



256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 256

def create_experiment_with_http_info(body, opts = {})

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

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

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

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

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

Create exposure SQL model.



453
454
455
456
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 453

def create_exposure_sql_model(body, opts = {})
  data, _status_code, _headers = create_exposure_sql_model_with_http_info(body, opts)
  data
end

#create_exposure_sql_model_with_http_info(body, opts = {}) ⇒ Array<(ExperimentsExposureSQLModelV2DTO, Integer, Hash)>

Create exposure SQL model.

Create an exposure SQL model. Requires at least one subject type. The warehouse connection is resolved from the organization, which has exactly one.

Parameters:

Returns:



465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 465

def create_exposure_sql_model_with_http_info(body, opts = {})

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ExperimentsAPI.create_exposure_sql_model ...'
  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 ExperimentsAPI.create_exposure_sql_model"
  end
  # resource path
  local_var_path = '/api/v2/experiments/exposure-sql-models'

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

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

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

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

Create metric.



520
521
522
523
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 520

def create_metric(body, opts = {})
  data, _status_code, _headers = create_metric_with_http_info(body, opts)
  data
end

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

Create metric collection.



587
588
589
590
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 587

def create_metric_collection(body, opts = {})
  data, _status_code, _headers = create_metric_collection_with_http_info(body, opts)
  data
end

#create_metric_collection_with_http_info(body, opts = {}) ⇒ Array<(ExperimentsMetricCollectionV2DTO, Integer, Hash)>

Create metric collection.

Create metric collection.

Parameters:

Returns:



599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 599

def create_metric_collection_with_http_info(body, opts = {})

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ExperimentsAPI.create_metric_collection ...'
  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 ExperimentsAPI.create_metric_collection"
  end
  # resource path
  local_var_path = '/api/v2/experiments/metric-collections'

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

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

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

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

Create metric SQL model.



654
655
656
657
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 654

def create_metric_sql_model(body, opts = {})
  data, _status_code, _headers = create_metric_sql_model_with_http_info(body, opts)
  data
end

#create_metric_sql_model_with_http_info(body, opts = {}) ⇒ Array<(ExperimentsMetricSQLModelV2DTO, Integer, Hash)>

Create metric SQL model.

Create a metric SQL model. Requires at least one subject type, whose subject_type_id must already exist for the organization (list them with GET /api/v2/experiments/subject-types). The model is created against the organization's warehouse connection, which is resolved server-side. Only customer-defined measures belong in measures. The response provides unique_subject_count_measure_id for each subject type and event_count_measure_id for use in metric aggregations. column_type is required for every measure and property. Certification is read-only and cannot be changed through this endpoint.

Parameters:

Returns:



666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 666

def create_metric_sql_model_with_http_info(body, opts = {})

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ExperimentsAPI.create_metric_sql_model ...'
  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 ExperimentsAPI.create_metric_sql_model"
  end
  # resource path
  local_var_path = '/api/v2/experiments/metric-sql-models'

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

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

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

#create_metric_with_http_info(body, opts = {}) ⇒ Array<(ExperimentsMetricV2DTO, Integer, Hash)>

Create metric.

Create a metric. The metric's type is derived from the aggregation shape: a numerator alone is SIMPLE, a numerator with a denominator is RATIO, and a percentile aggregation is PERCENTILE. Warehouse aggregations reference measures by UUID. Property filters use property_id or measure_id UUIDs returned by the same metric SQL model; every reference must belong to the aggregation's data source. The is_certified attribute is rejected. Certification cannot be changed through this endpoint.

Parameters:

Returns:

  • (Array<(ExperimentsMetricV2DTO, Integer, Hash)>) —

    ExperimentsMetricV2DTO data, response status code and response headers



532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 532

def create_metric_with_http_info(body, opts = {})

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

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

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

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

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

Create subject type.



721
722
723
724
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 721

def create_subject_type(body, opts = {})
  data, _status_code, _headers = create_subject_type_with_http_info(body, opts)
  data
end

#create_subject_type_with_http_info(body, opts = {}) ⇒ Array<(ExperimentsSubjectTypeV2DTO, Integer, Hash)>

Create subject type.

Create a subject type for the organization.

Parameters:

Returns:

  • (Array<(ExperimentsSubjectTypeV2DTO, Integer, Hash)>) —

    ExperimentsSubjectTypeV2DTO data, response status code and response headers



733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 733

def create_subject_type_with_http_info(body, opts = {})

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ExperimentsAPI.create_subject_type ...'
  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 ExperimentsAPI.create_subject_type"
  end
  # resource path
  local_var_path = '/api/v2/experiments/subject-types'

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

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

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

#delete_experiment(experiment_id, opts = {}) ⇒ Object

Delete experiment.



788
789
790
791
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 788

def delete_experiment(experiment_id, opts = {})
  delete_experiment_with_http_info(experiment_id, opts)
  nil
end

#delete_experiment_metric_group(experiment_id, metric_group_id, opts = {}) ⇒ Object

Delete experiment metric group.



853
854
855
856
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 853

def delete_experiment_metric_group(experiment_id, metric_group_id, opts = {})
  delete_experiment_metric_group_with_http_info(experiment_id, metric_group_id, opts)
  nil
end

#delete_experiment_metric_group_with_http_info(experiment_id, metric_group_id, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Delete experiment metric group.

Delete a non-decision metric group and its memberships. Decision groups remain managed through the experiment resource. This operation does not start a pipeline. Read experiment results after deletion to check stale metadata, then explicitly refresh results when required.

Parameters:

  • experiment_id (UUID) —

    The UUID of the experiment.

  • metric_group_id (UUID) —

    The UUID of the metric group.

  • opts (Hash) (defaults to: {}) —

    the optional parameters

Returns:

  • (Array<(nil, Integer, Hash)>) —

    nil, response status code and response headers



866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 866

def delete_experiment_metric_group_with_http_info(experiment_id, metric_group_id, opts = {})

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ExperimentsAPI.delete_experiment_metric_group ...'
  end
  # verify the required parameter 'experiment_id' is set
  if @api_client.config.client_side_validation && experiment_id.nil?
    fail ArgumentError, "Missing the required parameter 'experiment_id' when calling ExperimentsAPI.delete_experiment_metric_group"
  end
  # verify the required parameter 'metric_group_id' is set
  if @api_client.config.client_side_validation && metric_group_id.nil?
    fail ArgumentError, "Missing the required parameter 'metric_group_id' when calling ExperimentsAPI.delete_experiment_metric_group"
  end
  # resource path
  local_var_path = '/api/v2/experiments/{experiment_id}/metric-groups/{metric_group_id}'.sub('{experiment_id}', CGI.escape(experiment_id.to_s).gsub('%2F', '/')).sub('{metric_group_id}', CGI.escape(metric_group_id.to_s).gsub('%2F', '/'))

  # 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(['*/*'])

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

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type]

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

  new_options = opts.merge(
    :operation => :delete_experiment_metric_group,
    :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::Delete, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ExperimentsAPI#delete_experiment_metric_group\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#delete_experiment_with_http_info(experiment_id, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Delete experiment.

Delete an experiment and its linked feature flag allocations in one database transaction. After deletion, the experiment is no longer returned by the API. If the transaction fails, neither the experiment nor its allocations are deleted. Deleting an experiment cannot be undone.

Parameters:

  • experiment_id (UUID) —

    The UUID of the experiment.

  • opts (Hash) (defaults to: {}) —

    the optional parameters

Returns:

  • (Array<(nil, Integer, Hash)>) —

    nil, response status code and response headers



800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 800

def delete_experiment_with_http_info(experiment_id, opts = {})

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ExperimentsAPI.delete_experiment ...'
  end
  # verify the required parameter 'experiment_id' is set
  if @api_client.config.client_side_validation && experiment_id.nil?
    fail ArgumentError, "Missing the required parameter 'experiment_id' when calling ExperimentsAPI.delete_experiment"
  end
  # resource path
  local_var_path = '/api/v2/experiments/{experiment_id}'.sub('{experiment_id}', CGI.escape(experiment_id.to_s).gsub('%2F', '/'))

  # 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(['*/*'])

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

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type]

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

  new_options = opts.merge(
    :operation => :delete_experiment,
    :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::Delete, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ExperimentsAPI#delete_experiment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#delete_metric(metric_id, opts = {}) ⇒ Object

Delete metric.



923
924
925
926
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 923

def delete_metric(metric_id, opts = {})
  delete_metric_with_http_info(metric_id, opts)
  nil
end

#delete_metric_collection(metric_collection_id, opts = {}) ⇒ Object

Delete metric collection.



988
989
990
991
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 988

def delete_metric_collection(metric_collection_id, opts = {})
  delete_metric_collection_with_http_info(metric_collection_id, opts)
  nil
end

#delete_metric_collection_with_http_info(metric_collection_id, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Delete metric collection.

Delete metric collection.

Parameters:

  • metric_collection_id (UUID) —

    The UUID of the metric collection.

  • opts (Hash) (defaults to: {}) —

    the optional parameters

Returns:

  • (Array<(nil, Integer, Hash)>) —

    nil, response status code and response headers



1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 1000

def delete_metric_collection_with_http_info(metric_collection_id, opts = {})

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ExperimentsAPI.delete_metric_collection ...'
  end
  # verify the required parameter 'metric_collection_id' is set
  if @api_client.config.client_side_validation && metric_collection_id.nil?
    fail ArgumentError, "Missing the required parameter 'metric_collection_id' when calling ExperimentsAPI.delete_metric_collection"
  end
  # resource path
  local_var_path = '/api/v2/experiments/metric-collections/{metric_collection_id}'.sub('{metric_collection_id}', CGI.escape(metric_collection_id.to_s).gsub('%2F', '/'))

  # 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(['*/*'])

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

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type]

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

  new_options = opts.merge(
    :operation => :delete_metric_collection,
    :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::Delete, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ExperimentsAPI#delete_metric_collection\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#delete_metric_with_http_info(metric_id, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Delete metric.

Delete a metric. Certified metrics are read-only through this endpoint. The record is soft-deleted and stops appearing in reads. A metric still referenced by an experiment cannot be deleted; detach it from those experiments first.

Parameters:

  • metric_id (UUID) —

    The UUID of the metric.

  • opts (Hash) (defaults to: {}) —

    the optional parameters

Returns:

  • (Array<(nil, Integer, Hash)>) —

    nil, response status code and response headers



935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 935

def delete_metric_with_http_info(metric_id, opts = {})

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ExperimentsAPI.delete_metric ...'
  end
  # verify the required parameter 'metric_id' is set
  if @api_client.config.client_side_validation && metric_id.nil?
    fail ArgumentError, "Missing the required parameter 'metric_id' when calling ExperimentsAPI.delete_metric"
  end
  # resource path
  local_var_path = '/api/v2/experiments/metrics/{metric_id}'.sub('{metric_id}', CGI.escape(metric_id.to_s).gsub('%2F', '/'))

  # 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(['*/*'])

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

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type]

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

  new_options = opts.merge(
    :operation => :delete_metric,
    :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::Delete, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ExperimentsAPI#delete_metric\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#delete_subject_type(subject_type_id, opts = {}) ⇒ Object

Delete subject type.



1053
1054
1055
1056
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 1053

def delete_subject_type(subject_type_id, opts = {})
  delete_subject_type_with_http_info(subject_type_id, opts)
  nil
end

#delete_subject_type_with_http_info(subject_type_id, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Delete subject type.

Delete a subject type. The record is soft-deleted and stops appearing in reads. The call is idempotent: deleting the same subject type again also returns 204. The organization's default subject type cannot be deleted; make another one the default first. A subject type that experiments, exposure SQL models, metric SQL models or protocols still reference cannot be deleted either; the refusal names the blockers.

Parameters:

  • subject_type_id (UUID) —

    The UUID of the subject type.

  • opts (Hash) (defaults to: {}) —

    the optional parameters

Returns:

  • (Array<(nil, Integer, Hash)>) —

    nil, response status code and response headers



1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 1065

def delete_subject_type_with_http_info(subject_type_id, opts = {})

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ExperimentsAPI.delete_subject_type ...'
  end
  # verify the required parameter 'subject_type_id' is set
  if @api_client.config.client_side_validation && subject_type_id.nil?
    fail ArgumentError, "Missing the required parameter 'subject_type_id' when calling ExperimentsAPI.delete_subject_type"
  end
  # resource path
  local_var_path = '/api/v2/experiments/subject-types/{subject_type_id}'.sub('{subject_type_id}', CGI.escape(subject_type_id.to_s).gsub('%2F', '/'))

  # 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(['*/*'])

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

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type]

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

  new_options = opts.merge(
    :operation => :delete_subject_type,
    :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::Delete, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ExperimentsAPI#delete_subject_type\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_experiment(experiment_id, opts = {}) ⇒ Object

Get experiment.



1118
1119
1120
1121
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 1118

def get_experiment(experiment_id, opts = {})
  data, _status_code, _headers = get_experiment_with_http_info(experiment_id, opts)
  data
end

#get_experiment_analysis_plan(experiment_id, opts = {}) ⇒ Object

Get experiment analysis plan.



1183
1184
1185
1186
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 1183

def get_experiment_analysis_plan(experiment_id, opts = {})
  data, _status_code, _headers = get_experiment_analysis_plan_with_http_info(experiment_id, opts)
  data
end

#get_experiment_analysis_plan_with_http_info(experiment_id, opts = {}) ⇒ Array<(ExperimentsAnalysisPlanV2DTO, Integer, Hash)>

Get experiment analysis plan.

Get the effective public statistical analysis settings for an experiment. has_custom_analysis_settings compares only settings the caller can edit; protocol-required differences from company defaults do not make the plan custom.

Parameters:

  • experiment_id (UUID) —

    The UUID of the experiment.

  • opts (Hash) (defaults to: {}) —

    the optional parameters

Returns:



1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 1195

def get_experiment_analysis_plan_with_http_info(experiment_id, opts = {})

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ExperimentsAPI.get_experiment_analysis_plan ...'
  end
  # verify the required parameter 'experiment_id' is set
  if @api_client.config.client_side_validation && experiment_id.nil?
    fail ArgumentError, "Missing the required parameter 'experiment_id' when calling ExperimentsAPI.get_experiment_analysis_plan"
  end
  # resource path
  local_var_path = '/api/v2/experiments/{experiment_id}/analysis-plan'.sub('{experiment_id}', CGI.escape(experiment_id.to_s).gsub('%2F', '/'))

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

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

  # http body (model)
  post_body = opts[:debug_body]

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

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

  new_options = opts.merge(
    :operation => :get_experiment_analysis_plan,
    :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::Get, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ExperimentsAPI#get_experiment_analysis_plan\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_experiment_diagnostics(experiment_id, opts = {}) ⇒ Object

Get experiment diagnostics.



1248
1249
1250
1251
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 1248

def get_experiment_diagnostics(experiment_id, opts = {})
  data, _status_code, _headers = get_experiment_diagnostics_with_http_info(experiment_id, opts)
  data
end

#get_experiment_diagnostics_with_http_info(experiment_id, opts = {}) ⇒ Array<(ExperimentsExperimentDiagnosticsV2DTO, Integer, Hash)>

Get experiment diagnostics.

Get the diagnostics produced by an experiment's latest analysis run. Each diagnostic includes its category, and the response includes an overall diagnostic or pipeline lifecycle status.

Parameters:

  • experiment_id (UUID) —

    The UUID of the experiment.

  • opts (Hash) (defaults to: {}) —

    the optional parameters

Returns:



1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 1260

def get_experiment_diagnostics_with_http_info(experiment_id, opts = {})

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ExperimentsAPI.get_experiment_diagnostics ...'
  end
  # verify the required parameter 'experiment_id' is set
  if @api_client.config.client_side_validation && experiment_id.nil?
    fail ArgumentError, "Missing the required parameter 'experiment_id' when calling ExperimentsAPI.get_experiment_diagnostics"
  end
  # resource path
  local_var_path = '/api/v2/experiments/{experiment_id}/diagnostics'.sub('{experiment_id}', CGI.escape(experiment_id.to_s).gsub('%2F', '/'))

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

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

  # http body (model)
  post_body = opts[:debug_body]

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

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

  new_options = opts.merge(
    :operation => :get_experiment_diagnostics,
    :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::Get, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ExperimentsAPI#get_experiment_diagnostics\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_experiment_protocol(protocol_id, opts = {}) ⇒ Object

Get experiment protocol.



1313
1314
1315
1316
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 1313

def get_experiment_protocol(protocol_id, opts = {})
  data, _status_code, _headers = get_experiment_protocol_with_http_info(protocol_id, opts)
  data
end

#get_experiment_protocol_with_http_info(protocol_id, opts = {}) ⇒ Array<(ExperimentsPublicProtocolResponse, Integer, Hash)>

Get experiment protocol.

Get a draft, published, or archived experiment protocol by ID.

Parameters:

  • protocol_id (UUID) —

    The UUID of the protocol.

  • opts (Hash) (defaults to: {}) —

    the optional parameters

Returns:



1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 1325

def get_experiment_protocol_with_http_info(protocol_id, opts = {})

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ExperimentsAPI.get_experiment_protocol ...'
  end
  # verify the required parameter 'protocol_id' is set
  if @api_client.config.client_side_validation && protocol_id.nil?
    fail ArgumentError, "Missing the required parameter 'protocol_id' when calling ExperimentsAPI.get_experiment_protocol"
  end
  # resource path
  local_var_path = '/api/v2/experiments/protocols/{protocol_id}'.sub('{protocol_id}', CGI.escape(protocol_id.to_s).gsub('%2F', '/'))

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

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

  # http body (model)
  post_body = opts[:debug_body]

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

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

  new_options = opts.merge(
    :operation => :get_experiment_protocol,
    :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::Get, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ExperimentsAPI#get_experiment_protocol\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_experiment_results(experiment_id, opts = {}) ⇒ Object

Get experiment results.



1378
1379
1380
1381
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 1378

def get_experiment_results(experiment_id, opts = {})
  data, _status_code, _headers = get_experiment_results_with_http_info(experiment_id, opts)
  data
end

#get_experiment_results_with_http_info(experiment_id, opts = {}) ⇒ Array<(ExperimentsVariantResultsV2DTOArray, Integer, Hash)>

Get experiment results.

Get an experiment's computed results: per-variant statistical analysis for the latest successful run. A historical run cannot be selected. Unavailable analysis statistics, including p_value and confidence_interval, are omitted. The numerator, denominator, and variant_metric_value fields can be null when their values are unavailable. Do not treat an omitted or null value as zero.

Parameters:

  • experiment_id (UUID) —

    The UUID of the experiment.

  • opts (Hash) (defaults to: {}) —

    the optional parameters

Returns:



1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 1390

def get_experiment_results_with_http_info(experiment_id, opts = {})

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ExperimentsAPI.get_experiment_results ...'
  end
  # verify the required parameter 'experiment_id' is set
  if @api_client.config.client_side_validation && experiment_id.nil?
    fail ArgumentError, "Missing the required parameter 'experiment_id' when calling ExperimentsAPI.get_experiment_results"
  end
  # resource path
  local_var_path = '/api/v2/experiments/{experiment_id}/results'.sub('{experiment_id}', CGI.escape(experiment_id.to_s).gsub('%2F', '/'))

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

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

  # http body (model)
  post_body = opts[:debug_body]

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

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

  new_options = opts.merge(
    :operation => :get_experiment_results,
    :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::Get, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ExperimentsAPI#get_experiment_results\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_experiment_traffic_summary(experiment_id, opts = {}) ⇒ Object

Get experiment traffic summary.



1443
1444
1445
1446
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 1443

def get_experiment_traffic_summary(experiment_id, opts = {})
  data, _status_code, _headers = get_experiment_traffic_summary_with_http_info(experiment_id, opts)
  data
end

#get_experiment_traffic_summary_with_http_info(experiment_id, opts = {}) ⇒ Array<(ExperimentsTrafficSummaryV2DTO, Integer, Hash)>

Get experiment traffic summary.

Get an experiment's traffic summary: per-variant exposure counts and a sample-ratio-mismatch flag (is_traffic_imbalanced). SRM statistics live on the diagnostics endpoint.

Parameters:

  • experiment_id (UUID) —

    The UUID of the experiment.

  • opts (Hash) (defaults to: {}) —

    the optional parameters

Returns:



1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 1455

def get_experiment_traffic_summary_with_http_info(experiment_id, opts = {})

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ExperimentsAPI.get_experiment_traffic_summary ...'
  end
  # verify the required parameter 'experiment_id' is set
  if @api_client.config.client_side_validation && experiment_id.nil?
    fail ArgumentError, "Missing the required parameter 'experiment_id' when calling ExperimentsAPI.get_experiment_traffic_summary"
  end
  # resource path
  local_var_path = '/api/v2/experiments/{experiment_id}/traffic-summary'.sub('{experiment_id}', CGI.escape(experiment_id.to_s).gsub('%2F', '/'))

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

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

  # http body (model)
  post_body = opts[:debug_body]

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

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

  new_options = opts.merge(
    :operation => :get_experiment_traffic_summary,
    :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::Get, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ExperimentsAPI#get_experiment_traffic_summary\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_experiment_with_http_info(experiment_id, opts = {}) ⇒ Array<(ExperimentsExperimentV2DTO, Integer, Hash)>

Get experiment.

Get a complete experiment by ID. The response includes structured metadata, related links, and, when a complete setup exists, decision metrics, variants, warehouse_exposure_configuration, datadog_flag_configuration, STATIC or STEPS traffic exposure, and assignment and event dates. STEPS describes the configured plan rather than wall-clock history; Datadog step durations exclude pauses. The list endpoint omits these setup details.

Parameters:

  • experiment_id (UUID) —

    The UUID of the experiment.

  • opts (Hash) (defaults to: {}) —

    the optional parameters

Returns:

  • (Array<(ExperimentsExperimentV2DTO, Integer, Hash)>) —

    ExperimentsExperimentV2DTO data, response status code and response headers



1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 1130

def get_experiment_with_http_info(experiment_id, opts = {})

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ExperimentsAPI.get_experiment ...'
  end
  # verify the required parameter 'experiment_id' is set
  if @api_client.config.client_side_validation && experiment_id.nil?
    fail ArgumentError, "Missing the required parameter 'experiment_id' when calling ExperimentsAPI.get_experiment"
  end
  # resource path
  local_var_path = '/api/v2/experiments/{experiment_id}'.sub('{experiment_id}', CGI.escape(experiment_id.to_s).gsub('%2F', '/'))

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

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

  # http body (model)
  post_body = opts[:debug_body]

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

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

  new_options = opts.merge(
    :operation => :get_experiment,
    :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::Get, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ExperimentsAPI#get_experiment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_exposure_sql_model(exposure_sql_model_id, opts = {}) ⇒ Object

Get exposure SQL model.



1508
1509
1510
1511
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 1508

def get_exposure_sql_model(exposure_sql_model_id, opts = {})
  data, _status_code, _headers = get_exposure_sql_model_with_http_info(exposure_sql_model_id, opts)
  data
end

#get_exposure_sql_model_with_http_info(exposure_sql_model_id, opts = {}) ⇒ Array<(ExperimentsExposureSQLModelV2DTO, Integer, Hash)>

Get exposure SQL model.

Get an exposure SQL model. Returns a single model by its ID for the organization, including its subject types and properties.

Parameters:

  • exposure_sql_model_id (UUID) —

    The UUID of the exposure SQL model.

  • opts (Hash) (defaults to: {}) —

    the optional parameters

Options Hash (opts):

  • :include (Array<String>) —

    Optional fields to include. Repeat this parameter to request several fields. counts adds experiment_count.

Returns:



1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 1521

def get_exposure_sql_model_with_http_info(exposure_sql_model_id, opts = {})

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ExperimentsAPI.get_exposure_sql_model ...'
  end
  # verify the required parameter 'exposure_sql_model_id' is set
  if @api_client.config.client_side_validation && exposure_sql_model_id.nil?
    fail ArgumentError, "Missing the required parameter 'exposure_sql_model_id' when calling ExperimentsAPI.get_exposure_sql_model"
  end
  # resource path
  local_var_path = '/api/v2/experiments/exposure-sql-models/{exposure_sql_model_id}'.sub('{exposure_sql_model_id}', CGI.escape(exposure_sql_model_id.to_s).gsub('%2F', '/'))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'include'] = @api_client.build_collection_param(opts[:'include'], :multi) if !opts[:'include'].nil?

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

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

  # http body (model)
  post_body = opts[:debug_body]

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

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

  new_options = opts.merge(
    :operation => :get_exposure_sql_model,
    :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"
  )
  new_options[:query_string_normalizer] = HTTParty::Request::NON_RAILS_QUERY_STRING_NORMALIZER

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

#get_metric(metric_id, opts = {}) ⇒ Object

Get metric.



1576
1577
1578
1579
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 1576

def get_metric(metric_id, opts = {})
  data, _status_code, _headers = get_metric_with_http_info(metric_id, opts)
  data
end

#get_metric_collection(metric_collection_id, opts = {}) ⇒ Object

Get metric collection.



1644
1645
1646
1647
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 1644

def get_metric_collection(metric_collection_id, opts = {})
  data, _status_code, _headers = get_metric_collection_with_http_info(metric_collection_id, opts)
  data
end

#get_metric_collection_with_http_info(metric_collection_id, opts = {}) ⇒ Array<(ExperimentsMetricCollectionV2DTO, Integer, Hash)>

Get metric collection.

Get metric collection.

Parameters:

  • metric_collection_id (UUID) —

    The UUID of the metric collection.

  • opts (Hash) (defaults to: {}) —

    the optional parameters

Returns:



1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 1656

def get_metric_collection_with_http_info(metric_collection_id, opts = {})

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ExperimentsAPI.get_metric_collection ...'
  end
  # verify the required parameter 'metric_collection_id' is set
  if @api_client.config.client_side_validation && metric_collection_id.nil?
    fail ArgumentError, "Missing the required parameter 'metric_collection_id' when calling ExperimentsAPI.get_metric_collection"
  end
  # resource path
  local_var_path = '/api/v2/experiments/metric-collections/{metric_collection_id}'.sub('{metric_collection_id}', CGI.escape(metric_collection_id.to_s).gsub('%2F', '/'))

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

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

  # http body (model)
  post_body = opts[:debug_body]

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

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

  new_options = opts.merge(
    :operation => :get_metric_collection,
    :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::Get, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ExperimentsAPI#get_metric_collection\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_metric_sql_model(metric_sql_model_id, opts = {}) ⇒ Object

Get metric SQL model.



1709
1710
1711
1712
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 1709

def get_metric_sql_model(metric_sql_model_id, opts = {})
  data, _status_code, _headers = get_metric_sql_model_with_http_info(metric_sql_model_id, opts)
  data
end

#get_metric_sql_model_with_http_info(metric_sql_model_id, opts = {}) ⇒ Array<(ExperimentsMetricSQLModelV2DTO, Integer, Hash)>

Get metric SQL model.

Get a metric SQL model. Returns a single model by its ID for the organization, including its subject types, measures and properties.

Parameters:

  • metric_sql_model_id (UUID) —

    The UUID of the metric SQL model.

  • opts (Hash) (defaults to: {}) —

    the optional parameters

Options Hash (opts):

  • :include (Array<String>) —

    Optional fields to include. Repeat this parameter to request several fields. counts adds metric_count and experiment_count.

Returns:



1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 1722

def get_metric_sql_model_with_http_info(metric_sql_model_id, opts = {})

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ExperimentsAPI.get_metric_sql_model ...'
  end
  # verify the required parameter 'metric_sql_model_id' is set
  if @api_client.config.client_side_validation && metric_sql_model_id.nil?
    fail ArgumentError, "Missing the required parameter 'metric_sql_model_id' when calling ExperimentsAPI.get_metric_sql_model"
  end
  # resource path
  local_var_path = '/api/v2/experiments/metric-sql-models/{metric_sql_model_id}'.sub('{metric_sql_model_id}', CGI.escape(metric_sql_model_id.to_s).gsub('%2F', '/'))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'include'] = @api_client.build_collection_param(opts[:'include'], :multi) if !opts[:'include'].nil?

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

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

  # http body (model)
  post_body = opts[:debug_body]

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

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

  new_options = opts.merge(
    :operation => :get_metric_sql_model,
    :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"
  )
  new_options[:query_string_normalizer] = HTTParty::Request::NON_RAILS_QUERY_STRING_NORMALIZER

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

#get_metric_with_http_info(metric_id, opts = {}) ⇒ Array<(ExperimentsMetricV2DTO, Integer, Hash)>

Get metric.

Get a metric. Returns a single experiment metric by its ID for the organization.

Parameters:

  • metric_id (UUID) —

    The UUID of the metric.

  • opts (Hash) (defaults to: {}) —

    the optional parameters

Options Hash (opts):

  • :include (Array<String>) —

    Optional fields to include. Repeat this parameter to request several fields. counts adds experiment_count: how many experiments currently reference this metric.

Returns:

  • (Array<(ExperimentsMetricV2DTO, Integer, Hash)>) —

    ExperimentsMetricV2DTO data, response status code and response headers



1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 1589

def get_metric_with_http_info(metric_id, opts = {})

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ExperimentsAPI.get_metric ...'
  end
  # verify the required parameter 'metric_id' is set
  if @api_client.config.client_side_validation && metric_id.nil?
    fail ArgumentError, "Missing the required parameter 'metric_id' when calling ExperimentsAPI.get_metric"
  end
  # resource path
  local_var_path = '/api/v2/experiments/metrics/{metric_id}'.sub('{metric_id}', CGI.escape(metric_id.to_s).gsub('%2F', '/'))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'include'] = @api_client.build_collection_param(opts[:'include'], :multi) if !opts[:'include'].nil?

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

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

  # http body (model)
  post_body = opts[:debug_body]

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

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

  new_options = opts.merge(
    :operation => :get_metric,
    :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"
  )
  new_options[:query_string_normalizer] = HTTParty::Request::NON_RAILS_QUERY_STRING_NORMALIZER

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

#get_subject_type(subject_type_id, opts = {}) ⇒ Object

Get subject type.



1777
1778
1779
1780
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 1777

def get_subject_type(subject_type_id, opts = {})
  data, _status_code, _headers = get_subject_type_with_http_info(subject_type_id, opts)
  data
end

#get_subject_type_with_http_info(subject_type_id, opts = {}) ⇒ Array<(ExperimentsSubjectTypeV2DTO, Integer, Hash)>

Get subject type.

Get a subject type. Returns a single subject type by its ID for the organization.

Parameters:

  • subject_type_id (UUID) —

    The UUID of the subject type.

  • opts (Hash) (defaults to: {}) —

    the optional parameters

Options Hash (opts):

  • :include (String) —

    Set to counts to add experiment_count, exposure_source_count, metric_sql_model_count and protocol_count.

Returns:

  • (Array<(ExperimentsSubjectTypeV2DTO, Integer, Hash)>) —

    ExperimentsSubjectTypeV2DTO data, response status code and response headers



1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 1790

def get_subject_type_with_http_info(subject_type_id, opts = {})

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ExperimentsAPI.get_subject_type ...'
  end
  # verify the required parameter 'subject_type_id' is set
  if @api_client.config.client_side_validation && subject_type_id.nil?
    fail ArgumentError, "Missing the required parameter 'subject_type_id' when calling ExperimentsAPI.get_subject_type"
  end
  # resource path
  local_var_path = '/api/v2/experiments/subject-types/{subject_type_id}'.sub('{subject_type_id}', CGI.escape(subject_type_id.to_s).gsub('%2F', '/'))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'include'] = opts[:'include'] if !opts[:'include'].nil?

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

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

  # http body (model)
  post_body = opts[:debug_body]

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

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

  new_options = opts.merge(
    :operation => :get_subject_type,
    :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::Get, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ExperimentsAPI#get_subject_type\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_experiment_metric_groups(experiment_id, opts = {}) ⇒ Object

List experiment metric groups.



1844
1845
1846
1847
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 1844

def list_experiment_metric_groups(experiment_id, opts = {})
  data, _status_code, _headers = list_experiment_metric_groups_with_http_info(experiment_id, opts)
  data
end

#list_experiment_metric_groups_with_http_info(experiment_id, opts = {}) ⇒ Array<(ExperimentsExperimentMetricGroupV2DTOArray, Integer, Hash)>

List experiment metric groups.

List every decision and non-decision metric group attached to an experiment. Metric references are returned in their stored order. An incomplete draft can have no decision group and returns only the groups that exist.

Parameters:

  • experiment_id (UUID) —

    The UUID of the experiment.

  • opts (Hash) (defaults to: {}) —

    the optional parameters

Returns:



1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 1856

def list_experiment_metric_groups_with_http_info(experiment_id, opts = {})

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ExperimentsAPI.list_experiment_metric_groups ...'
  end
  # verify the required parameter 'experiment_id' is set
  if @api_client.config.client_side_validation && experiment_id.nil?
    fail ArgumentError, "Missing the required parameter 'experiment_id' when calling ExperimentsAPI.list_experiment_metric_groups"
  end
  # resource path
  local_var_path = '/api/v2/experiments/{experiment_id}/metric-groups'.sub('{experiment_id}', CGI.escape(experiment_id.to_s).gsub('%2F', '/'))

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

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

  # http body (model)
  post_body = opts[:debug_body]

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

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

  new_options = opts.merge(
    :operation => :list_experiment_metric_groups,
    :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::Get, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ExperimentsAPI#list_experiment_metric_groups\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_experiment_protocols(opts = {}) ⇒ Object

List experiment protocols.



1909
1910
1911
1912
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 1909

def list_experiment_protocols(opts = {})
  data, _status_code, _headers = list_experiment_protocols_with_http_info(opts)
  data
end

#list_experiment_protocols_with_http_info(opts = {}) ⇒ Array<(ExperimentsPublicProtocolListResponseArray, Integer, Hash)>

List experiment protocols.

List draft, published, and archived experiment protocols. Omit filter[status] to return all statuses. Only published protocols can be used to create experiments.

Parameters:

  • opts (Hash) (defaults to: {}) —

    the optional parameters

Options Hash (opts):

  • :filter_status (Array<ExperimentsPublicProtocolResponseDataAttributesStatus>) —

    Filter by protocol status. Repeat this parameter to select more than one status.

  • :filter_primary_metric_id (UUID) —

    Filter by the UUID of the primary metric in the protocol template.

  • :filter_query (String) —

    Find protocols whose names contain the search text, regardless of case. Leading and trailing spaces are ignored. Blank values apply no filter. The maximum length is 1024 UTF-8 bytes.

  • :filter_subject_type_id (UUID) —

    Filter by the UUID of the subject type in the protocol template.

  • :page_limit (Integer) —

    Number of results per page. The default is 25. Values above 50 are reduced to 50.

  • :page_offset (Integer) —

    Number of results to skip before returning this page.

  • :sort (String) —

    Sort by name, subject_type_name, primary_metric_name, or updated_at. Prefix with - for descending order. The default is -updated_at.

Returns:



1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 1927

def list_experiment_protocols_with_http_info(opts = {})

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ExperimentsAPI.list_experiment_protocols ...'
  end
  # resource path
  local_var_path = '/api/v2/experiments/protocols'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'filter[status]'] = @api_client.build_collection_param(opts[:'filter_status'], :multi) if !opts[:'filter_status'].nil?
  query_params[:'filter[primary_metric_id]'] = opts[:'filter_primary_metric_id'] if !opts[:'filter_primary_metric_id'].nil?
  query_params[:'filter[query]'] = opts[:'filter_query'] if !opts[:'filter_query'].nil?
  query_params[:'filter[subject_type_id]'] = opts[:'filter_subject_type_id'] if !opts[:'filter_subject_type_id'].nil?
  query_params[:'page[limit]'] = opts[:'page_limit'] if !opts[:'page_limit'].nil?
  query_params[:'page[offset]'] = opts[:'page_offset'] if !opts[:'page_offset'].nil?
  query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?

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

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

  # http body (model)
  post_body = opts[:debug_body]

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

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

  new_options = opts.merge(
    :operation => :list_experiment_protocols,
    :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"
  )
  new_options[:query_string_normalizer] = HTTParty::Request::NON_RAILS_QUERY_STRING_NORMALIZER

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

#list_experiments(opts = {}) ⇒ Object

List experiments.



1984
1985
1986
1987
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 1984

def list_experiments(opts = {})
  data, _status_code, _headers = list_experiments_with_http_info(opts)
  data
end

#list_experiments_with_http_info(opts = {}) ⇒ Array<(ExperimentsExperimentV2ListDTOArray, Integer, Hash)>

List experiments.

List experiments. Returns a paginated list of experiments and their structured metadata for the organization. Supports filtering and pagination. Use Get experiment for variants, decision metrics, traffic exposure, and assignment configuration.

Parameters:

  • opts (Hash) (defaults to: {}) —

    the optional parameters

Options Hash (opts):

  • :concluded_since (Time) —

    Return only experiments concluded at or after this RFC3339 timestamp. Inclusive, and excludes experiments that have not concluded.

  • :created_since (Time) —

    Return only experiments created at or after this RFC3339 timestamp. Inclusive.

  • :page_limit (Integer) —

    Maximum number of results to return. Defaults to 25 when omitted, and is capped at 50 (larger values are clamped to 50). The response includes meta.page (with total) and pagination links.

  • :page_offset (Integer) —

    Number of results to skip for pagination. Defaults to 0 when omitted.

  • :protocol_id (Array<UUID>) —

    Filter by protocol UUID. Repeat this parameter to supply several IDs. An experiment matches if it uses any listed protocol.

  • :results_updated_before (Time) —

    Return only experiments whose results_last_updated is before this RFC3339 timestamp. results_last_updated is the later of the latest successful run completion and the latest stored result refresh. Exclusive, and excludes experiments without successful results.

  • :results_updated_since (Time) —

    Return only experiments whose results_last_updated is at or after this RFC3339 timestamp. results_last_updated is the later of the latest successful run completion and the latest stored result refresh. Inclusive, and excludes experiments without successful results. This filter does not include all metadata edits or deletions.

  • :search (String) —

    Find experiments whose names contain the search text, regardless of case.

  • :sort (String) —

    Sort fields: name, created_at, or updated_at. Use a comma-separated list in priority order, for example name,-created_at. Prefix each field with - for descending. Defaults to created_at descending.

  • :status (Array<String>) —

    Filter by experiment status. Accepted values are DRAFT, SCHEDULED, IN_PROGRESS, READY_FOR_DECISION, DECISION_MADE, and CANCELLED. Repeat this parameter to select several statuses, for example status=IN_PROGRESS&status=READY_FOR_DECISION.

  • :tags (Array<String>) —

    Filter by tag name. Repeat this parameter to supply several tags. An experiment matches if it has at least one listed tag.

Returns:



2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 2006

def list_experiments_with_http_info(opts = {})

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ExperimentsAPI.list_experiments ...'
  end
  # resource path
  local_var_path = '/api/v2/experiments'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'concluded_since'] = opts[:'concluded_since'] if !opts[:'concluded_since'].nil?
  query_params[:'created_since'] = opts[:'created_since'] if !opts[:'created_since'].nil?
  query_params[:'page[limit]'] = opts[:'page_limit'] if !opts[:'page_limit'].nil?
  query_params[:'page[offset]'] = opts[:'page_offset'] if !opts[:'page_offset'].nil?
  query_params[:'protocol_id'] = @api_client.build_collection_param(opts[:'protocol_id'], :multi) if !opts[:'protocol_id'].nil?
  query_params[:'results_updated_before'] = opts[:'results_updated_before'] if !opts[:'results_updated_before'].nil?
  query_params[:'results_updated_since'] = opts[:'results_updated_since'] if !opts[:'results_updated_since'].nil?
  query_params[:'search'] = opts[:'search'] if !opts[:'search'].nil?
  query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?
  query_params[:'status'] = @api_client.build_collection_param(opts[:'status'], :multi) if !opts[:'status'].nil?
  query_params[:'tags'] = @api_client.build_collection_param(opts[:'tags'], :multi) if !opts[:'tags'].nil?

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

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

  # http body (model)
  post_body = opts[:debug_body]

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

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

  new_options = opts.merge(
    :operation => :list_experiments,
    :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"
  )
  new_options[:query_string_normalizer] = HTTParty::Request::NON_RAILS_QUERY_STRING_NORMALIZER

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

#list_exposure_sql_models(opts = {}) ⇒ Object

List exposure SQL models.



2067
2068
2069
2070
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 2067

def list_exposure_sql_models(opts = {})
  data, _status_code, _headers = list_exposure_sql_models_with_http_info(opts)
  data
end

#list_exposure_sql_models_with_http_info(opts = {}) ⇒ Array<(ExperimentsExposureSQLModelV2DTOArray, Integer, Hash)>

List exposure SQL models.

List exposure SQL models. Returns a paginated list of the SQL models that experiment exposures are read from for the organization. Models maintained by Datadog are not included: they cannot be modified and cannot be used as an experiment's assignment source.

Parameters:

  • opts (Hash) (defaults to: {}) —

    the optional parameters

Options Hash (opts):

  • :include (Array<String>) —

    Optional fields to include. Repeat this parameter to request several fields. counts adds experiment_count, which costs an extra aggregate query.

  • :include_archived (Boolean) —

    When true, archived models are included in the result. Defaults to false, so archived models are hidden.

  • :page_limit (Integer) —

    Maximum number of results to return. Defaults to 25 when omitted, and is capped at 50 (larger values are clamped to 50). The response includes meta.page (with total) and pagination links.

  • :page_offset (Integer) —

    Number of results to skip for pagination. Defaults to 0 when omitted.

  • :search (String) —

    Find exposure SQL models whose names contain the search text, regardless of case.

  • :sort (String) —

    Sort field: name, created_at, or updated_at. Prefix with - for descending (for example, -created_at). Defaults to created_at descending.

Returns:



2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 2084

def list_exposure_sql_models_with_http_info(opts = {})

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ExperimentsAPI.list_exposure_sql_models ...'
  end
  # resource path
  local_var_path = '/api/v2/experiments/exposure-sql-models'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'include'] = @api_client.build_collection_param(opts[:'include'], :multi) if !opts[:'include'].nil?
  query_params[:'include_archived'] = opts[:'include_archived'] if !opts[:'include_archived'].nil?
  query_params[:'page[limit]'] = opts[:'page_limit'] if !opts[:'page_limit'].nil?
  query_params[:'page[offset]'] = opts[:'page_offset'] if !opts[:'page_offset'].nil?
  query_params[:'search'] = opts[:'search'] if !opts[:'search'].nil?
  query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?

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

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

  # http body (model)
  post_body = opts[:debug_body]

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

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

  new_options = opts.merge(
    :operation => :list_exposure_sql_models,
    :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"
  )
  new_options[:query_string_normalizer] = HTTParty::Request::NON_RAILS_QUERY_STRING_NORMALIZER

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

#list_metric_collections(opts = {}) ⇒ Object

List metric collections.



2140
2141
2142
2143
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 2140

def list_metric_collections(opts = {})
  data, _status_code, _headers = list_metric_collections_with_http_info(opts)
  data
end

#list_metric_collections_with_http_info(opts = {}) ⇒ Array<(ExperimentsMetricCollectionV2DTOArray, Integer, Hash)>

List metric collections.

List metric collections for the organization. Collections are reusable ordered metric sets; attaching one to an experiment creates an independent snapshot.

Parameters:

  • opts (Hash) (defaults to: {}) —

    the optional parameters

Options Hash (opts):

  • :include (Array<String>) —

    Optional fields to include. Repeat this parameter to request several fields. counts adds metric_count.

  • :page_limit (Integer) —

    Number of results per page. The default is 25. Values above 50 are reduced to 50.

  • :page_offset (Integer) —

    Number of results to skip before returning this page.

  • :search (String) —

    Find collections whose names contain the search text, regardless of case. Leading and trailing spaces are ignored. Blank values apply no filter. The maximum length is 1024 UTF-8 bytes.

  • :sort (String) —

    Sort by one field: name, created_at, or updated_at. Prefix with - for descending order. The default is -created_at.

Returns:



2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 2156

def list_metric_collections_with_http_info(opts = {})

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ExperimentsAPI.list_metric_collections ...'
  end
  # resource path
  local_var_path = '/api/v2/experiments/metric-collections'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'include'] = @api_client.build_collection_param(opts[:'include'], :multi) if !opts[:'include'].nil?
  query_params[:'page[limit]'] = opts[:'page_limit'] if !opts[:'page_limit'].nil?
  query_params[:'page[offset]'] = opts[:'page_offset'] if !opts[:'page_offset'].nil?
  query_params[:'search'] = opts[:'search'] if !opts[:'search'].nil?
  query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?

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

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

  # http body (model)
  post_body = opts[:debug_body]

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

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

  new_options = opts.merge(
    :operation => :list_metric_collections,
    :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"
  )
  new_options[:query_string_normalizer] = HTTParty::Request::NON_RAILS_QUERY_STRING_NORMALIZER

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

#list_metric_sql_models(opts = {}) ⇒ Object

List metric SQL models.



2282
2283
2284
2285
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 2282

def list_metric_sql_models(opts = {})
  data, _status_code, _headers = list_metric_sql_models_with_http_info(opts)
  data
end

#list_metric_sql_models_with_http_info(opts = {}) ⇒ Array<(ExperimentsMetricSQLModelV2DTOArray, Integer, Hash)>

List metric SQL models.

List metric SQL models. Returns a paginated list of the SQL models that metrics are defined on for the organization.

Parameters:

  • opts (Hash) (defaults to: {}) —

    the optional parameters

Options Hash (opts):

  • :include (Array<String>) —

    Optional fields to include. Repeat this parameter to request several fields. counts adds metric_count and experiment_count, which cost an extra aggregate query.

  • :page_limit (Integer) —

    Maximum number of results to return. Defaults to 25 when omitted, and is capped at 50 (larger values are clamped to 50). The response includes meta.page (with total) and pagination links.

  • :page_offset (Integer) —

    Number of results to skip for pagination. Defaults to 0 when omitted.

  • :sort (String) —

    Sort field: name, created_at, updated_at, metric_count, or experiment_count. A single field only; a comma-separated list is rejected. Prefix with - for descending (for example, -created_at). Defaults to created_at descending.

Returns:



2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 2297

def list_metric_sql_models_with_http_info(opts = {})

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ExperimentsAPI.list_metric_sql_models ...'
  end
  # resource path
  local_var_path = '/api/v2/experiments/metric-sql-models'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'include'] = @api_client.build_collection_param(opts[:'include'], :multi) if !opts[:'include'].nil?
  query_params[:'page[limit]'] = opts[:'page_limit'] if !opts[:'page_limit'].nil?
  query_params[:'page[offset]'] = opts[:'page_offset'] if !opts[:'page_offset'].nil?
  query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?

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

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

  # http body (model)
  post_body = opts[:debug_body]

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

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

  new_options = opts.merge(
    :operation => :list_metric_sql_models,
    :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"
  )
  new_options[:query_string_normalizer] = HTTParty::Request::NON_RAILS_QUERY_STRING_NORMALIZER

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

#list_metrics(opts = {}) ⇒ Object

List metrics.



2211
2212
2213
2214
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 2211

def list_metrics(opts = {})
  data, _status_code, _headers = list_metrics_with_http_info(opts)
  data
end

#list_metrics_with_http_info(opts = {}) ⇒ Array<(ExperimentsMetricV2DTOArray, Integer, Hash)>

List metrics.

List metrics. Returns a paginated list of the experiment metrics defined for the organization.

Parameters:

  • opts (Hash) (defaults to: {}) —

    the optional parameters

Options Hash (opts):

  • :include (Array<String>) —

    Optional fields to include. Repeat this parameter to request several fields. counts adds experiment_count on each metric, which costs an extra aggregate query.

  • :page_limit (Integer) —

    Maximum number of results to return. Defaults to 25 when omitted, and is capped at 50 (larger values are clamped to 50). The response includes meta.page (with total) and pagination links.

  • :page_offset (Integer) —

    Number of results to skip for pagination. Defaults to 0 when omitted.

  • :search (String) —

    Find metrics whose names contain the search text, regardless of case.

  • :sort (String) —

    Sort field: name, created_at, or updated_at. Prefix with - for descending (for example, -created_at). A single field only; a comma-separated list is rejected. Defaults to created_at descending.

Returns:

  • (Array<(ExperimentsMetricV2DTOArray, Integer, Hash)>) —

    ExperimentsMetricV2DTOArray data, response status code and response headers



2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 2227

def list_metrics_with_http_info(opts = {})

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ExperimentsAPI.list_metrics ...'
  end
  # resource path
  local_var_path = '/api/v2/experiments/metrics'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'include'] = @api_client.build_collection_param(opts[:'include'], :multi) if !opts[:'include'].nil?
  query_params[:'page[limit]'] = opts[:'page_limit'] if !opts[:'page_limit'].nil?
  query_params[:'page[offset]'] = opts[:'page_offset'] if !opts[:'page_offset'].nil?
  query_params[:'search'] = opts[:'search'] if !opts[:'search'].nil?
  query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?

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

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

  # http body (model)
  post_body = opts[:debug_body]

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

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

  new_options = opts.merge(
    :operation => :list_metrics,
    :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"
  )
  new_options[:query_string_normalizer] = HTTParty::Request::NON_RAILS_QUERY_STRING_NORMALIZER

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

#list_subject_types(opts = {}) ⇒ Object

List subject types.



2351
2352
2353
2354
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 2351

def list_subject_types(opts = {})
  data, _status_code, _headers = list_subject_types_with_http_info(opts)
  data
end

#list_subject_types_with_http_info(opts = {}) ⇒ Array<(ExperimentsSubjectTypeV2DTOArray, Integer, Hash)>

List subject types.

List subject types. Returns a paginated list of the subject types defined for the organization.

Parameters:

  • opts (Hash) (defaults to: {}) —

    the optional parameters

Options Hash (opts):

  • :include (String) —

    Set to counts to add experiment_count, exposure_source_count, metric_sql_model_count and protocol_count to each subject type. Each costs an extra query, so they are omitted unless asked for.

  • :page_limit (Integer) —

    Maximum number of results to return. Defaults to 25 when omitted, and is capped at 50 (larger values are clamped to 50). The response includes meta.page (with total) and pagination links.

  • :page_offset (Integer) —

    Number of results to skip for pagination. Defaults to 0 when omitted.

  • :search (String) —

    Find subject types whose names contain the search text, regardless of case.

  • :sort (String) —

    Sort fields: name, created_at, or updated_at. Use a comma-separated list in priority order, for example name,-created_at. Prefix each field with - for descending. Defaults to created_at descending.

Returns:



2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 2367

def list_subject_types_with_http_info(opts = {})

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ExperimentsAPI.list_subject_types ...'
  end
  # resource path
  local_var_path = '/api/v2/experiments/subject-types'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'include'] = opts[:'include'] if !opts[:'include'].nil?
  query_params[:'page[limit]'] = opts[:'page_limit'] if !opts[:'page_limit'].nil?
  query_params[:'page[offset]'] = opts[:'page_offset'] if !opts[:'page_offset'].nil?
  query_params[:'search'] = opts[:'search'] if !opts[:'search'].nil?
  query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?

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

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

  # http body (model)
  post_body = opts[:debug_body]

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

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

  new_options = opts.merge(
    :operation => :list_subject_types,
    :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::Get, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ExperimentsAPI#list_subject_types\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#patch_experiment(experiment_id, body, opts = {}) ⇒ Object

Patch experiment.



2421
2422
2423
2424
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 2421

def patch_experiment(experiment_id, body, opts = {})
  data, _status_code, _headers = patch_experiment_with_http_info(experiment_id, body, opts)
  data
end

#patch_experiment_with_http_info(experiment_id, body, opts = {}) ⇒ Array<(ExperimentsPatchExperimentV2Response, Integer, Hash)>

Patch experiment.

Update mutable experiment fields. State and protocol restrictions apply.

PATCH behavior

  • Omitted fields stay unchanged, including fields inside datadog_flag_configuration.
  • Supplied tags, teams, related_links, decision_metrics, and variants replace their stored lists.
  • Validation can return several field errors before saving any changes. The response is HTTP 400 if any error concerns invalid input. It is HTTP 409 if all errors concern state or protocol conflicts.

Result refreshes

This endpoint does not start a pipeline run. meta.needs_pipeline_refresh states whether the edit requires a run. When true, POST to meta.refresh_endpoint after finishing your edits. Its full_refresh query parameter selects the run type.

Keep refresh requirements across edits. A later false value does not clear an earlier requirement. Any full_refresh=true requirement takes priority.

After start, STATIC and STEPS exposure changes for warehouse experiments without a Datadog flag attempt to recalculate stored results. Changes to decision metrics or the control variant also attempt recalculation when results exist. If stored data is insufficient or recalculation fails, the edit stays saved and meta.needs_pipeline_refresh is true.

Exposure rules

  • Draft experiments can replace the full STATIC or STEPS plan through traffic_exposure.
  • Warehouse steps start at assignments_start_date and can have different durations.
  • Running warehouse experiments can replace step fractions, durations, and exposure mode. Retained variant weights cannot change through this API. You can send unchanged values again.
  • After a warehouse experiment ends, configuration replacement supports only STATIC fraction changes.
  • New Datadog plans have at most five steps. The first fraction must be positive. All steps except the last have equal durations. Durations exclude pauses.
  • The last step has a null duration. Its fraction stays in effect until assignment ends.
  • After start, use the experiment UI to change traffic exposure for experiments linked to a Datadog flag.

Metadata

structured_metadata updates fields by field_key. Use freetext_value: "" or enum_values: [] to clear an optional field. Omitted fields stay unchanged. A null or empty structured_metadata attribute makes no change.

Flag changes

Before start, a Datadog update creates or edits the saved draft allocation. To add or replace a flag, send variants and traffic_exposure. Inside datadog_flag_configuration, send feature_flag_id, environment_id, targeting_rules, and entry_point. Use targeting_rules: [] and entry_point: null when unused.

To replace a flag, also set reset_on_feature_flag_change: true inside that object. The server deletes the old draft and creates a new one in the same transaction. The response includes a datadog_flag_configuration_reset warning in meta.warnings.

Set datadog_flag_configuration: null to delete the draft allocation. This also clears the experiment's flag association, variants, assignment sources, and entry point. The experiment remains.

Flag replacement and removal require a draft experiment without warehouse exposure. These actions do not convert hybrid experiments.

Parameters:

Returns:



2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 2490

def patch_experiment_with_http_info(experiment_id, body, opts = {})

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ExperimentsAPI.patch_experiment ...'
  end
  # verify the required parameter 'experiment_id' is set
  if @api_client.config.client_side_validation && experiment_id.nil?
    fail ArgumentError, "Missing the required parameter 'experiment_id' when calling ExperimentsAPI.patch_experiment"
  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 ExperimentsAPI.patch_experiment"
  end
  # resource path
  local_var_path = '/api/v2/experiments/{experiment_id}'.sub('{experiment_id}', CGI.escape(experiment_id.to_s).gsub('%2F', '/'))

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

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

  new_options = opts.merge(
    :operation => :patch_experiment,
    :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::Patch, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ExperimentsAPI#patch_experiment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#patch_subject_type(subject_type_id, body, opts = {}) ⇒ Object

Patch subject type.



2549
2550
2551
2552
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 2549

def patch_subject_type(subject_type_id, body, opts = {})
  data, _status_code, _headers = patch_subject_type_with_http_info(subject_type_id, body, opts)
  data
end

#patch_subject_type_with_http_info(subject_type_id, body, opts = {}) ⇒ Array<(ExperimentsSubjectTypeV2DTO, Integer, Hash)>

Patch subject type.

Update mutable fields on a subject type. Only the fields present in the body are changed. Any subject type can be updated, including the organization's default one, but the is_default flag itself is read-only here: which subject type is the default cannot be changed through this endpoint.

Parameters:

Returns:

  • (Array<(ExperimentsSubjectTypeV2DTO, Integer, Hash)>) —

    ExperimentsSubjectTypeV2DTO data, response status code and response headers



2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 2562

def patch_subject_type_with_http_info(subject_type_id, body, opts = {})

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ExperimentsAPI.patch_subject_type ...'
  end
  # verify the required parameter 'subject_type_id' is set
  if @api_client.config.client_side_validation && subject_type_id.nil?
    fail ArgumentError, "Missing the required parameter 'subject_type_id' when calling ExperimentsAPI.patch_subject_type"
  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 ExperimentsAPI.patch_subject_type"
  end
  # resource path
  local_var_path = '/api/v2/experiments/subject-types/{subject_type_id}'.sub('{subject_type_id}', CGI.escape(subject_type_id.to_s).gsub('%2F', '/'))

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

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

  new_options = opts.merge(
    :operation => :patch_subject_type,
    :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::Patch, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ExperimentsAPI#patch_subject_type\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#refresh_experiment_results(experiment_id, opts = {}) ⇒ Object

Refresh experiment results.



2621
2622
2623
2624
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 2621

def refresh_experiment_results(experiment_id, opts = {})
  data, _status_code, _headers = refresh_experiment_results_with_http_info(experiment_id, opts)
  data
end

#refresh_experiment_results_for_org(opts = {}) ⇒ Object

Refresh experiment results for org.



2688
2689
2690
2691
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 2688

def refresh_experiment_results_for_org(opts = {})
  data, _status_code, _headers = refresh_experiment_results_for_org_with_http_info(opts)
  data
end

#refresh_experiment_results_for_org_with_http_info(opts = {}) ⇒ Array<(ExperimentsRefreshExperimentResultsV2DTOArray, Integer, Hash)>

Refresh experiment results for org.

Trigger a results refresh across the organization's active experiments. Returns the count of experiments whose refresh was triggered (meta.experiments_updated) plus a per-experiment breakdown of what happened to each (meta.results).

Parameters:

  • opts (Hash) (defaults to: {}) —

    the optional parameters

Options Hash (opts):

  • :full_refresh (Boolean) —

    Force a full warehouse rebuild. Defaults to false when omitted.

Returns:



2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 2700

def refresh_experiment_results_for_org_with_http_info(opts = {})

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ExperimentsAPI.refresh_experiment_results_for_org ...'
  end
  # resource path
  local_var_path = '/api/v2/experiments/results/refresh'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'full_refresh'] = opts[:'full_refresh'] if !opts[:'full_refresh'].nil?

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

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

  # http body (model)
  post_body = opts[:debug_body]

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

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

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

#refresh_experiment_results_with_http_info(experiment_id, opts = {}) ⇒ Array<(ExperimentsRefreshExperimentResultsV2DTO, Integer, Hash)>

Refresh experiment results.

Request a results refresh for one experiment. HTTP 202 confirms acceptance, not completed results. The response identifies the experiment and does not include a job ID. Read experiment results to check freshness. A request while a refresh is queued or running returns 409. After completion, another request can start another refresh.

Parameters:

  • experiment_id (UUID) —

    The UUID of the experiment.

  • opts (Hash) (defaults to: {}) —

    the optional parameters

Options Hash (opts):

  • :full_refresh (Boolean) —

    Force a full warehouse rebuild. Defaults to false when omitted.

Returns:



2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 2634

def refresh_experiment_results_with_http_info(experiment_id, opts = {})

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ExperimentsAPI.refresh_experiment_results ...'
  end
  # verify the required parameter 'experiment_id' is set
  if @api_client.config.client_side_validation && experiment_id.nil?
    fail ArgumentError, "Missing the required parameter 'experiment_id' when calling ExperimentsAPI.refresh_experiment_results"
  end
  # resource path
  local_var_path = '/api/v2/experiments/{experiment_id}/results/refresh'.sub('{experiment_id}', CGI.escape(experiment_id.to_s).gsub('%2F', '/'))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'full_refresh'] = opts[:'full_refresh'] if !opts[:'full_refresh'].nil?

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

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

  # http body (model)
  post_body = opts[:debug_body]

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

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

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

#set_default_subject_type(subject_type_id, opts = {}) ⇒ Object

Set default subject type.



2750
2751
2752
2753
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 2750

def set_default_subject_type(subject_type_id, opts = {})
  set_default_subject_type_with_http_info(subject_type_id, opts)
  nil
end

#set_default_subject_type_with_http_info(subject_type_id, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Set default subject type.

Make this subject type the organization's default. Experiment creation uses the default when the request names no subject type. Promoting one subject type demotes the previous default in the same transaction, so the organization always has exactly one. The call is idempotent: promoting the current default succeeds and changes nothing. There is no matching demote, because an organization cannot have no default; promote a different subject type instead.

Parameters:

  • subject_type_id (UUID) —

    The UUID of the subject type.

  • opts (Hash) (defaults to: {}) —

    the optional parameters

Returns:

  • (Array<(nil, Integer, Hash)>) —

    nil, response status code and response headers



2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 2762

def set_default_subject_type_with_http_info(subject_type_id, opts = {})

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ExperimentsAPI.set_default_subject_type ...'
  end
  # verify the required parameter 'subject_type_id' is set
  if @api_client.config.client_side_validation && subject_type_id.nil?
    fail ArgumentError, "Missing the required parameter 'subject_type_id' when calling ExperimentsAPI.set_default_subject_type"
  end
  # resource path
  local_var_path = '/api/v2/experiments/subject-types/{subject_type_id}/default'.sub('{subject_type_id}', CGI.escape(subject_type_id.to_s).gsub('%2F', '/'))

  # 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(['*/*'])

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

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type]

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

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

#start_experiment(experiment_id, opts = {}) ⇒ Object

Start experiment.



2815
2816
2817
2818
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 2815

def start_experiment(experiment_id, opts = {})
  start_experiment_with_http_info(experiment_id, opts)
  nil
end

#start_experiment_with_http_info(experiment_id, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Start experiment.

Start an experiment. The experiment is started exactly as it is configured; this endpoint accepts no attributes, and a request body carrying any is rejected rather than ignored. Set the run window, duration, or variants with PATCH /api/v2/experiments/experiment_id before starting. An unconfigured draft returns HTTP 409. Configure either warehouse_exposure_configuration or datadog_flag_configuration, plus the required experiment fields, before starting. Start validation errors can include meta.configuration_pointer to identify a field on the experiment to correct. For a flag-backed experiment this enables the linked feature flag's environment, clears any stored variant override on it, and starts the allocation's rollout. The request is idempotent: an experiment that is already running or ready for a decision still returns 204, so a retry after a timeout is safe. One exception: an experiment scheduled to start is accepted only when it is backed by your own feature flag; a Datadog-flag experiment in that state returns 409 because its stored state and flag allocation disagree. Cancel and conclude are not idempotent and return 409 when repeated.

Parameters:

  • experiment_id (UUID) —

    The UUID of the experiment.

  • opts (Hash) (defaults to: {}) —

    the optional parameters

Options Hash (opts):

Returns:

  • (Array<(nil, Integer, Hash)>) —

    nil, response status code and response headers



2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 2828

def start_experiment_with_http_info(experiment_id, opts = {})

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ExperimentsAPI.start_experiment ...'
  end
  # verify the required parameter 'experiment_id' is set
  if @api_client.config.client_side_validation && experiment_id.nil?
    fail ArgumentError, "Missing the required parameter 'experiment_id' when calling ExperimentsAPI.start_experiment"
  end
  # resource path
  local_var_path = '/api/v2/experiments/{experiment_id}/start'.sub('{experiment_id}', CGI.escape(experiment_id.to_s).gsub('%2F', '/'))

  # 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(['*/*'])
  # 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(opts[:'body'])

  # return_type
  return_type = opts[:debug_return_type]

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

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

#unarchive_exposure_sql_model(exposure_sql_model_id, opts = {}) ⇒ Object

Unarchive exposure SQL model.



2883
2884
2885
2886
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 2883

def unarchive_exposure_sql_model(exposure_sql_model_id, opts = {})
  unarchive_exposure_sql_model_with_http_info(exposure_sql_model_id, opts)
  nil
end

#unarchive_exposure_sql_model_with_http_info(exposure_sql_model_id, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Unarchive exposure SQL model.

Unarchive an exposure SQL model. Restores an archived model to the default list.

Parameters:

  • exposure_sql_model_id (UUID) —

    The UUID of the exposure SQL model.

  • opts (Hash) (defaults to: {}) —

    the optional parameters

Returns:

  • (Array<(nil, Integer, Hash)>) —

    nil, response status code and response headers



2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 2895

def unarchive_exposure_sql_model_with_http_info(exposure_sql_model_id, opts = {})

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ExperimentsAPI.unarchive_exposure_sql_model ...'
  end
  # verify the required parameter 'exposure_sql_model_id' is set
  if @api_client.config.client_side_validation && exposure_sql_model_id.nil?
    fail ArgumentError, "Missing the required parameter 'exposure_sql_model_id' when calling ExperimentsAPI.unarchive_exposure_sql_model"
  end
  # resource path
  local_var_path = '/api/v2/experiments/exposure-sql-models/{exposure_sql_model_id}/unarchive'.sub('{exposure_sql_model_id}', CGI.escape(exposure_sql_model_id.to_s).gsub('%2F', '/'))

  # 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(['*/*'])

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

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type]

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

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

#update_experiment_analysis_plan_attributes(experiment_id, body, opts = {}) ⇒ Object

Update experiment analysis plan attributes.



2948
2949
2950
2951
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 2948

def update_experiment_analysis_plan_attributes(experiment_id, body, opts = {})
  data, _status_code, _headers = update_experiment_analysis_plan_attributes_with_http_info(experiment_id, body, opts)
  data
end

#update_experiment_analysis_plan_attributes_with_http_info(experiment_id, body, opts = {}) ⇒ Array<(ExperimentsAnalysisPlanV2MutationResponse, Integer, Hash)>

Update experiment analysis plan attributes.

Update selected statistical analysis settings. Omitted attributes remain unchanged and nullable attributes can be cleared with null. Protocol-locked settings cannot be changed.

Parameters:

Returns:



2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 2961

def update_experiment_analysis_plan_attributes_with_http_info(experiment_id, body, opts = {})

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ExperimentsAPI.update_experiment_analysis_plan_attributes ...'
  end
  # verify the required parameter 'experiment_id' is set
  if @api_client.config.client_side_validation && experiment_id.nil?
    fail ArgumentError, "Missing the required parameter 'experiment_id' when calling ExperimentsAPI.update_experiment_analysis_plan_attributes"
  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 ExperimentsAPI.update_experiment_analysis_plan_attributes"
  end
  # resource path
  local_var_path = '/api/v2/experiments/{experiment_id}/analysis-plan'.sub('{experiment_id}', CGI.escape(experiment_id.to_s).gsub('%2F', '/'))

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

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

  new_options = opts.merge(
    :operation => :update_experiment_analysis_plan_attributes,
    :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::Patch, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ExperimentsAPI#update_experiment_analysis_plan_attributes\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#update_experiment_metric_group(experiment_id, metric_group_id, body, opts = {}) ⇒ Object

Update experiment metric group.



3020
3021
3022
3023
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 3020

def update_experiment_metric_group(experiment_id, metric_group_id, body, opts = {})
  data, _status_code, _headers = update_experiment_metric_group_with_http_info(experiment_id, metric_group_id, body, opts)
  data
end

#update_experiment_metric_group_with_http_info(experiment_id, metric_group_id, body, opts = {}) ⇒ Array<(ExperimentsExperimentMetricGroupMutationV2, Integer, Hash)>

Update experiment metric group.

Update a non-decision metric group. Omitted attributes are unchanged; a supplied metrics array is the complete ordered replacement. Decision groups remain managed through the experiment resource. This operation does not synchronously recompute results.

Parameters:

Returns:



3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 3034

def update_experiment_metric_group_with_http_info(experiment_id, metric_group_id, body, opts = {})

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ExperimentsAPI.update_experiment_metric_group ...'
  end
  # verify the required parameter 'experiment_id' is set
  if @api_client.config.client_side_validation && experiment_id.nil?
    fail ArgumentError, "Missing the required parameter 'experiment_id' when calling ExperimentsAPI.update_experiment_metric_group"
  end
  # verify the required parameter 'metric_group_id' is set
  if @api_client.config.client_side_validation && metric_group_id.nil?
    fail ArgumentError, "Missing the required parameter 'metric_group_id' when calling ExperimentsAPI.update_experiment_metric_group"
  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 ExperimentsAPI.update_experiment_metric_group"
  end
  # resource path
  local_var_path = '/api/v2/experiments/{experiment_id}/metric-groups/{metric_group_id}'.sub('{experiment_id}', CGI.escape(experiment_id.to_s).gsub('%2F', '/')).sub('{metric_group_id}', CGI.escape(metric_group_id.to_s).gsub('%2F', '/'))

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

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

  new_options = opts.merge(
    :operation => :update_experiment_metric_group,
    :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::Patch, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ExperimentsAPI#update_experiment_metric_group\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#update_exposure_sql_model(exposure_sql_model_id, body, opts = {}) ⇒ Object

Update exposure SQL model.



3097
3098
3099
3100
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 3097

def update_exposure_sql_model(exposure_sql_model_id, body, opts = {})
  data, _status_code, _headers = update_exposure_sql_model_with_http_info(exposure_sql_model_id, body, opts)
  data
end

#update_exposure_sql_model_with_http_info(exposure_sql_model_id, body, opts = {}) ⇒ Array<(ExperimentsUpdateExposureSQLModelV2Response, Integer, Hash)>

Update exposure SQL model.

Replace an exposure SQL model. This is a full replacement and is destructive: any subject type or property not present in the body is deleted, and properties are matched on name, column_name and column_type together, so changing one of those replaces the property rather than editing it. Send the complete set you want to keep. Anything removed is listed under meta.removed_subject_type_ids and meta.removed_property_names in the response. The warehouse connection is not settable and is left as stored.

Parameters:

Options Hash (opts):

  • :include (Array<String>) —

    Optional fields to include. Repeat this parameter to request several fields. counts adds experiment_count to the updated model.

Returns:



3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 3111

def update_exposure_sql_model_with_http_info(exposure_sql_model_id, body, opts = {})

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ExperimentsAPI.update_exposure_sql_model ...'
  end
  # verify the required parameter 'exposure_sql_model_id' is set
  if @api_client.config.client_side_validation && exposure_sql_model_id.nil?
    fail ArgumentError, "Missing the required parameter 'exposure_sql_model_id' when calling ExperimentsAPI.update_exposure_sql_model"
  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 ExperimentsAPI.update_exposure_sql_model"
  end
  # resource path
  local_var_path = '/api/v2/experiments/exposure-sql-models/{exposure_sql_model_id}'.sub('{exposure_sql_model_id}', CGI.escape(exposure_sql_model_id.to_s).gsub('%2F', '/'))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'include'] = @api_client.build_collection_param(opts[:'include'], :multi) if !opts[:'include'].nil?

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

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

  new_options = opts.merge(
    :operation => :update_exposure_sql_model,
    :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"
  )
  new_options[:query_string_normalizer] = HTTParty::Request::NON_RAILS_QUERY_STRING_NORMALIZER

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

#update_metric(metric_id, body, opts = {}) ⇒ Object

Update metric.



3172
3173
3174
3175
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 3172

def update_metric(metric_id, body, opts = {})
  data, _status_code, _headers = update_metric_with_http_info(metric_id, body, opts)
  data
end

#update_metric_collection(metric_collection_id, body, opts = {}) ⇒ Object

Update metric collection.



3244
3245
3246
3247
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 3244

def update_metric_collection(metric_collection_id, body, opts = {})
  data, _status_code, _headers = update_metric_collection_with_http_info(metric_collection_id, body, opts)
  data
end

#update_metric_collection_with_http_info(metric_collection_id, body, opts = {}) ⇒ Array<(ExperimentsMetricCollectionV2DTO, Integer, Hash)>

Update metric collection.

Update metric collection.

Parameters:

Returns:



3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 3257

def update_metric_collection_with_http_info(metric_collection_id, body, opts = {})

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ExperimentsAPI.update_metric_collection ...'
  end
  # verify the required parameter 'metric_collection_id' is set
  if @api_client.config.client_side_validation && metric_collection_id.nil?
    fail ArgumentError, "Missing the required parameter 'metric_collection_id' when calling ExperimentsAPI.update_metric_collection"
  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 ExperimentsAPI.update_metric_collection"
  end
  # resource path
  local_var_path = '/api/v2/experiments/metric-collections/{metric_collection_id}'.sub('{metric_collection_id}', CGI.escape(metric_collection_id.to_s).gsub('%2F', '/'))

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

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

  new_options = opts.merge(
    :operation => :update_metric_collection,
    :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::Patch, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ExperimentsAPI#update_metric_collection\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#update_metric_sql_model(metric_sql_model_id, body, opts = {}) ⇒ Object

Update metric SQL model.



3316
3317
3318
3319
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 3316

def update_metric_sql_model(metric_sql_model_id, body, opts = {})
  data, _status_code, _headers = update_metric_sql_model_with_http_info(metric_sql_model_id, body, opts)
  data
end

#update_metric_sql_model_with_http_info(metric_sql_model_id, body, opts = {}) ⇒ Array<(ExperimentsUpdateMetricSQLModelV2Response, Integer, Hash)>

Update metric SQL model.

Replace a metric SQL model. This is a destructive full replace: subject types, customer-defined measures, and properties absent from the body are deleted, so send the complete set. Properties are matched by name; changing a property's column, type, or description preserves its ID. column_type is required for every measure and property. Removing a measure or property that an active metric references returns 409 Conflict. Server-generated IDs returned by GET are read-only and can be left in a replayed body. The response reports removals in meta.deleted_subject_types, meta.deleted_measures, and meta.deleted_properties. Certification is read-only. Certified models cannot be replaced through this endpoint.

Parameters:

Returns:



3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 3329

def update_metric_sql_model_with_http_info(metric_sql_model_id, body, opts = {})

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ExperimentsAPI.update_metric_sql_model ...'
  end
  # verify the required parameter 'metric_sql_model_id' is set
  if @api_client.config.client_side_validation && metric_sql_model_id.nil?
    fail ArgumentError, "Missing the required parameter 'metric_sql_model_id' when calling ExperimentsAPI.update_metric_sql_model"
  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 ExperimentsAPI.update_metric_sql_model"
  end
  # resource path
  local_var_path = '/api/v2/experiments/metric-sql-models/{metric_sql_model_id}'.sub('{metric_sql_model_id}', CGI.escape(metric_sql_model_id.to_s).gsub('%2F', '/'))

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

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

  new_options = opts.merge(
    :operation => :update_metric_sql_model,
    :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::Put, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ExperimentsAPI#update_metric_sql_model\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#update_metric_with_http_info(metric_id, body, opts = {}) ⇒ Array<(ExperimentsMetricV2DTO, Integer, Hash)>

Update metric.

Update a metric. Certified metrics are read-only through this endpoint. This is a partial update: every attribute is optional and an omitted attribute keeps its stored value, so a body carrying only the fields being changed is enough. guardrail_cutoff_threshold is nullable -- send null to clear it, omit it to leave it alone. Omitting the aggregation leaves the metric's definition untouched; supplying one replaces it wholesale, and the metric's type is re-derived from the shape supplied. Property filters use property_id or measure_id UUIDs from the aggregation's data source. Attributes that are computed rather than stored (short_id, metric_type, certified_at, experiment_count, created_at, updated_at) are rejected rather than ignored, so a body copied from GET must have them removed. The is_certified attribute is rejected. Certification cannot be changed through this endpoint.

Parameters:

Returns:

  • (Array<(ExperimentsMetricV2DTO, Integer, Hash)>) —

    ExperimentsMetricV2DTO data, response status code and response headers



3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 3185

def update_metric_with_http_info(metric_id, body, opts = {})

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ExperimentsAPI.update_metric ...'
  end
  # verify the required parameter 'metric_id' is set
  if @api_client.config.client_side_validation && metric_id.nil?
    fail ArgumentError, "Missing the required parameter 'metric_id' when calling ExperimentsAPI.update_metric"
  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 ExperimentsAPI.update_metric"
  end
  # resource path
  local_var_path = '/api/v2/experiments/metrics/{metric_id}'.sub('{metric_id}', CGI.escape(metric_id.to_s).gsub('%2F', '/'))

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

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

  new_options = opts.merge(
    :operation => :update_metric,
    :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::Patch, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ExperimentsAPI#update_metric\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end