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_experiment_protocol(protocol_id, opts = {}) ⇒ Object

Archive experiment protocol.



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

def archive_experiment_protocol(protocol_id, opts = {})
  data, _status_code, _headers = archive_experiment_protocol_with_http_info(protocol_id, opts)
  data
end

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

Archive experiment protocol.

Archive a draft or published protocol. Archived protocols cannot be edited or used to create new experiments. Existing experiments keep their settings. Archiving an already archived protocol returns 409.

Parameters:

  • protocol_id (UUID) —

    The UUID of the protocol.

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

    the optional parameters

Options Hash (opts):

  • :expected_updated_at (String) —

    The updated_at value from the last read. Include the full timestamp, with fractional seconds. Returns 409 if another write changed the protocol. Omit to skip this check.

Returns:



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

def archive_experiment_protocol_with_http_info(protocol_id, opts = {})

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ExperimentsAPI.archive_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.archive_experiment_protocol"
  end
  # resource path
  local_var_path = '/api/v2/experiments/protocols/{protocol_id}/archive'.sub('{protocol_id}', CGI.escape(protocol_id.to_s).gsub('%2F', '/'))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'expected_updated_at'] = opts[:'expected_updated_at'] if !opts[:'expected_updated_at'].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] || 'ExperimentsPublicProtocolResponse'

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

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

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

Archive exposure SQL model.



96
97
98
99
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 96

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



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

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.



161
162
163
164
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 161

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



180
181
182
183
184
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
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 180

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.



239
240
241
242
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 239

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



252
253
254
255
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 252

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.



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

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.



378
379
380
381
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 378

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.



450
451
452
453
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 450

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:



463
464
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 463

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:



391
392
393
394
395
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
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 391

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_protocol(body, opts = {}) ⇒ Object

Create experiment protocol.



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

def create_experiment_protocol(body, opts = {})
  data, _status_code, _headers = create_experiment_protocol_with_http_info(body, opts)
  data
end

#create_experiment_protocol_with_http_info(body, opts = {}) ⇒ Array<(ExperimentsPublicProtocolResponse, Integer, Hash)>

Create experiment protocol.

Create a draft protocol with a name and optional description and migration metadata. The organization's default subject type is selected. Use PATCH to configure the draft, then publish it before creating experiments from it.

Parameters:

Returns:



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_experiment_protocol_with_http_info(body, opts = {})

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

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

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

  new_options = opts.merge(
    :operation => :create_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::Post, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ExperimentsAPI#create_experiment_protocol\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



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

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.



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

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:



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_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.



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

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.



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

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:



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_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.



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

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:



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

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



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_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.



855
856
857
858
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 855

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



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

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.



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

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.



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

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



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
1049
1050
1051
1052
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 1000

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_protocol(protocol_id, opts = {}) ⇒ Object

Delete experiment protocol.



1057
1058
1059
1060
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 1057

def delete_experiment_protocol(protocol_id, opts = {})
  delete_experiment_protocol_with_http_info(protocol_id, opts)
  nil
end

#delete_experiment_protocol_with_http_info(protocol_id, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Delete experiment protocol.

Delete a protocol with no linked experiments. Draft, published, and archived protocols can be deleted. Returns 204 with no response body.

Parameters:

  • protocol_id (UUID) —

    The UUID of the protocol.

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

    the optional parameters

Options Hash (opts):

  • :expected_updated_at (String) —

    The updated_at value from the last read. Include the full timestamp, with fractional seconds. Returns 409 if another write changed the protocol. Omit to skip this check.

Returns:

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

    nil, response status code and response headers



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
1114
1115
1116
1117
1118
1119
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 1070

def delete_experiment_protocol_with_http_info(protocol_id, opts = {})

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ExperimentsAPI.delete_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.delete_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] || {}
  query_params[:'expected_updated_at'] = opts[:'expected_updated_at'] if !opts[:'expected_updated_at'].nil?

  # 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_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::Delete, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ExperimentsAPI#delete_experiment_protocol\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



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

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.



1124
1125
1126
1127
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 1124

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.



1189
1190
1191
1192
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 1189

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



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
1244
1245
1246
1247
1248
1249
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 1201

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



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
1179
1180
1181
1182
1183
1184
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 1136

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.



1254
1255
1256
1257
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 1254

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



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
1309
1310
1311
1312
1313
1314
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 1266

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.



1319
1320
1321
1322
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 1319

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.



1384
1385
1386
1387
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 1384

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:



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
1439
1440
1441
1442
1443
1444
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 1396

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.



1449
1450
1451
1452
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 1449

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:



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
1504
1505
1506
1507
1508
1509
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 1461

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.



1514
1515
1516
1517
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 1514

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:



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

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.



1579
1580
1581
1582
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 1579

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:



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 1591

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.



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

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:



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_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



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
1374
1375
1376
1377
1378
1379
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 1331

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.



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

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:



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_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.



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

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.



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

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:



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

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.



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

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:



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

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



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

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.



1978
1979
1980
1981
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 1978

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



1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
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
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 1991

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.



2045
2046
2047
2048
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 2045

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:



2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 2057

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.



2110
2111
2112
2113
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 2110

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:



2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
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
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 2128

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.



2185
2186
2187
2188
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 2185

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:



2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
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
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 2207

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.



2268
2269
2270
2271
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 2268

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:



2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
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
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 2285

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.



2341
2342
2343
2344
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 2341

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:



2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
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
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 2357

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.



2483
2484
2485
2486
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 2483

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:



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

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.



2412
2413
2414
2415
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 2412

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



2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 2428

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.



2552
2553
2554
2555
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 2552

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:



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

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.



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

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

#patch_experiment_protocol(protocol_id, body, opts = {}) ⇒ Object

Update experiment protocol.



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

def patch_experiment_protocol(protocol_id, body, opts = {})
  data, _status_code, _headers = patch_experiment_protocol_with_http_info(protocol_id, body, opts)
  data
end

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

Update experiment protocol.

Update the supplied fields of a draft protocol. Published protocols accept only name, description, and migration_metadata changes through PATCH. Use PUT to replace their settings. Archived protocols cannot be edited.

Omitted fields keep their current values, including fields inside analysis_plan, exposure_schedule, and enforcement. Arrays replace the stored arrays. Supported null values clear fields; see the request schema. Use primary_metric_id to select the primary metric and default_duration_days to set the experiment analysis duration. Nested metric is_primary and analysis_plan.target_duration_days fields are rejected.

Parameters:

Returns:



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
2811
2812
2813
2814
2815
2816
2817
2818
2819
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 2765

def patch_experiment_protocol_with_http_info(protocol_id, body, opts = {})

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ExperimentsAPI.patch_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.patch_experiment_protocol"
  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_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'])
  # 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] || 'ExperimentsPublicProtocolResponse'

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

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



2691
2692
2693
2694
2695
2696
2697
2698
2699
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 2691

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.



2824
2825
2826
2827
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 2824

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



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
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 2837

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

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

Publish experiment protocol.



2896
2897
2898
2899
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 2896

def publish_experiment_protocol(protocol_id, opts = {})
  data, _status_code, _headers = publish_experiment_protocol_with_http_info(protocol_id, opts)
  data
end

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

Publish experiment protocol.

Publish a valid draft protocol. The protocol must have a name and subject type. Supplied references and settings must be valid. An exposure schedule or targeting rules require an environment. Enabled limits require their values. Configurable template fields must have a value before they can be locked.

Independent configuration errors are returned together in the JSON:API errors array with source.pointer values that identify the fields. Earlier request and reference checks can stop on the first error. A failed request leaves the protocol unchanged.

Parameters:

  • protocol_id (UUID) —

    The UUID of the protocol.

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

    the optional parameters

Returns:



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
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 2910

def publish_experiment_protocol_with_http_info(protocol_id, opts = {})

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ExperimentsAPI.publish_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.publish_experiment_protocol"
  end
  # resource path
  local_var_path = '/api/v2/experiments/protocols/{protocol_id}/publish'.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 => :publish_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::Post, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ExperimentsAPI#publish_experiment_protocol\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.



2963
2964
2965
2966
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 2963

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.



3030
3031
3032
3033
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 3030

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:



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

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:



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
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 2976

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

#replace_experiment_protocol(protocol_id, body, opts = {}) ⇒ Object

Replace experiment protocol.



3092
3093
3094
3095
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 3092

def replace_experiment_protocol(protocol_id, body, opts = {})
  data, _status_code, _headers = replace_experiment_protocol_with_http_info(protocol_id, body, opts)
  data
end

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

Replace experiment protocol.

Replace the template of a published protocol. Draft and archived protocols return 409. Send subject_type_id, all four required boolean settings, and metric_groups. Omitted optional template fields are cleared. Omitted enforcement keeps the existing locks.

Use primary_metric_id to select the primary metric. Use default_duration_days to set target_duration_days on experiments created from the protocol. The nested metric is_primary and analysis_plan.target_duration_days fields are rejected. An unchanged GET response can be sent as the request body. Response-only fields are ignored.

Independent configuration errors are returned together in the JSON:API errors array. Each error identifies the field in source.pointer. Earlier request and reference checks can stop on the first error. A failed request leaves the protocol unchanged. Changes apply to future experiments; existing experiments keep their settings.

Parameters:

Options Hash (opts):

  • :expected_updated_at (String) —

    The updated_at value from the last read. Include the full timestamp, with fractional seconds. Returns 409 if another write changed the protocol. Omit to skip this check.

Returns:



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

def replace_experiment_protocol_with_http_info(protocol_id, body, opts = {})

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ExperimentsAPI.replace_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.replace_experiment_protocol"
  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.replace_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] || {}
  query_params[:'expected_updated_at'] = opts[:'expected_updated_at'] if !opts[:'expected_updated_at'].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] || 'ExperimentsPublicProtocolResponse'

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

  new_options = opts.merge(
    :operation => :replace_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::Put, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ExperimentsAPI#replace_experiment_protocol\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.



3170
3171
3172
3173
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 3170

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



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

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.



3235
3236
3237
3238
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 3235

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



3248
3249
3250
3251
3252
3253
3254
3255
3256
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
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 3248

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.



3303
3304
3305
3306
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 3303

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



3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
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
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 3315

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.



3368
3369
3370
3371
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 3368

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:



3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 3381

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.



3440
3441
3442
3443
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 3440

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:



3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 3454

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.



3517
3518
3519
3520
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 3517

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:



3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 3531

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.



3592
3593
3594
3595
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 3592

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.



3664
3665
3666
3667
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 3664

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:



3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 3677

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.



3736
3737
3738
3739
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 3736

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:



3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 3749

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



3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 3605

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