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

Create bandit.



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

def create_bandit(body, opts = {})
  data, _status_code, _headers = create_bandit_with_http_info(body, opts)
  data
end

#create_bandit_with_http_info(body, opts = {}) ⇒ Array<(ExperimentsBanditV2DTO, Integer, Hash)>

Create bandit.

Create a draft bandit. name is required; you can set everything else now, or later with PATCH /api/v2/experiments/bandits/{bandit_id}. A draft on a flag holds a targeting rule that doesn't serve traffic until the bandit starts. variants lists the flag variants the bandit uses by feature_flag_variant_id: is_active makes a variant an arm (the default), and is_fallback marks the variant served after a scheduled end. The server fills in each variant's key and name from the flag. A scheduled end needs a fallback. Setting datadog_flag_configuration or variants needs feature flag and environment read permissions and edit access to the flag. Whether the draft is ready to run is checked when it starts. Validation can return several field errors at once. This endpoint is not idempotent. Bandits must be enabled for the organization.

Parameters:

Returns:

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

    ExperimentsBanditV2DTO 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
374
375
376
377
378
379
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 323

def create_bandit_with_http_info(body, opts = {})
  unstable_enabled = @api_client.config.unstable_operations["v2.create_bandit".to_sym]
  if unstable_enabled
    @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.create_bandit")
  else
    raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.create_bandit"))
  end

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

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

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

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

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

Create experiment.



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

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.



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

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.



523
524
525
526
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 523

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:



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
583
584
585
586
587
588
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 536

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:



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

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.



593
594
595
596
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 593

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:



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
650
651
652
653
654
655
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 605

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



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

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.



660
661
662
663
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 660

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:



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
717
718
719
720
721
722
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 672

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.



727
728
729
730
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 727

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.



794
795
796
797
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 794

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:



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
851
852
853
854
855
856
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 806

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.



861
862
863
864
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 861

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:



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

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



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
784
785
786
787
788
789
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 739

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.



928
929
930
931
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 928

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



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

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

Delete bandit.



995
996
997
998
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 995

def delete_bandit(bandit_id, opts = {})
  delete_bandit_with_http_info(bandit_id, opts)
  nil
end

#delete_bandit_with_http_info(bandit_id, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Delete bandit.

Delete a bandit in any status, with its targeting rule, in one transaction. As with deleting an experiment, a running bandit's rule stops serving and traffic falls through to the flag's other rules; the flag can then be used by another bandit or experiment. After deletion the API no longer returns the bandit. Deleting a bandit cannot be undone. Bandits must be enabled for the organization.

Parameters:

  • bandit_id (UUID) —

    The UUID of the bandit.

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



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
1053
1054
1055
1056
1057
1058
1059
1060
1061
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 1007

def delete_bandit_with_http_info(bandit_id, opts = {})
  unstable_enabled = @api_client.config.unstable_operations["v2.delete_bandit".to_sym]
  if unstable_enabled
    @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.delete_bandit")
  else
    raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.delete_bandit"))
  end

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ExperimentsAPI.delete_bandit ...'
  end
  # verify the required parameter 'bandit_id' is set
  if @api_client.config.client_side_validation && bandit_id.nil?
    fail ArgumentError, "Missing the required parameter 'bandit_id' when calling ExperimentsAPI.delete_bandit"
  end
  # resource path
  local_var_path = '/api/v2/experiments/bandits/{bandit_id}'.sub('{bandit_id}', CGI.escape(bandit_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_bandit,
    :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_bandit\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

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

Delete experiment.



1066
1067
1068
1069
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 1066

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.



1131
1132
1133
1134
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 1131

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



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
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 1144

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.



1201
1202
1203
1204
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 1201

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



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
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 1214

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



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
1120
1121
1122
1123
1124
1125
1126
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 1078

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.



1268
1269
1270
1271
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 1268

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.



1333
1334
1335
1336
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 1333

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



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
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 1345

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



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
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 1280

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.



1398
1399
1400
1401
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 1398

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



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
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 1410

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

Get bandit.



1463
1464
1465
1466
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 1463

def get_bandit(bandit_id, opts = {})
  data, _status_code, _headers = get_bandit_with_http_info(bandit_id, opts)
  data
end

#get_bandit_results(bandit_id, opts = {}) ⇒ Object

Get bandit results.



1534
1535
1536
1537
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 1534

def get_bandit_results(bandit_id, opts = {})
  data, _status_code, _headers = get_bandit_results_with_http_info(bandit_id, opts)
  data
end

#get_bandit_results_with_http_info(bandit_id, opts = {}) ⇒ Array<(ExperimentsBanditResultsV2DTO, Integer, Hash)>

Get bandit results.

Get what a bandit's refreshes have learned: each arm's estimate and probability of being best from the latest saved refresh, and each arm's point estimate over time. filter[from] and filter[to] narrow only point_estimates, not the latest estimates. For observation counts, use Get bandit traffic summary. Bandits must be enabled for the organization.

Parameters:

  • bandit_id (UUID) —

    The UUID of the bandit.

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

    the optional parameters

Options Hash (opts):

  • :filter_from (Time) —

    Return only point estimates from refreshes saved at or after this RFC3339 timestamp. Inclusive.

  • :filter_to (Time) —

    Return only point estimates from refreshes saved before this RFC3339 timestamp. Exclusive.

Returns:



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
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 1548

def get_bandit_results_with_http_info(bandit_id, opts = {})
  unstable_enabled = @api_client.config.unstable_operations["v2.get_bandit_results".to_sym]
  if unstable_enabled
    @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.get_bandit_results")
  else
    raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.get_bandit_results"))
  end

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

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'filter[from]'] = opts[:'filter_from'] if !opts[:'filter_from'].nil?
  query_params[:'filter[to]'] = opts[:'filter_to'] if !opts[:'filter_to'].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] || 'ExperimentsBanditResultsV2DTO'

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

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

#get_bandit_traffic_summary(bandit_id, opts = {}) ⇒ Object

Get bandit traffic summary.



1609
1610
1611
1612
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 1609

def get_bandit_traffic_summary(bandit_id, opts = {})
  data, _status_code, _headers = get_bandit_traffic_summary_with_http_info(bandit_id, opts)
  data
end

#get_bandit_traffic_summary_with_http_info(bandit_id, opts = {}) ⇒ Array<(ExperimentsBanditTrafficSummaryV2DTO, Integer, Hash)>

Get bandit traffic summary.

Get what a bandit has observed, as of its latest saved refresh: observation counts, subjects, and each arm's valid observations and subjects in total and per UTC day. An observation is a subject's reward on the arm it was exposed to, counted on the UTC day of its anchor time. filter[from] and filter[to] narrow only daily, not the totals. Bandits must be enabled for the organization.

Parameters:

  • bandit_id (UUID) —

    The UUID of the bandit.

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

    the optional parameters

Options Hash (opts):

  • :filter_from (Time) —

    Return only the UTC days that overlap the range starting at this RFC3339 timestamp. Inclusive.

  • :filter_to (Time) —

    Return only the UTC days that overlap the range ending at this RFC3339 timestamp. Exclusive.

Returns:



1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 1623

def get_bandit_traffic_summary_with_http_info(bandit_id, opts = {})
  unstable_enabled = @api_client.config.unstable_operations["v2.get_bandit_traffic_summary".to_sym]
  if unstable_enabled
    @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.get_bandit_traffic_summary")
  else
    raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.get_bandit_traffic_summary"))
  end

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

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'filter[from]'] = opts[:'filter_from'] if !opts[:'filter_from'].nil?
  query_params[:'filter[to]'] = opts[:'filter_to'] if !opts[:'filter_to'].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] || 'ExperimentsBanditTrafficSummaryV2DTO'

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

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

#get_bandit_with_http_info(bandit_id, opts = {}) ⇒ Array<(ExperimentsBanditV2DTO, Integer, Hash)>

Get bandit.

Get a bandit: its setup, the policy it serves, its latest refresh, and the arm most likely to be best. When the caller lacks feature flag or environment read permissions, the response omits datadog_flag_configuration and meta.warnings includes datadog_flag_configuration_omitted. Bandits must be enabled for the organization.

Parameters:

  • bandit_id (UUID) —

    The UUID of the bandit.

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

    the optional parameters

Returns:

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

    ExperimentsBanditV2DTO data, response status code and response headers



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
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 1475

def get_bandit_with_http_info(bandit_id, opts = {})
  unstable_enabled = @api_client.config.unstable_operations["v2.get_bandit".to_sym]
  if unstable_enabled
    @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.get_bandit")
  else
    raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.get_bandit"))
  end

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ExperimentsAPI.get_bandit ...'
  end
  # verify the required parameter 'bandit_id' is set
  if @api_client.config.client_side_validation && bandit_id.nil?
    fail ArgumentError, "Missing the required parameter 'bandit_id' when calling ExperimentsAPI.get_bandit"
  end
  # resource path
  local_var_path = '/api/v2/experiments/bandits/{bandit_id}'.sub('{bandit_id}', CGI.escape(bandit_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] || 'ExperimentsBanditV2DTO'

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

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

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

Get experiment.



1684
1685
1686
1687
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 1684

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.



1749
1750
1751
1752
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 1749

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:



1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 1761

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.



1814
1815
1816
1817
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 1814

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:



1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 1826

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.



1879
1880
1881
1882
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 1879

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:



1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 1891

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.



1944
1945
1946
1947
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 1944

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. The response includes the selected run ID and, when recorded, EVSI forecast context and unavailable reasons for Bayesian analyses.

Parameters:

  • experiment_id (UUID) —

    The UUID of the experiment.

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

    the optional parameters

Returns:



1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 1956

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.



2009
2010
2011
2012
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 2009

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:



2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 2021

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



1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 1696

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.



2074
2075
2076
2077
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 2074

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:



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

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.



2142
2143
2144
2145
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 2142

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.



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

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:



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
2264
2265
2266
2267
2268
2269
2270
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 2222

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.



2275
2276
2277
2278
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 2275

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:



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

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



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
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 2155

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.



2343
2344
2345
2346
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 2343

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



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

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

List bandit policies.



2410
2411
2412
2413
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 2410

def list_bandit_policies(bandit_id, opts = {})
  data, _status_code, _headers = list_bandit_policies_with_http_info(bandit_id, opts)
  data
end

#list_bandit_policies_with_http_info(bandit_id, opts = {}) ⇒ Array<(ExperimentsBanditPolicyHistoryV2DTOArray, Integer, Hash)>

List bandit policies.

List the policies a bandit has served, newest first by default, including the policy it serves after it ends. Each policy is the traffic split SDKs served from when it was applied until the next one. Exposures log the policy's ID as bandit.policy_id, so the history tells you the split behind each exposure. Exposures logged after the bandit ends have no policy ID. filter[from] and filter[to] keep the policies in effect during the range, including the one already in effect at filter[from]. Bandits must be enabled for the organization.

Parameters:

  • bandit_id (UUID) —

    The UUID of the bandit.

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

    the optional parameters

Options Hash (opts):

  • :filter_from (Time) —

    Return only the policies in effect at or after this RFC 3339 time (inclusive), including the one already in effect at it.

  • :filter_to (Time) —

    Return only the policies applied before this RFC 3339 time (exclusive).

  • :page_offset (Integer) —

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

  • :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.

  • :sort (String) —

    applied_at for oldest first, or -applied_at for newest first. Defaults to -applied_at.

Returns:



2427
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
2479
2480
2481
2482
2483
2484
2485
2486
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 2427

def list_bandit_policies_with_http_info(bandit_id, opts = {})
  unstable_enabled = @api_client.config.unstable_operations["v2.list_bandit_policies".to_sym]
  if unstable_enabled
    @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.list_bandit_policies")
  else
    raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.list_bandit_policies"))
  end

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

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'filter[from]'] = opts[:'filter_from'] if !opts[:'filter_from'].nil?
  query_params[:'filter[to]'] = opts[:'filter_to'] if !opts[:'filter_to'].nil?
  query_params[:'page[offset]'] = opts[:'page_offset'] if !opts[:'page_offset'].nil?
  query_params[:'page[limit]'] = opts[:'page_limit'] if !opts[:'page_limit'].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] || 'ExperimentsBanditPolicyHistoryV2DTOArray'

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

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

#list_bandits(opts = {}) ⇒ Object

List bandits.



2491
2492
2493
2494
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 2491

def list_bandits(opts = {})
  data, _status_code, _headers = list_bandits_with_http_info(opts)
  data
end

#list_bandits_with_http_info(opts = {}) ⇒ Array<(ExperimentsBanditV2ListDTOArray, Integer, Hash)>

List bandits.

List the organization's bandits, newest first by default. Each item is a summary. For a bandit's setup, active policy, and latest refresh, use Get bandit. Bandits must be enabled for the organization.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :page_offset (Integer) —

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

  • :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.

  • :filter_query (String) —

    Find bandits 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.

  • :filter_status (Array<String>) —

    Filter by bandit status. Accepted values are DRAFT, SCHEDULED, RUNNING, PAUSED, STOPPED, and COMPLETED. Repeat this parameter to select several statuses; for example, filter[status]=RUNNING&filter[status]=PAUSED.

  • :filter_subject_type_id (Array<UUID>) —

    Filter by subject type UUID. Repeat this parameter to supply several IDs. A bandit matches if it uses any listed subject type.

  • :filter_tags (Array<String>) —

    Filter by tag name. Repeat this parameter to supply several tags. A bandit matches if it has at least one listed tag. Use team:<handle> to filter by team. When both tags and teams are given, a bandit must match one of each.

Returns:



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
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 2509

def list_bandits_with_http_info(opts = {})
  unstable_enabled = @api_client.config.unstable_operations["v2.list_bandits".to_sym]
  if unstable_enabled
    @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.list_bandits")
  else
    raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.list_bandits"))
  end

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

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'page[offset]'] = opts[:'page_offset'] if !opts[:'page_offset'].nil?
  query_params[:'page[limit]'] = opts[:'page_limit'] if !opts[:'page_limit'].nil?
  query_params[:'filter[query]'] = opts[:'filter_query'] if !opts[:'filter_query'].nil?
  query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?
  query_params[:'filter[status]'] = @api_client.build_collection_param(opts[:'filter_status'], :multi) if !opts[:'filter_status'].nil?
  query_params[:'filter[subject_type_id]'] = @api_client.build_collection_param(opts[:'filter_subject_type_id'], :multi) if !opts[:'filter_subject_type_id'].nil?
  query_params[:'filter[tags]'] = @api_client.build_collection_param(opts[:'filter_tags'], :multi) if !opts[:'filter_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] || 'ExperimentsBanditV2ListDTOArray'

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

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

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

List experiment holdouts.



2572
2573
2574
2575
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 2572

def list_experiment_holdouts(experiment_id, opts = {})
  data, _status_code, _headers = list_experiment_holdouts_with_http_info(experiment_id, opts)
  data
end

#list_experiment_holdouts_with_http_info(experiment_id, opts = {}) ⇒ Array<(ExperimentsExperimentHoldoutV2DTOArray, Integer, Hash)>

List experiment holdouts.

List the holdouts an experiment is attached to, in evaluation order: MANAGED holdouts first, starting with the GLOBAL holdout, followed by EXTERNAL holdouts. For a draft experiment, the response includes the GLOBAL holdout that the experiment would join if it started. The response excludes archived and deleted holdouts, and MANAGED holdouts past their analysis window. EXTERNAL holdouts are listed until they are archived. MANAGED holdouts are listed only for experiments that use a Datadog feature flag, because Datadog serves holdouts only through its flags. The order matches the experiment's holdout_ids attribute.

Parameters:

  • experiment_id (UUID) —

    The UUID of the experiment.

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

    the optional parameters

Returns:



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
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 2584

def list_experiment_holdouts_with_http_info(experiment_id, opts = {})

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ExperimentsAPI.list_experiment_holdouts ...'
  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_holdouts"
  end
  # resource path
  local_var_path = '/api/v2/experiments/{experiment_id}/holdouts'.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] || 'ExperimentsExperimentHoldoutV2DTOArray'

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

  new_options = opts.merge(
    :operation => :list_experiment_holdouts,
    :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_holdouts\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.



2637
2638
2639
2640
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 2637

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:



2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 2649

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.



2702
2703
2704
2705
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 2702

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:



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
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 2720

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.



2777
2778
2779
2780
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 2777

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:



2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 2799

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.



2860
2861
2862
2863
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 2860

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:



2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 2877

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.



2933
2934
2935
2936
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 2933

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:



2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 2949

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.



3075
3076
3077
3078
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 3075

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:



3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
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
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 3090

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.



3004
3005
3006
3007
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 3004

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



3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 3020

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.



3144
3145
3146
3147
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 3144

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:



3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
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
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 3160

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

Update bandit.



3214
3215
3216
3217
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 3214

def patch_bandit(bandit_id, body, opts = {})
  data, _status_code, _headers = patch_bandit_with_http_info(bandit_id, body, opts)
  data
end

#patch_bandit_with_http_info(bandit_id, body, opts = {}) ⇒ Array<(ExperimentsBanditV2DTO, Integer, Hash)>

Update bandit.

Update a bandit. Omitted attributes, including omitted fields of datadog_flag_configuration and bayesian_prior, are unchanged. variants, tags, and teams replace the stored lists. Setting a nullable attribute to null clears it; datadog_flag_configuration: null takes a draft off its flag. What can change depends on the status. A draft can change anything. A running or paused bandit can change its name, description, refresh schedule, scheduled end, prior, fallback (send the current arms in variants with a different is_fallback), tags, and teams. A stopped or completed bandit can change only its tags and teams. Values that don't change can be sent again in any status. Setting datadog_flag_configuration or variants needs feature flag and environment read permissions and edit access to the flag. Validation can return several field errors at once: HTTP 400 if any is about invalid input, or 409 if all are status conflicts. Bandits must be enabled for the organization.

Parameters:

Returns:

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

    ExperimentsBanditV2DTO data, response status code and response headers



3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
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
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 3227

def patch_bandit_with_http_info(bandit_id, body, opts = {})
  unstable_enabled = @api_client.config.unstable_operations["v2.patch_bandit".to_sym]
  if unstable_enabled
    @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.patch_bandit")
  else
    raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.patch_bandit"))
  end

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ExperimentsAPI.patch_bandit ...'
  end
  # verify the required parameter 'bandit_id' is set
  if @api_client.config.client_side_validation && bandit_id.nil?
    fail ArgumentError, "Missing the required parameter 'bandit_id' when calling ExperimentsAPI.patch_bandit"
  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_bandit"
  end
  # resource path
  local_var_path = '/api/v2/experiments/bandits/{bandit_id}'.sub('{bandit_id}', CGI.escape(bandit_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] || 'ExperimentsBanditV2DTO'

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

  new_options = opts.merge(
    :operation => :patch_bandit,
    :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_bandit\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.



3292
3293
3294
3295
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 3292

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.



3420
3421
3422
3423
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 3420

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:



3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
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
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 3435

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:



3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
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
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 3361

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.



3494
3495
3496
3497
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 3494

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



3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
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
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 3507

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

#pause_bandit(bandit_id, opts = {}) ⇒ Object

Pause bandit.



3566
3567
3568
3569
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 3566

def pause_bandit(bandit_id, opts = {})
  pause_bandit_with_http_info(bandit_id, opts)
  nil
end

#pause_bandit_with_http_info(bandit_id, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Pause bandit.

Pause a running bandit. Its targeting rule keeps serving the current traffic split, and refreshes stop changing the split until the bandit is resumed. Pausing a bandit that isn't running returns 409. Bandits must be enabled for the organization.

Parameters:

  • bandit_id (UUID) —

    The UUID of the bandit.

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
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
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 3578

def pause_bandit_with_http_info(bandit_id, opts = {})
  unstable_enabled = @api_client.config.unstable_operations["v2.pause_bandit".to_sym]
  if unstable_enabled
    @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.pause_bandit")
  else
    raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.pause_bandit"))
  end

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ExperimentsAPI.pause_bandit ...'
  end
  # verify the required parameter 'bandit_id' is set
  if @api_client.config.client_side_validation && bandit_id.nil?
    fail ArgumentError, "Missing the required parameter 'bandit_id' when calling ExperimentsAPI.pause_bandit"
  end
  # resource path
  local_var_path = '/api/v2/experiments/bandits/{bandit_id}/pause'.sub('{bandit_id}', CGI.escape(bandit_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 => :pause_bandit,
    :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#pause_bandit\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.



3637
3638
3639
3640
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 3637

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:



3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 3651

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

Refresh bandit.



3704
3705
3706
3707
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 3704

def refresh_bandit(bandit_id, opts = {})
  data, _status_code, _headers = refresh_bandit_with_http_info(bandit_id, opts)
  data
end

#refresh_bandit_with_http_info(bandit_id, opts = {}) ⇒ Array<(ExperimentsBanditRefreshV2DTO, Integer, Hash)>

Refresh bandit.

Start a refresh of a running bandit now, instead of waiting for its schedule. The refresh reads the bandit's latest data and saves new results. Outside warmup it also serves the traffic split it proposes, so it can change traffic. HTTP 202 confirms the refresh started, not that it finished. The response returns the refresh ID, which the bandit then reports as latest_refresh. Bandits must be enabled for the organization.

Parameters:

  • bandit_id (UUID) —

    The UUID of the bandit.

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

    the optional parameters

Options Hash (opts):

  • :full_refresh (Boolean) —

    Recompute the bandit's whole history instead of updating its latest refresh; for example, after its exposure or metric data was backfilled. Defaults to false.

Returns:



3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 3717

def refresh_bandit_with_http_info(bandit_id, opts = {})
  unstable_enabled = @api_client.config.unstable_operations["v2.refresh_bandit".to_sym]
  if unstable_enabled
    @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.refresh_bandit")
  else
    raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.refresh_bandit"))
  end

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ExperimentsAPI.refresh_bandit ...'
  end
  # verify the required parameter 'bandit_id' is set
  if @api_client.config.client_side_validation && bandit_id.nil?
    fail ArgumentError, "Missing the required parameter 'bandit_id' when calling ExperimentsAPI.refresh_bandit"
  end
  # resource path
  local_var_path = '/api/v2/experiments/bandits/{bandit_id}/refresh'.sub('{bandit_id}', CGI.escape(bandit_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] || 'ExperimentsBanditRefreshV2DTO'

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

  new_options = opts.merge(
    :operation => :refresh_bandit,
    :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_bandit\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.



3777
3778
3779
3780
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 3777

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.



3844
3845
3846
3847
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 3844

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:



3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 3856

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:



3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 3790

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.



3906
3907
3908
3909
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 3906

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:



3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 3924

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

#resume_bandit(bandit_id, opts = {}) ⇒ Object

Resume bandit.



3984
3985
3986
3987
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 3984

def resume_bandit(bandit_id, opts = {})
  resume_bandit_with_http_info(bandit_id, opts)
  nil
end

#resume_bandit_with_http_info(bandit_id, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Resume bandit.

Resume a paused bandit, so refreshes change its traffic split again. Resuming a bandit that isn't paused returns 409. Bandits must be enabled for the organization.

Parameters:

  • bandit_id (UUID) —

    The UUID of the bandit.

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 3996

def resume_bandit_with_http_info(bandit_id, opts = {})
  unstable_enabled = @api_client.config.unstable_operations["v2.resume_bandit".to_sym]
  if unstable_enabled
    @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.resume_bandit")
  else
    raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.resume_bandit"))
  end

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ExperimentsAPI.resume_bandit ...'
  end
  # verify the required parameter 'bandit_id' is set
  if @api_client.config.client_side_validation && bandit_id.nil?
    fail ArgumentError, "Missing the required parameter 'bandit_id' when calling ExperimentsAPI.resume_bandit"
  end
  # resource path
  local_var_path = '/api/v2/experiments/bandits/{bandit_id}/resume'.sub('{bandit_id}', CGI.escape(bandit_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 => :resume_bandit,
    :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#resume_bandit\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.



4055
4056
4057
4058
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 4055

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



4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 4067

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

Start bandit.



4120
4121
4122
4123
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 4120

def start_bandit(bandit_id, opts = {})
  start_bandit_with_http_info(bandit_id, opts)
  nil
end

#start_bandit_with_http_info(bandit_id, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Start bandit.

Start a draft bandit. Its targeting rule is published serving every arm equally, and each refresh then shifts traffic toward the arms that do best. The bandit starts exactly as it is configured; set it up with PATCH /api/v2/experiments/bandits/{bandit_id} first. It needs a flag, at least two arms, a subject type, a metric, and an exposure SQL model. The request is idempotent: a bandit that is already running still returns 204, so a retry after a timeout is safe. Stop is not idempotent. A start is blocked when the flag environment requires an approval or a pending change request touches the flag's targeting rules; retrying alone does not resolve an approval requirement. Bandits must be enabled for the organization.

Parameters:

  • bandit_id (UUID) —

    The UUID of the bandit.

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 4132

def start_bandit_with_http_info(bandit_id, opts = {})
  unstable_enabled = @api_client.config.unstable_operations["v2.start_bandit".to_sym]
  if unstable_enabled
    @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.start_bandit")
  else
    raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.start_bandit"))
  end

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ExperimentsAPI.start_bandit ...'
  end
  # verify the required parameter 'bandit_id' is set
  if @api_client.config.client_side_validation && bandit_id.nil?
    fail ArgumentError, "Missing the required parameter 'bandit_id' when calling ExperimentsAPI.start_bandit"
  end
  # resource path
  local_var_path = '/api/v2/experiments/bandits/{bandit_id}/start'.sub('{bandit_id}', CGI.escape(bandit_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 => :start_bandit,
    :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_bandit\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

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

Start experiment.



4191
4192
4193
4194
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 4191

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



4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 4204

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

#stop_bandit(bandit_id, body, opts = {}) ⇒ Object

Stop bandit.



4259
4260
4261
4262
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 4259

def stop_bandit(bandit_id, body, opts = {})
  stop_bandit_with_http_info(bandit_id, body, opts)
  nil
end

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

Stop bandit.

Stop a running or paused bandit. From then on its targeting rule serves served_variant_key to everyone, overriding any configured fallback, and the bandit stops refreshing. served_variant_key can be any of the flag's variants. Stopping can't be reversed and is not idempotent: stopping a bandit that has already stopped or completed returns 409. Bandits must be enabled for the organization.

Parameters:

Returns:

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

    nil, response status code and response headers



4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 4272

def stop_bandit_with_http_info(bandit_id, body, opts = {})
  unstable_enabled = @api_client.config.unstable_operations["v2.stop_bandit".to_sym]
  if unstable_enabled
    @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.stop_bandit")
  else
    raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.stop_bandit"))
  end

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ExperimentsAPI.stop_bandit ...'
  end
  # verify the required parameter 'bandit_id' is set
  if @api_client.config.client_side_validation && bandit_id.nil?
    fail ArgumentError, "Missing the required parameter 'bandit_id' when calling ExperimentsAPI.stop_bandit"
  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.stop_bandit"
  end
  # resource path
  local_var_path = '/api/v2/experiments/bandits/{bandit_id}/stop'.sub('{bandit_id}', CGI.escape(bandit_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 => :stop_bandit,
    :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#stop_bandit\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.



4337
4338
4339
4340
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 4337

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



4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 4349

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.



4402
4403
4404
4405
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 4402

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:



4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 4415

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.



4474
4475
4476
4477
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 4474

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:



4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 4488

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.



4551
4552
4553
4554
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 4551

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:



4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 4565

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.



4626
4627
4628
4629
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 4626

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.



4698
4699
4700
4701
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 4698

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:



4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 4711

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.



4770
4771
4772
4773
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 4770

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:



4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 4783

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



4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
# File 'lib/datadog_api_client/v2/api/experiments_api.rb', line 4639

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