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

Configure tags for multiple metrics.

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



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

def create_bulk_tags_metrics_configuration_with_http_info(body, opts = {})

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MetricsAPI.create_bulk_tags_metrics_configuration ...'
  end
  # verify the required parameter 'body' is set
  if @api_client.config.client_side_validation && body.nil?
    fail ArgumentError, "Missing the required parameter 'body' when calling MetricsAPI.create_bulk_tags_metrics_configuration"
  end
  # resource path
  local_var_path = '/api/v2/metrics/config/bulk-tags'

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

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

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

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

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

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

  new_options = opts.merge(
    :operation => :create_bulk_tags_metrics_configuration,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type,
    :api_version => "V2"
  )

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

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

Create a tag configuration.



102
103
104
105
# File 'lib/datadog_api_client/v2/api/metrics_api.rb', line 102

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 or configure custom aggregations on any 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 of users with the `Manage Tags for Metrics` permission.

Parameters:

Returns:



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

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

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

Delete tags for multiple metrics.



178
179
180
181
# File 'lib/datadog_api_client/v2/api/metrics_api.rb', line 178

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

Delete tags for multiple metrics.

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



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

def delete_bulk_tags_metrics_configuration_with_http_info(body, opts = {})

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MetricsAPI.delete_bulk_tags_metrics_configuration ...'
  end
  # verify the required parameter 'body' is set
  if @api_client.config.client_side_validation && body.nil?
    fail ArgumentError, "Missing the required parameter 'body' when calling MetricsAPI.delete_bulk_tags_metrics_configuration"
  end
  # resource path
  local_var_path = '/api/v2/metrics/config/bulk-tags'

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

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

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

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

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

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

  new_options = opts.merge(
    :operation => :delete_bulk_tags_metrics_configuration,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type,
    :api_version => "V2"
  )

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

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

Delete a tag configuration.



248
249
250
251
# File 'lib/datadog_api_client/v2/api/metrics_api.rb', line 248

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.

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



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

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

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

Tag Configuration Cardinality Estimator.



314
315
316
317
# File 'lib/datadog_api_client/v2/api/metrics_api.rb', line 314

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&trade;.

Parameters:

  • metric_name (String)

    The name of the metric.

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

    the optional parameters

Options Hash (opts):

  • :filter_groups (String)

    Filtered tag keys that the metric is configured to query with.

  • :filter_hours_ago (Integer)

    The number of hours of look back (from now) to estimate cardinality with. Estimates are based on historical data, and unspecified fields default to the minimum 49 hours.

  • :filter_num_aggregations (Integer)

    The number of aggregations that a ‘count`, `rate`, or `gauge` metric is configured to use. Max number of aggregation combos is 9.

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

Returns:

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

    MetricEstimateResponse data, response status code and response headers



331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
# File 'lib/datadog_api_client/v2/api/metrics_api.rb', line 331

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

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

List active tags and aggregations.



401
402
403
404
# File 'lib/datadog_api_client/v2/api/metrics_api.rb', line 401

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, and the Metrics Explorer 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:



414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
# File 'lib/datadog_api_client/v2/api/metrics_api.rb', line 414

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.



468
469
470
471
# File 'lib/datadog_api_client/v2/api/metrics_api.rb', line 468

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



480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
# File 'lib/datadog_api_client/v2/api/metrics_api.rb', line 480

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.



533
534
535
536
# File 'lib/datadog_api_client/v2/api/metrics_api.rb', line 533

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:



545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
# File 'lib/datadog_api_client/v2/api/metrics_api.rb', line 545

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.



598
599
600
601
# File 'lib/datadog_api_client/v2/api/metrics_api.rb', line 598

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.

Returns all metrics that can be configured in the Metrics Summary page or with Metrics without Limits™ (matching additional filters if specified).

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :filter_configured (Boolean)

    Filter custom metrics that have configured tags.

  • :filter_tags_configured (String)

    Filter tag configurations by configured tags.

  • :filter_metric_type (MetricTagConfigurationMetricTypes)

    Filter metrics by metric type.

  • :filter_include_percentiles (Boolean)

    Filter distributions with additional percentile aggregations enabled or disabled.

  • :filter_queried (Boolean) — default: Beta

    Filter custom metrics that have or have not been queried in the specified window. If no window is provided or the window is less than 2 hours, a default of 2 hours will be applied.

  • :filter_tags (String)

    Filter metrics that have been submitted with the given tags. Supports boolean and wildcard expressions. Can only be combined with the filter filter.

  • :window_seconds (Integer)

    The number of seconds of look back (from now) to apply to a filter or filter query. Default value is 3600 (1 hour), maximum value is 2,592,000 (30 days).

Returns:



616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
# File 'lib/datadog_api_client/v2/api/metrics_api.rb', line 616

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 = ['gauge', 'count', 'rate', '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
  # 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[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[tags]'] = opts[:'filter_tags'] if !opts[:'filter_tags'].nil?
  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] || '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_tags_by_metric_name(metric_name, opts = {}) ⇒ Object

List tags by metric name.



676
677
678
679
# File 'lib/datadog_api_client/v2/api/metrics_api.rb', line 676

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 tag key-value pairs for a given metric name.

Parameters:

  • metric_name (String)

    The name of the metric.

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

    the optional parameters

Returns:

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

    MetricAllTagsResponse data, response status code and response headers



688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
# File 'lib/datadog_api_client/v2/api/metrics_api.rb', line 688

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
  # 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] || {}

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



741
742
743
744
# File 'lib/datadog_api_client/v2/api/metrics_api.rb', line 741

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 distinct metrics volumes for the given metric name.

Custom metrics generated in-app from other products will return ‘null` for ingested volumes.

Parameters:

  • metric_name (String)

    The name of the metric.

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

    the optional parameters

Returns:

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

    MetricVolumesResponse data, response status code and response headers



755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
# File 'lib/datadog_api_client/v2/api/metrics_api.rb', line 755

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] || {}

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



808
809
810
811
# File 'lib/datadog_api_client/v2/api/metrics_api.rb', line 808

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



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
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
# File 'lib/datadog_api_client/v2/api/metrics_api.rb', line 822

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

  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.



883
884
885
886
# File 'lib/datadog_api_client/v2/api/metrics_api.rb', line 883

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:



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
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
# File 'lib/datadog_api_client/v2/api/metrics_api.rb', line 896

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

  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

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

Submit metrics.



957
958
959
960
# File 'lib/datadog_api_client/v2/api/metrics_api.rb', line 957

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



981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
# File 'lib/datadog_api_client/v2/api/metrics_api.rb', line 981

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.



1041
1042
1043
1044
# File 'lib/datadog_api_client/v2/api/metrics_api.rb', line 1041

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:



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

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