Class: DatadogAPIClient::V2::MetricsAPI

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of MetricsAPI.



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

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

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



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

def api_client
  @api_client
end

Instance Method Details

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

Configure tags for multiple metrics.



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

def create_bulk_tags_metrics_configuration(body, opts = {})
  data, _status_code, _headers = create_bulk_tags_metrics_configuration_with_http_info(body, opts)
  data
end

#create_bulk_tags_metrics_configuration_with_http_info(body, opts = {}) ⇒ Array<(MetricBulkTagConfigResponse, Integer, Hash)>

Deprecated.

This API is deprecated.

Configure tags for multiple metrics.

Note: This endpoint is deprecated. Use Tag Indexing Rules (POST /api/v2/metrics/tag-indexing-rules) instead.

Create and define a list of queryable tag keys for a set of existing count, gauge, rate, and distribution metrics. Metrics are selected by passing a metric name prefix. Use the Delete method of this API path to remove tag configurations. Results can be sent to a set of account email addresses, just like the same operation in the Datadog web app. If multiple calls include the same metric, the last configuration applied (not by submit order) is used, do not expect deterministic ordering of concurrent calls. The exclude_tags_mode value will set all metrics that match the prefix to the same exclusion state, metric tag configurations do not support mixed inclusion and exclusion for tags on the same metric. Can only be used with application keys of users with the Manage Tags for Metrics permission.

Parameters:

Returns:

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

    MetricBulkTagConfigResponse data, response status code and response headers



51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# File 'lib/datadog_api_client/v2/api/metrics_api.rb', line 51

def create_bulk_tags_metrics_configuration_with_http_info(body, opts = {})
  warn "[DEPRECATION] `CreateBulkTagsMetricsConfiguration` is deprecated."

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

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

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

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

#create_tag_configuration(metric_name, body, opts = {}) ⇒ Object

Create a tag configuration.



107
108
109
110
# File 'lib/datadog_api_client/v2/api/metrics_api.rb', line 107

def create_tag_configuration(metric_name, body, opts = {})
  data, _status_code, _headers = create_tag_configuration_with_http_info(metric_name, body, opts)
  data
end

#create_tag_configuration_with_http_info(metric_name, body, opts = {}) ⇒ Array<(MetricTagConfigurationResponse, Integer, Hash)>

Create a tag configuration.

Create and define a list of queryable tag keys for an existing count/gauge/rate/distribution metric. Optionally, include percentile aggregations on any distribution metric. By setting exclude_tags_mode to true, the behavior is changed from an allow-list to a deny-list, and tags in the defined list are not queryable. Can only be used with application keys of users with the Manage Tags for Metrics permission.

Parameters:

Returns:



124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
# File 'lib/datadog_api_client/v2/api/metrics_api.rb', line 124

def create_tag_configuration_with_http_info(metric_name, body, opts = {})

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

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

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

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

Create a tag indexing rule.



183
184
185
186
# File 'lib/datadog_api_client/v2/api/metrics_api.rb', line 183

def create_tag_indexing_rule(body, opts = {})
  data, _status_code, _headers = create_tag_indexing_rule_with_http_info(body, opts)
  data
end

#create_tag_indexing_rule_exemption(metric_name, body, opts = {}) ⇒ Object

Create a tag indexing rule exemption.



258
259
260
261
# File 'lib/datadog_api_client/v2/api/metrics_api.rb', line 258

def create_tag_indexing_rule_exemption(metric_name, body, opts = {})
  data, _status_code, _headers = create_tag_indexing_rule_exemption_with_http_info(metric_name, body, opts)
  data
end

#create_tag_indexing_rule_exemption_with_http_info(metric_name, body, opts = {}) ⇒ Array<(TagIndexingRuleExemptionResponse, Integer, Hash)>

Create a tag indexing rule exemption.

Exempt a metric from all tag indexing rules. The response includes the created exemption resource. Requires the Manage Tags for Metrics permission.

Parameters:

Returns:



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
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
# File 'lib/datadog_api_client/v2/api/metrics_api.rb', line 272

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

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MetricsAPI.create_tag_indexing_rule_exemption ...'
  end
  # verify the required parameter 'metric_name' is set
  if @api_client.config.client_side_validation && metric_name.nil?
    fail ArgumentError, "Missing the required parameter 'metric_name' when calling MetricsAPI.create_tag_indexing_rule_exemption"
  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 MetricsAPI.create_tag_indexing_rule_exemption"
  end
  # resource path
  local_var_path = '/api/v2/metrics/{metric_name}/tag-indexing-rule-exemptions'.sub('{metric_name}', CGI.escape(metric_name.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] || 'TagIndexingRuleExemptionResponse'

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

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

#create_tag_indexing_rule_with_http_info(body, opts = {}) ⇒ Array<(TagIndexingRuleResponse, Integer, Hash)>

Create a tag indexing rule.

Create a tag indexing rule for the org. rule_order is assigned server-side as max+1 among existing rules; use the reorder endpoint to change the evaluation order. Requires the Manage Tags for Metrics permission.

Parameters:

Returns:

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

    TagIndexingRuleResponse data, response status code and response headers



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

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

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MetricsAPI.create_tag_indexing_rule ...'
  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 MetricsAPI.create_tag_indexing_rule"
  end
  # resource path
  local_var_path = '/api/v2/metrics/tag-indexing-rules'

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

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

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

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

Delete tags for multiple metrics.



337
338
339
340
# File 'lib/datadog_api_client/v2/api/metrics_api.rb', line 337

def delete_bulk_tags_metrics_configuration(body, opts = {})
  data, _status_code, _headers = delete_bulk_tags_metrics_configuration_with_http_info(body, opts)
  data
end

#delete_bulk_tags_metrics_configuration_with_http_info(body, opts = {}) ⇒ Array<(MetricBulkTagConfigResponse, Integer, Hash)>

Deprecated.

This API is deprecated.

Delete tags for multiple metrics.

Note: This endpoint is deprecated. Use Tag Indexing Rules (POST /api/v2/metrics/tag-indexing-rules) instead.

Delete all custom lists of queryable tag keys for a set of existing count, gauge, rate, and distribution metrics. Metrics are selected by passing a metric name prefix. Results can be sent to a set of account email addresses, just like the same operation in the Datadog web app. Can only be used with application keys of users with the Manage Tags for Metrics permission.

Parameters:

Returns:

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

    MetricBulkTagConfigResponse data, response status code and response headers



356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
# File 'lib/datadog_api_client/v2/api/metrics_api.rb', line 356

def delete_bulk_tags_metrics_configuration_with_http_info(body, opts = {})
  warn "[DEPRECATION] `DeleteBulkTagsMetricsConfiguration` is deprecated."

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

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

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

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

#delete_tag_configuration(metric_name, opts = {}) ⇒ Object

Delete a tag configuration.



412
413
414
415
# File 'lib/datadog_api_client/v2/api/metrics_api.rb', line 412

def delete_tag_configuration(metric_name, opts = {})
  delete_tag_configuration_with_http_info(metric_name, opts)
  nil
end

#delete_tag_configuration_with_http_info(metric_name, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Delete a tag configuration.

Deletes a metric's tag configuration. Can only be used with application keys from users with the Manage Tags for Metrics permission. Note: This operation is irreversible.

Parameters:

  • metric_name (String)

    The name of the metric.

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
# File 'lib/datadog_api_client/v2/api/metrics_api.rb', line 426

def delete_tag_configuration_with_http_info(metric_name, opts = {})

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

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

#delete_tag_indexing_rule(id, opts = {}) ⇒ Object

Delete a tag indexing rule.



479
480
481
482
# File 'lib/datadog_api_client/v2/api/metrics_api.rb', line 479

def delete_tag_indexing_rule(id, opts = {})
  delete_tag_indexing_rule_with_http_info(id, opts)
  nil
end

#delete_tag_indexing_rule_exemption(metric_name, opts = {}) ⇒ Object

Delete a tag indexing rule exemption.



552
553
554
555
# File 'lib/datadog_api_client/v2/api/metrics_api.rb', line 552

def delete_tag_indexing_rule_exemption(metric_name, opts = {})
  delete_tag_indexing_rule_exemption_with_http_info(metric_name, opts)
  nil
end

#delete_tag_indexing_rule_exemption_with_http_info(metric_name, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Delete a tag indexing rule exemption.

Remove a metric's exemption from tag indexing rules. Idempotent: returns 204 whether or not an exemption existed. Any associated legacy tag configuration record is also removed. Requires the Manage Tags for Metrics permission.

Parameters:

  • metric_name (String)

    The name of the metric.

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
# File 'lib/datadog_api_client/v2/api/metrics_api.rb', line 566

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

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MetricsAPI.delete_tag_indexing_rule_exemption ...'
  end
  # verify the required parameter 'metric_name' is set
  if @api_client.config.client_side_validation && metric_name.nil?
    fail ArgumentError, "Missing the required parameter 'metric_name' when calling MetricsAPI.delete_tag_indexing_rule_exemption"
  end
  # resource path
  local_var_path = '/api/v2/metrics/{metric_name}/tag-indexing-rule-exemptions'.sub('{metric_name}', CGI.escape(metric_name.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_tag_indexing_rule_exemption,
    :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: MetricsAPI#delete_tag_indexing_rule_exemption\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#delete_tag_indexing_rule_with_http_info(id, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Delete a tag indexing rule.

Soft-delete a tag indexing rule. Idempotent: returns 204 whether the rule existed or was already deleted. Remaining rules in the org are automatically re-sequenced to keep rule_order dense and 1-based. Requires the Manage Tags for Metrics permission.

Parameters:

  • id (String)

    ID of the tag indexing rule.

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



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
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
# File 'lib/datadog_api_client/v2/api/metrics_api.rb', line 493

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

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

#estimate_metrics_output_series(metric_name, opts = {}) ⇒ Object

Tag Configuration Cardinality Estimator.



625
626
627
628
# File 'lib/datadog_api_client/v2/api/metrics_api.rb', line 625

def estimate_metrics_output_series(metric_name, opts = {})
  data, _status_code, _headers = estimate_metrics_output_series_with_http_info(metric_name, opts)
  data
end

#estimate_metrics_output_series_with_http_info(metric_name, opts = {}) ⇒ Array<(MetricEstimateResponse, Integer, Hash)>

Tag Configuration Cardinality Estimator.

Returns the estimated cardinality for a metric with a given tag, percentile and number of aggregations configuration using Metrics without Limits™.

Parameters:

  • metric_name (String)

    The name of the metric.

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

    the optional parameters

Options Hash (opts):

  • :filter_groups (String)

    Comma-separated list of tag keys that the metric is configured to query with. For example: filter[groups]=app,host.

  • :filter_hours_ago (Integer)

    The number of hours of look back (from now) to estimate cardinality with. If unspecified, it defaults to 0 hours.

  • :filter_num_aggregations (Integer)

    Deprecated. Number of aggregations has no impact on volume.

  • :filter_pct (Boolean)

    A boolean, for distribution metrics only, to estimate cardinality if the metric includes additional percentile aggregators.

  • :filter_timespan_h (Integer)

    A window, in hours, from the look back to estimate cardinality with. The minimum and default is 1 hour.

Returns:

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

    MetricEstimateResponse data, response status code and response headers



642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
# File 'lib/datadog_api_client/v2/api/metrics_api.rb', line 642

def estimate_metrics_output_series_with_http_info(metric_name, opts = {})

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MetricsAPI.estimate_metrics_output_series ...'
  end
  # verify the required parameter 'metric_name' is set
  if @api_client.config.client_side_validation && metric_name.nil?
    fail ArgumentError, "Missing the required parameter 'metric_name' when calling MetricsAPI.estimate_metrics_output_series"
  end
  if @api_client.config.client_side_validation && !opts[:'filter_hours_ago'].nil? && opts[:'filter_hours_ago'] > 2147483647
    fail ArgumentError, 'invalid value for "opts[:"filter_hours_ago"]" when calling MetricsAPI.estimate_metrics_output_series, must be smaller than or equal to 2147483647.'
  end
  if @api_client.config.client_side_validation && !opts[:'filter_hours_ago'].nil? && opts[:'filter_hours_ago'] < 49
    fail ArgumentError, 'invalid value for "opts[:"filter_hours_ago"]" when calling MetricsAPI.estimate_metrics_output_series, must be greater than or equal to 49.'
  end
  if @api_client.config.client_side_validation && !opts[:'filter_num_aggregations'].nil? && opts[:'filter_num_aggregations'] > 9
    fail ArgumentError, 'invalid value for "opts[:"filter_num_aggregations"]" when calling MetricsAPI.estimate_metrics_output_series, must be smaller than or equal to 9.'
  end
  if @api_client.config.client_side_validation && !opts[:'filter_timespan_h'].nil? && opts[:'filter_timespan_h'] > 2147483647
    fail ArgumentError, 'invalid value for "opts[:"filter_timespan_h"]" when calling MetricsAPI.estimate_metrics_output_series, must be smaller than or equal to 2147483647.'
  end
  # resource path
  local_var_path = '/api/v2/metrics/{metric_name}/estimate'.sub('{metric_name}', CGI.escape(metric_name.to_s).gsub('%2F', '/'))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'filter[groups]'] = opts[:'filter_groups'] if !opts[:'filter_groups'].nil?
  query_params[:'filter[hours_ago]'] = opts[:'filter_hours_ago'] if !opts[:'filter_hours_ago'].nil?
  query_params[:'filter[num_aggregations]'] = opts[:'filter_num_aggregations'] if !opts[:'filter_num_aggregations'].nil?
  query_params[:'filter[pct]'] = opts[:'filter_pct'] if !opts[:'filter_pct'].nil?
  query_params[:'filter[timespan_h]'] = opts[:'filter_timespan_h'] if !opts[:'filter_timespan_h'].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] || 'MetricEstimateResponse'

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

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

#get_metric_tag_cardinality_details(metric_name, opts = {}) ⇒ Object

Get tag key cardinality details.



712
713
714
715
# File 'lib/datadog_api_client/v2/api/metrics_api.rb', line 712

def get_metric_tag_cardinality_details(metric_name, opts = {})
  data, _status_code, _headers = get_metric_tag_cardinality_details_with_http_info(metric_name, opts)
  data
end

#get_metric_tag_cardinality_details_with_http_info(metric_name, opts = {}) ⇒ Array<(MetricTagCardinalitiesResponse, Integer, Hash)>

Get tag key cardinality details.

Returns the cardinality details of tags for a specific metric.

Parameters:

  • metric_name (String)

    The name of the metric.

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

    the optional parameters

Returns:



724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
# File 'lib/datadog_api_client/v2/api/metrics_api.rb', line 724

def get_metric_tag_cardinality_details_with_http_info(metric_name, opts = {})

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MetricsAPI.get_metric_tag_cardinality_details ...'
  end
  # verify the required parameter 'metric_name' is set
  if @api_client.config.client_side_validation && metric_name.nil?
    fail ArgumentError, "Missing the required parameter 'metric_name' when calling MetricsAPI.get_metric_tag_cardinality_details"
  end
  # resource path
  local_var_path = '/api/v2/metrics/{metric_name}/tag-cardinalities'.sub('{metric_name}', CGI.escape(metric_name.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] || 'MetricTagCardinalitiesResponse'

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

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

#get_tag_indexing_rule(id, opts = {}) ⇒ Object

Get a tag indexing rule.



777
778
779
780
# File 'lib/datadog_api_client/v2/api/metrics_api.rb', line 777

def get_tag_indexing_rule(id, opts = {})
  data, _status_code, _headers = get_tag_indexing_rule_with_http_info(id, opts)
  data
end

#get_tag_indexing_rule_exemption(metric_name, opts = {}) ⇒ Object

Get a tag indexing rule exemption.



848
849
850
851
# File 'lib/datadog_api_client/v2/api/metrics_api.rb', line 848

def get_tag_indexing_rule_exemption(metric_name, opts = {})
  data, _status_code, _headers = get_tag_indexing_rule_exemption_with_http_info(metric_name, opts)
  data
end

#get_tag_indexing_rule_exemption_with_http_info(metric_name, opts = {}) ⇒ Array<(TagIndexingRuleExemptionResponse, Integer, Hash)>

Get a tag indexing rule exemption.

Returns why a metric is excluded from tag indexing rules. Returns 200 with kind=exemption when an explicit exemption exists, 200 with kind=legacy_tag_configuration when the metric has a legacy tag configuration acting as an implicit exclusion, or 404 when neither applies.

Parameters:

  • metric_name (String)

    The name of the metric.

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

    the optional parameters

Returns:



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

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

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MetricsAPI.get_tag_indexing_rule_exemption ...'
  end
  # verify the required parameter 'metric_name' is set
  if @api_client.config.client_side_validation && metric_name.nil?
    fail ArgumentError, "Missing the required parameter 'metric_name' when calling MetricsAPI.get_tag_indexing_rule_exemption"
  end
  # resource path
  local_var_path = '/api/v2/metrics/{metric_name}/tag-indexing-rule-exemptions'.sub('{metric_name}', CGI.escape(metric_name.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] || 'TagIndexingRuleExemptionResponse'

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

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

#get_tag_indexing_rule_with_http_info(id, opts = {}) ⇒ Array<(TagIndexingRuleResponse, Integer, Hash)>

Get a tag indexing rule.

Get a single tag indexing rule by its UUID.

Parameters:

  • id (String)

    ID of the tag indexing rule.

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

    the optional parameters

Returns:

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

    TagIndexingRuleResponse data, response status code and response headers



789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
# File 'lib/datadog_api_client/v2/api/metrics_api.rb', line 789

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

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MetricsAPI.get_tag_indexing_rule ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling MetricsAPI.get_tag_indexing_rule"
  end
  # resource path
  local_var_path = '/api/v2/metrics/tag-indexing-rules/{id}'.sub('{id}', CGI.escape(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] || 'TagIndexingRuleResponse'

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

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

#list_active_metric_configurations(metric_name, opts = {}) ⇒ Object

List active tags and aggregations.



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

def list_active_metric_configurations(metric_name, opts = {})
  data, _status_code, _headers = list_active_metric_configurations_with_http_info(metric_name, opts)
  data
end

#list_active_metric_configurations_with_http_info(metric_name, opts = {}) ⇒ Array<(MetricSuggestedTagsAndAggregationsResponse, Integer, Hash)>

List active tags and aggregations.

List tags and aggregations that are actively queried on dashboards, notebooks, monitors, the Metrics Explorer, and using the API for a given metric name.

Parameters:

  • metric_name (String)

    The name of the metric.

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

    the optional parameters

Options Hash (opts):

  • :window_seconds (Integer)

    The number of seconds of look back (from now). Default value is 604,800 (1 week), minimum value is 7200 (2 hours), maximum value is 2,630,000 (1 month).

Returns:



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

def list_active_metric_configurations_with_http_info(metric_name, opts = {})

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

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'window[seconds]'] = opts[:'window_seconds'] if !opts[:'window_seconds'].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] || 'MetricSuggestedTagsAndAggregationsResponse'

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

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

#list_metric_assets(metric_name, opts = {}) ⇒ Object

Related Assets to a Metric.



989
990
991
992
# File 'lib/datadog_api_client/v2/api/metrics_api.rb', line 989

def list_metric_assets(metric_name, opts = {})
  data, _status_code, _headers = list_metric_assets_with_http_info(metric_name, opts)
  data
end

#list_metric_assets_with_http_info(metric_name, opts = {}) ⇒ Array<(MetricAssetsResponse, Integer, Hash)>

Related Assets to a Metric.

Returns dashboards, monitors, notebooks, and SLOs that a metric is stored in, if any. Updated every 24 hours.

Parameters:

  • metric_name (String)

    The name of the metric.

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

    the optional parameters

Returns:

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

    MetricAssetsResponse data, response status code and response headers



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

def list_metric_assets_with_http_info(metric_name, opts = {})

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

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

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

#list_tag_configuration_by_name(metric_name, opts = {}) ⇒ Object

List tag configuration by name.



1054
1055
1056
1057
# File 'lib/datadog_api_client/v2/api/metrics_api.rb', line 1054

def list_tag_configuration_by_name(metric_name, opts = {})
  data, _status_code, _headers = list_tag_configuration_by_name_with_http_info(metric_name, opts)
  data
end

#list_tag_configuration_by_name_with_http_info(metric_name, opts = {}) ⇒ Array<(MetricTagConfigurationResponse, Integer, Hash)>

List tag configuration by name.

Returns the tag configuration for the given metric name.

Parameters:

  • metric_name (String)

    The name of the metric.

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

    the optional parameters

Returns:



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

def list_tag_configuration_by_name_with_http_info(metric_name, opts = {})

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

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

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

#list_tag_configurations(opts = {}) ⇒ Object

Get a list of metrics.



1119
1120
1121
1122
# File 'lib/datadog_api_client/v2/api/metrics_api.rb', line 1119

def list_tag_configurations(opts = {})
  data, _status_code, _headers = list_tag_configurations_with_http_info(opts)
  data
end

#list_tag_configurations_with_http_info(opts = {}) ⇒ Array<(MetricsAndMetricTagConfigurationsResponse, Integer, Hash)>

Get a list of metrics.

Get a list of actively reporting metrics for your organization. Pagination is optional using the page[cursor] and page[size] query parameters.

Query parameters use bracket notation (for example, filter[tags], filter[queried][window][seconds]). Pass them as standard URL query strings, URL-encoding the brackets if your client does not handle them. For example: GET /api/v2/metrics?filter[tags]=env:prod&window[seconds]=86400&page[size]=500.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :filter_configured (Boolean)

    Only return custom metrics that have been configured (true) or not configured (false) with Metrics Without Limits.

  • :filter_is_configurable (Boolean)

    Only return metrics that are eligible (true) or ineligible (false) for configuration with Metrics Without Limits.

  • :filter_tags_configured (String)

    Only return metrics that have the given tag key(s) in their Metrics Without Limits configuration (included or excluded).

  • :filter_metric_type (MetricTagConfigurationMetricTypeCategory)

    Only return metrics of the given metric type.

  • :filter_include_percentiles (Boolean)

    Only return distribution metrics that have percentile aggregations enabled (true) or disabled (false).

  • :filter_queried (Boolean)

    Only return metrics that have been queried (true) or not queried (false) in the look back window. Set the window with filter[queried][window][seconds]; if omitted, a default window is used.

  • :filter_queried_window_seconds (Integer)

    This parameter has no effect unless filter[queried] is also set. Only return metrics that have been queried or not queried in the specified window. The default value is 2,592,000 seconds (30 days), the maximum value is 15,552,000 seconds (180 days), and the minimum value is 1 second. For example: filter[queried]=true&filter[queried][window][seconds]=604800.

  • :filter_tags (String)

    Only return metrics that were submitted with tags matching this expression. You can use AND, OR, IN, and wildcards. For example: filter[tags]=env IN (staging,test) AND service:web*.

  • :filter_related_assets (Boolean)

    Only return metrics that are used in at least one dashboard, monitor, notebook, or SLO.

  • :include (String)

    Include related resources in the response. Set to metric_volumes to include indexed and ingested volume counts for each metric.

  • :sort (String)

    Sort results by metric volume. Prefix a key with - for descending order. Supported keys: metric_volumes.indexed_volume, metric_volumes.ingested_volume, metric_volumes.indexed_volume_delta, metric_volumes.ingested_volume_delta. Requires a paginated request (page[size] or page[cursor]).

  • :window_seconds (Integer)

    Only return metrics that have been actively reporting in the specified window. The default value is 3600 seconds (1 hour), the maximum value is 2,592,000 seconds (30 days), and the minimum value is 1 second.

  • :page_size (Integer)

    Maximum number of results per page. Send page[size] on the first request to opt in to pagination. On each subsequent request, send page[cursor] set to the value of meta.pagination.next_cursor from the previous response. The default value is 10000, the maximum value is 10000, and the minimum value is 1.

  • :page_cursor (String)

    Cursor for pagination. Use page[size] to opt-in to pagination and get the first page; for subsequent pages, use the value from meta.pagination.next_cursor in the response. Pagination is complete when next_cursor is null.

Returns:



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
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
# File 'lib/datadog_api_client/v2/api/metrics_api.rb', line 1146

def list_tag_configurations_with_http_info(opts = {})

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MetricsAPI.list_tag_configurations ...'
  end
  allowable_values = ['non_distribution', 'distribution']
  if @api_client.config.client_side_validation && opts[:'filter_metric_type'] && !allowable_values.include?(opts[:'filter_metric_type'])
    fail ArgumentError, "invalid value for \"filter_metric_type\", must be one of #{allowable_values}"
  end
  if @api_client.config.client_side_validation && !opts[:'filter_queried_window_seconds'].nil? && opts[:'filter_queried_window_seconds'] > 15552000
    fail ArgumentError, 'invalid value for "opts[:"filter_queried_window_seconds"]" when calling MetricsAPI.list_tag_configurations, must be smaller than or equal to 15552000.'
  end
  if @api_client.config.client_side_validation && !opts[:'filter_queried_window_seconds'].nil? && opts[:'filter_queried_window_seconds'] < 1
    fail ArgumentError, 'invalid value for "opts[:"filter_queried_window_seconds"]" when calling MetricsAPI.list_tag_configurations, must be greater than or equal to 1.'
  end
  if @api_client.config.client_side_validation && !opts[:'window_seconds'].nil? && opts[:'window_seconds'] > 2592000
    fail ArgumentError, 'invalid value for "opts[:"window_seconds"]" when calling MetricsAPI.list_tag_configurations, must be smaller than or equal to 2592000.'
  end
  if @api_client.config.client_side_validation && !opts[:'window_seconds'].nil? && opts[:'window_seconds'] < 1
    fail ArgumentError, 'invalid value for "opts[:"window_seconds"]" when calling MetricsAPI.list_tag_configurations, must be greater than or equal to 1.'
  end
  if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 10000
    fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling MetricsAPI.list_tag_configurations, must be smaller than or equal to 10000.'
  end
  if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 1
    fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling MetricsAPI.list_tag_configurations, must be greater than or equal to 1.'
  end
  # resource path
  local_var_path = '/api/v2/metrics'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'filter[configured]'] = opts[:'filter_configured'] if !opts[:'filter_configured'].nil?
  query_params[:'filter[is_configurable]'] = opts[:'filter_is_configurable'] if !opts[:'filter_is_configurable'].nil?
  query_params[:'filter[tags_configured]'] = opts[:'filter_tags_configured'] if !opts[:'filter_tags_configured'].nil?
  query_params[:'filter[metric_type]'] = opts[:'filter_metric_type'] if !opts[:'filter_metric_type'].nil?
  query_params[:'filter[include_percentiles]'] = opts[:'filter_include_percentiles'] if !opts[:'filter_include_percentiles'].nil?
  query_params[:'filter[queried]'] = opts[:'filter_queried'] if !opts[:'filter_queried'].nil?
  query_params[:'filter[queried][window][seconds]'] = opts[:'filter_queried_window_seconds'] if !opts[:'filter_queried_window_seconds'].nil?
  query_params[:'filter[tags]'] = opts[:'filter_tags'] if !opts[:'filter_tags'].nil?
  query_params[:'filter[related_assets]'] = opts[:'filter_related_assets'] if !opts[:'filter_related_assets'].nil?
  query_params[:'include'] = opts[:'include'] if !opts[:'include'].nil?
  query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?
  query_params[:'window[seconds]'] = opts[:'window_seconds'] if !opts[:'window_seconds'].nil?
  query_params[:'page[size]'] = opts[:'page_size'] if !opts[:'page_size'].nil?
  query_params[:'page[cursor]'] = opts[:'page_cursor'] if !opts[:'page_cursor'].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] || 'MetricsAndMetricTagConfigurationsResponse'

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

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

#list_tag_configurations_with_pagination(opts = {}) {|MetricsAndMetricTagConfigurations| ... } ⇒ Object

Get a list of metrics.

Provide a paginated version of #list_tag_configurations, returning all items.

To use it you need to use a block: list_tag_configurations_with_pagination { |item| p item }

Yields:



1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
# File 'lib/datadog_api_client/v2/api/metrics_api.rb', line 1235

def list_tag_configurations_with_pagination(opts = {})
    api_version = "V2"
    page_size = @api_client.get_attribute_from_path(opts, "page_size", 10000)
    @api_client.set_attribute_from_path(api_version, opts, "page_size", Integer, page_size)
    while true do
        response = list_tag_configurations(opts)
        @api_client.get_attribute_from_path(response, "data").each { |item| yield(item) }
        if @api_client.get_attribute_from_path(response, "data").length == 0
          break
        end
        @api_client.set_attribute_from_path(api_version, opts, "page_cursor", String, @api_client.get_attribute_from_path(response, "meta.pagination.next_cursor"))
    end
end

#list_tag_indexing_rules(opts = {}) ⇒ Object

List tag indexing rules.



1252
1253
1254
1255
# File 'lib/datadog_api_client/v2/api/metrics_api.rb', line 1252

def list_tag_indexing_rules(opts = {})
  data, _status_code, _headers = list_tag_indexing_rules_with_http_info(opts)
  data
end

#list_tag_indexing_rules_for_metric(metric_name, opts = {}) ⇒ Object

List tag indexing rules for a metric.



1324
1325
1326
1327
# File 'lib/datadog_api_client/v2/api/metrics_api.rb', line 1324

def list_tag_indexing_rules_for_metric(metric_name, opts = {})
  data, _status_code, _headers = list_tag_indexing_rules_for_metric_with_http_info(metric_name, opts)
  data
end

#list_tag_indexing_rules_for_metric_with_http_info(metric_name, opts = {}) ⇒ Array<(TagIndexingRulesResponse, Integer, Hash)>

List tag indexing rules for a metric.

List the tag indexing rules that apply to a given metric, sorted by rule_order. Matching is performed server-side using each rule's metric_name_matches glob patterns.

Parameters:

  • metric_name (String)

    The name of the metric.

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

    the optional parameters

Returns:

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

    TagIndexingRulesResponse data, response status code and response headers



1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
# File 'lib/datadog_api_client/v2/api/metrics_api.rb', line 1337

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

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MetricsAPI.list_tag_indexing_rules_for_metric ...'
  end
  # verify the required parameter 'metric_name' is set
  if @api_client.config.client_side_validation && metric_name.nil?
    fail ArgumentError, "Missing the required parameter 'metric_name' when calling MetricsAPI.list_tag_indexing_rules_for_metric"
  end
  # resource path
  local_var_path = '/api/v2/metrics/{metric_name}/tag-indexing-rules'.sub('{metric_name}', CGI.escape(metric_name.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] || 'TagIndexingRulesResponse'

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

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

#list_tag_indexing_rules_with_http_info(opts = {}) ⇒ Array<(TagIndexingRulesResponse, Integer, Hash)>

List tag indexing rules.

List tag indexing rules for an org, sorted by rule_order, with offset/limit pagination.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :page_limit (Integer)

    Page size (1–1000, default 100).

  • :page_offset (Integer)

    Page offset from the start of the list (default 0).

  • :search (String)

    Substring filter on rule name.

Returns:

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

    TagIndexingRulesResponse data, response status code and response headers



1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
# File 'lib/datadog_api_client/v2/api/metrics_api.rb', line 1266

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

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MetricsAPI.list_tag_indexing_rules ...'
  end
  # resource path
  local_var_path = '/api/v2/metrics/tag-indexing-rules'

  # query parameters
  query_params = opts[:query_params] || {}
  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?

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

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

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

#list_tags_by_metric_name(metric_name, opts = {}) ⇒ Object

List tags by metric name.



1396
1397
1398
1399
# File 'lib/datadog_api_client/v2/api/metrics_api.rb', line 1396

def list_tags_by_metric_name(metric_name, opts = {})
  data, _status_code, _headers = list_tags_by_metric_name_with_http_info(metric_name, opts)
  data
end

#list_tags_by_metric_name_with_http_info(metric_name, opts = {}) ⇒ Array<(MetricAllTagsResponse, Integer, Hash)>

List tags by metric name.

View indexed and ingested tags for a given metric name. Results are filtered by the window[seconds] parameter, which defaults to 14400 (4 hours).

Parameters:

  • metric_name (String)

    The name of the metric.

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

    the optional parameters

Options Hash (opts):

  • :window_seconds (Integer)

    The number of seconds of look back (from now) to query for tag data. Default value is 14400 (4 hours), minimum value is 14400 (4 hours).

  • :filter_tags (String)

    Filter results to tags from data points that have the specified tags. For example, filter[tags]=env:staging,host:123 returns tags only from data points with both env:staging and host:123.

  • :filter_match (String)

    Filter returned tags to those matching a substring. For example, filter[match]=env returns tags like env:prod, environment:staging, etc.

  • :filter_include_tag_values (Boolean)

    Whether to include tag values in the response. Defaults to true.

  • :filter_allow_partial (Boolean)

    Whether to allow partial results. Defaults to false.

  • :page_limit (Integer)

    Maximum number of results to return.

Returns:

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

    MetricAllTagsResponse data, response status code and response headers



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
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
# File 'lib/datadog_api_client/v2/api/metrics_api.rb', line 1415

def list_tags_by_metric_name_with_http_info(metric_name, opts = {})

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MetricsAPI.list_tags_by_metric_name ...'
  end
  # verify the required parameter 'metric_name' is set
  if @api_client.config.client_side_validation && metric_name.nil?
    fail ArgumentError, "Missing the required parameter 'metric_name' when calling MetricsAPI.list_tags_by_metric_name"
  end
  if @api_client.config.client_side_validation && !opts[:'page_limit'].nil? && opts[:'page_limit'] > 1000000
    fail ArgumentError, 'invalid value for "opts[:"page_limit"]" when calling MetricsAPI.list_tags_by_metric_name, must be smaller than or equal to 1000000.'
  end
  if @api_client.config.client_side_validation && !opts[:'page_limit'].nil? && opts[:'page_limit'] < 1
    fail ArgumentError, 'invalid value for "opts[:"page_limit"]" when calling MetricsAPI.list_tags_by_metric_name, must be greater than or equal to 1.'
  end
  # resource path
  local_var_path = '/api/v2/metrics/{metric_name}/all-tags'.sub('{metric_name}', CGI.escape(metric_name.to_s).gsub('%2F', '/'))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'window[seconds]'] = opts[:'window_seconds'] if !opts[:'window_seconds'].nil?
  query_params[:'filter[tags]'] = opts[:'filter_tags'] if !opts[:'filter_tags'].nil?
  query_params[:'filter[match]'] = opts[:'filter_match'] if !opts[:'filter_match'].nil?
  query_params[:'filter[include_tag_values]'] = opts[:'filter_include_tag_values'] if !opts[:'filter_include_tag_values'].nil?
  query_params[:'filter[allow_partial]'] = opts[:'filter_allow_partial'] if !opts[:'filter_allow_partial'].nil?
  query_params[:'page[limit]'] = opts[:'page_limit'] if !opts[:'page_limit'].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] || 'MetricAllTagsResponse'

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

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

#list_volumes_by_metric_name(metric_name, opts = {}) ⇒ Object

List distinct metric volumes by metric name.



1480
1481
1482
1483
# File 'lib/datadog_api_client/v2/api/metrics_api.rb', line 1480

def list_volumes_by_metric_name(metric_name, opts = {})
  data, _status_code, _headers = list_volumes_by_metric_name_with_http_info(metric_name, opts)
  data
end

#list_volumes_by_metric_name_with_http_info(metric_name, opts = {}) ⇒ Array<(MetricVolumesResponse, Integer, Hash)>

List distinct metric volumes by metric name.

View hourly average cardinality for the given metric name over the look back period. For Metric Name Pricing customers, view total point volume for the given metric name over the look back period.

Parameters:

  • metric_name (String)

    The name of the metric.

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

    the optional parameters

Options Hash (opts):

  • :window_seconds (Integer)

    The number of seconds of look back (from now). Default value is 3,600 (1 hour), maximum value is 2,592,000 (1 month).

Returns:

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

    MetricVolumesResponse data, response status code and response headers



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
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
# File 'lib/datadog_api_client/v2/api/metrics_api.rb', line 1495

def list_volumes_by_metric_name_with_http_info(metric_name, opts = {})

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

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'window[seconds]'] = opts[:'window_seconds'] if !opts[:'window_seconds'].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] || 'MetricVolumesResponse'

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

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

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

Query scalar data across multiple products.



1549
1550
1551
1552
# File 'lib/datadog_api_client/v2/api/metrics_api.rb', line 1549

def query_scalar_data(body, opts = {})
  data, _status_code, _headers = query_scalar_data_with_http_info(body, opts)
  data
end

#query_scalar_data_with_http_info(body, opts = {}) ⇒ Array<(ScalarFormulaQueryResponse, Integer, Hash)>

Query scalar data across multiple products.

Query scalar values (as seen on Query Value, Table, and Toplist widgets). Multiple data sources are supported with the ability to process the data using formulas and functions.

Parameters:

Returns:

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

    ScalarFormulaQueryResponse data, response status code and response headers



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
1605
1606
1607
1608
1609
1610
1611
1612
1613
# File 'lib/datadog_api_client/v2/api/metrics_api.rb', line 1563

def query_scalar_data_with_http_info(body, opts = {})

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

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

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

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

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

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

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

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

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

Query timeseries data across multiple products.



1618
1619
1620
1621
# File 'lib/datadog_api_client/v2/api/metrics_api.rb', line 1618

def query_timeseries_data(body, opts = {})
  data, _status_code, _headers = query_timeseries_data_with_http_info(body, opts)
  data
end

#query_timeseries_data_with_http_info(body, opts = {}) ⇒ Array<(TimeseriesFormulaQueryResponse, Integer, Hash)>

Query timeseries data across multiple products.

Query timeseries data across various data sources and process the data by applying formulas and functions.

Parameters:

Returns:



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
1680
1681
# File 'lib/datadog_api_client/v2/api/metrics_api.rb', line 1631

def query_timeseries_data_with_http_info(body, opts = {})

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

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

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

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

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

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

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

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

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

Reorder tag indexing rules.



1686
1687
1688
1689
# File 'lib/datadog_api_client/v2/api/metrics_api.rb', line 1686

def reorder_tag_indexing_rules(body, opts = {})
  reorder_tag_indexing_rules_with_http_info(body, opts)
  nil
end

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

Reorder tag indexing rules.

Atomically re-sequence the tag indexing rules for an org to match the supplied list of rule UUIDs. The server assigns rule_order 1, 2, … matching each rule UUID by position in the list. Requires the Manage Tags for Metrics permission.

Parameters:

Returns:

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

    nil, response status code and response headers



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
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
# File 'lib/datadog_api_client/v2/api/metrics_api.rb', line 1700

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

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MetricsAPI.reorder_tag_indexing_rules ...'
  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 MetricsAPI.reorder_tag_indexing_rules"
  end
  # resource path
  local_var_path = '/api/v2/metrics/tag-indexing-rules/order'

  # 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 => :reorder_tag_indexing_rules,
    :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: MetricsAPI#reorder_tag_indexing_rules\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

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

Submit metrics.



1761
1762
1763
1764
# File 'lib/datadog_api_client/v2/api/metrics_api.rb', line 1761

def submit_metrics(body, opts = {})
  data, _status_code, _headers = submit_metrics_with_http_info(body, opts)
  data
end

#submit_metrics_with_http_info(body, opts = {}) ⇒ Array<(IntakePayloadAccepted, Integer, Hash)>

Submit metrics.

The metrics end-point allows you to post time-series data that can be graphed on Datadog’s dashboards. The maximum payload size is 500 kilobytes (512000 bytes). Compressed payloads must have a decompressed size of less than 5 megabytes (5242880 bytes).

If you’re submitting metrics directly to the Datadog API without using DogStatsD, expect:

  • 64 bits for the timestamp
  • 64 bits for the value
  • 20 bytes for the metric names
  • 50 bytes for the timeseries
  • The full payload is approximately 100 bytes.

Host name is one of the resources in the Resources field.

Parameters:

  • body (MetricPayload)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:

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

    IntakePayloadAccepted data, response status code and response headers



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
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
# File 'lib/datadog_api_client/v2/api/metrics_api.rb', line 1785

def submit_metrics_with_http_info(body, opts = {})

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MetricsAPI.submit_metrics ...'
  end
  allowable_values = ['deflate', 'zstd1', 'gzip']
  if @api_client.config.client_side_validation && opts[:'content_encoding'] && !allowable_values.include?(opts[:'content_encoding'])
    fail ArgumentError, "invalid value for \"content_encoding\", must be one of #{allowable_values}"
  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 MetricsAPI.submit_metrics"
  end
  # resource path
  local_var_path = '/api/v2/series'

  # 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'])
  header_params['Content-Encoding'] = opts[:'content_encoding'] if !opts[:'content_encoding'].nil?

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

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

  new_options = opts.merge(
    :operation => :submit_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"
  )

  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: MetricsAPI#submit_metrics\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#update_tag_configuration(metric_name, body, opts = {}) ⇒ Object

Update a tag configuration.



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

def update_tag_configuration(metric_name, body, opts = {})
  data, _status_code, _headers = update_tag_configuration_with_http_info(metric_name, body, opts)
  data
end

#update_tag_configuration_with_http_info(metric_name, body, opts = {}) ⇒ Array<(MetricTagConfigurationResponse, Integer, Hash)>

Update a tag configuration.

Update the tag configuration of a metric or percentile aggregations of a distribution metric or custom aggregations of a count, rate, or gauge metric. By setting exclude_tags_mode to true the behavior is changed from an allow-list to a deny-list, and tags in the defined list will not be queryable. Can only be used with application keys from users with the Manage Tags for Metrics permission. This endpoint requires a tag configuration to be created first.

Parameters:

Returns:



1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
# File 'lib/datadog_api_client/v2/api/metrics_api.rb', line 1862

def update_tag_configuration_with_http_info(metric_name, body, opts = {})

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

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

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

#update_tag_indexing_rule(id, body, opts = {}) ⇒ Object

Update a tag indexing rule.



1921
1922
1923
1924
# File 'lib/datadog_api_client/v2/api/metrics_api.rb', line 1921

def update_tag_indexing_rule(id, body, opts = {})
  data, _status_code, _headers = update_tag_indexing_rule_with_http_info(id, body, opts)
  data
end

#update_tag_indexing_rule_with_http_info(id, body, opts = {}) ⇒ Array<(TagIndexingRuleResponse, Integer, Hash)>

Update a tag indexing rule.

Partially update a tag indexing rule. Fields omitted from the request body are left unchanged. Setting rule_order to a value already used by another rule returns 409; use the reorder endpoint for atomic re-sequencing. Requires the Manage Tags for Metrics permission.

Parameters:

  • id (String)

    ID of the tag indexing rule.

  • body (TagIndexingRuleUpdateRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

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

    TagIndexingRuleResponse data, response status code and response headers



1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
# File 'lib/datadog_api_client/v2/api/metrics_api.rb', line 1936

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

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MetricsAPI.update_tag_indexing_rule ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling MetricsAPI.update_tag_indexing_rule"
  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 MetricsAPI.update_tag_indexing_rule"
  end
  # resource path
  local_var_path = '/api/v2/metrics/tag-indexing-rules/{id}'.sub('{id}', CGI.escape(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] || 'TagIndexingRuleResponse'

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

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