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



31
32
33
34
# File 'lib/datadog_api_client/v2/api/metrics_api.rb', line 31

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:



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

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

  if @api_client.config.unstable_operations.has_key?(:create_tag_configuration)
    unstable_enabled = @api_client.config.unstable_operations[:create_tag_configuration]
    if unstable_enabled
      @api_client.config.logger.warn format("Using unstable operation '%s'", "create_tag_configuration")
    else
      raise APIError.new(message: format("Unstable operation '%s' is disabled", "create_tag_configuration"))
    end
  end

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

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

  data, status_code, headers = @api_client.call_api(: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.



111
112
113
114
# File 'lib/datadog_api_client/v2/api/metrics_api.rb', line 111

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



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
174
175
176
177
# File 'lib/datadog_api_client/v2/api/metrics_api.rb', line 121

def delete_tag_configuration_with_http_info(metric_name, opts = {})

  if @api_client.config.unstable_operations.has_key?(:delete_tag_configuration)
    unstable_enabled = @api_client.config.unstable_operations[:delete_tag_configuration]
    if unstable_enabled
      @api_client.config.logger.warn format("Using unstable operation '%s'", "delete_tag_configuration")
    else
      raise APIError.new(message: format("Unstable operation '%s' is disabled", "delete_tag_configuration"))
    end
  end

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

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

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

  data, status_code, headers = @api_client.call_api(: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™.

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. If unspecified, it defaults to 0 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. The minimum and default is 1 hour.

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.



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

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:



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
244
245
246
247
248
249
250
# File 'lib/datadog_api_client/v2/api/metrics_api.rb', line 194

def list_tag_configuration_by_name_with_http_info(metric_name, opts = {})

  if @api_client.config.unstable_operations.has_key?(:list_tag_configuration_by_name)
    unstable_enabled = @api_client.config.unstable_operations[:list_tag_configuration_by_name]
    if unstable_enabled
      @api_client.config.logger.warn format("Using unstable operation '%s'", "list_tag_configuration_by_name")
    else
      raise APIError.new(message: format("Unstable operation '%s' is disabled", "list_tag_configuration_by_name"))
    end
  end

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

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

  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
  )

  data, status_code, headers = @api_client.call_api(: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.



262
263
264
265
# File 'lib/datadog_api_client/v2/api/metrics_api.rb', line 262

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). Optionally, paginate by using the page[cursor] and/or page[size] query parameters. To fetch the first page, pass in a query parameter with either a valid page[size] or an empty cursor like page[cursor]=. To fetch the next page, pass in the next_cursor value from the response as the new page[cursor] value. Once the meta.pagination.next_cursor value is null, all pages have been retrieved.

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

    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[seconds]. 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[queried] filter.

  • :window_seconds (Integer)

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

  • :page_size (Integer)

    Maximum number of results returned.

  • :page_cursor (String)

    String to query the next page of results. This key is provided with each valid response from the API in meta.pagination.next_cursor. Once the meta.pagination.next_cursor key is null, all pages have been retrieved.

Returns:



277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
# File 'lib/datadog_api_client/v2/api/metrics_api.rb', line 277

def list_tag_configurations_with_http_info(opts = {})

  if @api_client.config.unstable_operations.has_key?(:list_tag_configurations)
    unstable_enabled = @api_client.config.unstable_operations[:list_tag_configurations]
    if unstable_enabled
      @api_client.config.logger.warn format("Using unstable operation '%s'", "list_tag_configurations")
    else
      raise APIError.new(message: format("Unstable operation '%s' is disabled", "list_tag_configurations"))
    end
  end

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MetricsAPI.list_tag_configurations ...'
  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[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] || [:AuthZ, :apiKeyAuth, :appKeyAuth]

  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
  )

  data, status_code, headers = @api_client.call_api(: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:



693
694
695
696
697
698
699
700
701
702
703
704
705
# File 'lib/datadog_api_client/v2/api/metrics_api.rb', line 693

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

List tags by metric name.



342
343
344
345
# File 'lib/datadog_api_client/v2/api/metrics_api.rb', line 342

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 over the previous hour.

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



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 352

def list_tags_by_metric_name_with_http_info(metric_name, opts = {})

  if @api_client.config.unstable_operations.has_key?(:list_tags_by_metric_name)
    unstable_enabled = @api_client.config.unstable_operations[:list_tags_by_metric_name]
    if unstable_enabled
      @api_client.config.logger.warn format("Using unstable operation '%s'", "list_tags_by_metric_name")
    else
      raise APIError.new(message: format("Unstable operation '%s' is disabled", "list_tags_by_metric_name"))
    end
  end

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

  # 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] || [:AuthZ, :apiKeyAuth, :appKeyAuth]

  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
  )

  data, status_code, headers = @api_client.call_api(: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.



415
416
417
418
# File 'lib/datadog_api_client/v2/api/metrics_api.rb', line 415

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



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
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
# File 'lib/datadog_api_client/v2/api/metrics_api.rb', line 425

def list_volumes_by_metric_name_with_http_info(metric_name, opts = {})

  if @api_client.config.unstable_operations.has_key?(:list_volumes_by_metric_name)
    unstable_enabled = @api_client.config.unstable_operations[:list_volumes_by_metric_name]
    if unstable_enabled
      @api_client.config.logger.warn format("Using unstable operation '%s'", "list_volumes_by_metric_name")
    else
      raise APIError.new(message: format("Unstable operation '%s' is disabled", "list_volumes_by_metric_name"))
    end
  end

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

  # 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] || [:AuthZ, :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
  )

  data, status_code, headers = @api_client.call_api(: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.



842
843
844
845
# File 'lib/datadog_api_client/v2/api/metrics_api.rb', line 842

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



856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
# File 'lib/datadog_api_client/v2/api/metrics_api.rb', line 856

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.



911
912
913
914
# File 'lib/datadog_api_client/v2/api/metrics_api.rb', line 911

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:



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
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
# File 'lib/datadog_api_client/v2/api/metrics_api.rb', line 924

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

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

Submit metrics.



979
980
981
982
# File 'lib/datadog_api_client/v2/api/metrics_api.rb', line 979

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



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

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.



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

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:



500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
# File 'lib/datadog_api_client/v2/api/metrics_api.rb', line 500

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

  if @api_client.config.unstable_operations.has_key?(:update_tag_configuration)
    unstable_enabled = @api_client.config.unstable_operations[:update_tag_configuration]
    if unstable_enabled
      @api_client.config.logger.warn format("Using unstable operation '%s'", "update_tag_configuration")
    else
      raise APIError.new(message: format("Unstable operation '%s' is disabled", "update_tag_configuration"))
    end
  end

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

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

  data, status_code, headers = @api_client.call_api(: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