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

Enable historical metrics ingestion.



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

def create_historical_metrics_configuration(body, opts = {})
  data, _status_code, _headers = create_historical_metrics_configuration_with_http_info(body, opts)
  data
end

#create_historical_metrics_configuration_with_http_info(body, opts = {}) ⇒ Array<(HistoricalMetricsConfigurationResponse, Integer, Hash)>

Enable historical metrics ingestion.

Enable historical metrics ingestion (late data ingestion) for a metric. Idempotent: enabling an already-enabled metric returns 200 instead of 201. Not supported for distribution metrics, metrics with an existing tag configuration, or most standard (non-custom) metrics.

Parameters:

Returns:



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

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

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

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

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

  new_options = opts.merge(
    :operation => :create_historical_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_historical_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.



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

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:



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

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.



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

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.



334
335
336
337
# File 'lib/datadog_api_client/v2/api/metrics_api.rb', line 334

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:



348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
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
408
# File 'lib/datadog_api_client/v2/api/metrics_api.rb', line 348

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



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

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.



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

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



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
475
476
477
478
479
480
481
482
483
# File 'lib/datadog_api_client/v2/api/metrics_api.rb', line 432

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

Delete a historical metrics configuration.



488
489
490
491
# File 'lib/datadog_api_client/v2/api/metrics_api.rb', line 488

def delete_historical_metrics_configuration(metric_name, opts = {})
  delete_historical_metrics_configuration_with_http_info(metric_name, opts)
  nil
end

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

Delete a historical metrics configuration.

Disable historical metrics ingestion for a metric. Idempotent: always returns 204, whether or not the configuration existed or the metric itself still exists, so that Terraform destroy succeeds for a metric removed out-of-band.

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



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
548
549
550
551
552
553
554
555
556
# File 'lib/datadog_api_client/v2/api/metrics_api.rb', line 502

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

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MetricsAPI.delete_historical_metrics_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_historical_metrics_configuration"
  end
  # resource path
  local_var_path = '/api/v2/metrics/historical-metrics-configurations/{metric_name}'.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_historical_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_historical_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.



561
562
563
564
# File 'lib/datadog_api_client/v2/api/metrics_api.rb', line 561

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



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
621
622
623
# File 'lib/datadog_api_client/v2/api/metrics_api.rb', line 575

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.



628
629
630
631
# File 'lib/datadog_api_client/v2/api/metrics_api.rb', line 628

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.



701
702
703
704
# File 'lib/datadog_api_client/v2/api/metrics_api.rb', line 701

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



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

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



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

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.



774
775
776
777
# File 'lib/datadog_api_client/v2/api/metrics_api.rb', line 774

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



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
844
845
846
847
848
849
850
851
852
853
854
855
856
# File 'lib/datadog_api_client/v2/api/metrics_api.rb', line 791

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

Get a historical metrics configuration.



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

def get_historical_metrics_configuration(metric_name, opts = {})
  data, _status_code, _headers = get_historical_metrics_configuration_with_http_info(metric_name, opts)
  data
end

#get_historical_metrics_configuration_with_http_info(metric_name, opts = {}) ⇒ Array<(HistoricalMetricsConfigurationResponse, Integer, Hash)>

Get a historical metrics configuration.

Get the historical metrics ingestion configuration for a metric. Existence of the resource means historical metrics ingestion is enabled; returns 404 when it is not enabled for the metric.

Parameters:

  • metric_name (String)

    The name of the metric.

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

    the optional parameters

Returns:



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

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

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MetricsAPI.get_historical_metrics_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.get_historical_metrics_configuration"
  end
  # resource path
  local_var_path = '/api/v2/metrics/historical-metrics-configurations/{metric_name}'.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] || 'HistoricalMetricsConfigurationResponse'

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

  new_options = opts.merge(
    :operation => :get_historical_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::Get, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: MetricsAPI#get_historical_metrics_configuration\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.



934
935
936
937
# File 'lib/datadog_api_client/v2/api/metrics_api.rb', line 934

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:



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

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.



999
1000
1001
1002
# File 'lib/datadog_api_client/v2/api/metrics_api.rb', line 999

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.



1070
1071
1072
1073
# File 'lib/datadog_api_client/v2/api/metrics_api.rb', line 1070

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:



1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
# File 'lib/datadog_api_client/v2/api/metrics_api.rb', line 1085

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



1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
# File 'lib/datadog_api_client/v2/api/metrics_api.rb', line 1011

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.



1144
1145
1146
1147
# File 'lib/datadog_api_client/v2/api/metrics_api.rb', line 1144

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:



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

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.



1211
1212
1213
1214
# File 'lib/datadog_api_client/v2/api/metrics_api.rb', line 1211

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



1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
# File 'lib/datadog_api_client/v2/api/metrics_api.rb', line 1223

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.



1276
1277
1278
1279
# File 'lib/datadog_api_client/v2/api/metrics_api.rb', line 1276

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:



1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
# File 'lib/datadog_api_client/v2/api/metrics_api.rb', line 1288

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.



1341
1342
1343
1344
# File 'lib/datadog_api_client/v2/api/metrics_api.rb', line 1341

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:



1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
# File 'lib/datadog_api_client/v2/api/metrics_api.rb', line 1368

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:



1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
# File 'lib/datadog_api_client/v2/api/metrics_api.rb', line 1457

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.



1474
1475
1476
1477
# File 'lib/datadog_api_client/v2/api/metrics_api.rb', line 1474

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.



1546
1547
1548
1549
# File 'lib/datadog_api_client/v2/api/metrics_api.rb', line 1546

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



1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
# File 'lib/datadog_api_client/v2/api/metrics_api.rb', line 1559

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



1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
# File 'lib/datadog_api_client/v2/api/metrics_api.rb', line 1488

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.



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

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



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
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
# File 'lib/datadog_api_client/v2/api/metrics_api.rb', line 1637

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.



1702
1703
1704
1705
# File 'lib/datadog_api_client/v2/api/metrics_api.rb', line 1702

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



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
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
# File 'lib/datadog_api_client/v2/api/metrics_api.rb', line 1717

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.



1771
1772
1773
1774
# File 'lib/datadog_api_client/v2/api/metrics_api.rb', line 1771

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



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

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.



1840
1841
1842
1843
# File 'lib/datadog_api_client/v2/api/metrics_api.rb', line 1840

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:



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

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.



1908
1909
1910
1911
# File 'lib/datadog_api_client/v2/api/metrics_api.rb', line 1908

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. The UUIDs of all active rules must be provided; omitting any active rule UUID returns a 400 error. Requires the Manage Tags for Metrics permission.

Parameters:

Returns:

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

    nil, response status code and response headers



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

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.



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

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



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

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.



2068
2069
2070
2071
# File 'lib/datadog_api_client/v2/api/metrics_api.rb', line 2068

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:



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

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.



2144
2145
2146
2147
# File 'lib/datadog_api_client/v2/api/metrics_api.rb', line 2144

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



2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
# File 'lib/datadog_api_client/v2/api/metrics_api.rb', line 2159

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