Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 75 additions & 7 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32305,7 +32305,7 @@ components:
x-enum-varnames:
- ACTIVELY_QUERIED_CONFIGURATIONS
MetricAllTags:
description: Object for a single metric's indexed tags.
description: Object for a single metric's indexed and ingested tags.
properties:
attributes:
$ref: '#/components/schemas/MetricAllTagsAttributes'
Expand All @@ -32315,21 +32315,33 @@ components:
$ref: '#/components/schemas/MetricType'
type: object
MetricAllTagsAttributes:
description: Object containing the definition of a metric's tags.
description: Object containing the definition of a metric's indexed and ingested
tags.
properties:
ingested_tags:
description: List of ingested tags that are not indexed.
example:
- env:prod
- service:web
- version:1.0
items:
description: Ingested tags for the metric.
type: string
type: array
tags:
description: List of indexed tag value pairs.
description: List of indexed tags.
example:
- sport:golf
- sport:football
- animal:dog
items:
description: Tag key-value pairs.
description: Indexed tags for the metric.
type: string
type: array
type: object
MetricAllTagsResponse:
description: Response object that includes a single metric's indexed tags.
description: Response object that includes a single metric's indexed and ingested
tags.
properties:
data:
$ref: '#/components/schemas/MetricAllTags'
Expand Down Expand Up @@ -76164,11 +76176,67 @@ paths:
- metrics_read
/api/v2/metrics/{metric_name}/all-tags:
get:
description: View indexed tag key-value pairs for a given metric name over the
previous hour.
description: 'View indexed and ingested tags for a given metric name.

Results are filtered by the `window[seconds]` parameter, which defaults to
14400 (4 hours).'
operationId: ListTagsByMetricName
parameters:
- $ref: '#/components/parameters/MetricName'
- description: 'The number of seconds of look back (from now) to query for tag
data.

Default value is 14400 (4 hours), minimum value is 14400 (4 hours).'
example: 14400
in: query
name: window[seconds]
required: false
schema:
format: int64
type: integer
- description: Filter to specific tags.
example: env,service
in: query
name: filter[tags]
required: false
schema:
type: string
- description: Match pattern for filtering tags.
example: env:prod*
in: query
name: filter[match]
required: false
schema:
type: string
- description: 'Whether to include tag values in the response.

Defaults to true.'
example: true
in: query
name: filter[include_tag_values]
required: false
schema:
type: boolean
- description: 'Whether to allow partial results.

Defaults to false.'
example: false
in: query
name: filter[allow_partial]
required: false
schema:
type: boolean
- description: Maximum number of results to return.
example: 1000
in: query
name: page[limit]
required: false
schema:
default: 1000000
format: int32
maximum: 1000000
minimum: 1
type: integer
responses:
'200':
content:
Expand Down
6 changes: 6 additions & 0 deletions features/scenarios_model_mapping.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2522,6 +2522,12 @@
},
"v2.ListTagsByMetricName" => {
"metric_name" => "String",
"window_seconds" => "Integer",
"filter_tags" => "String",
"filter_match" => "String",
"filter_include_tag_values" => "Boolean",
"filter_allow_partial" => "Boolean",
"page_limit" => "Integer",
},
"v2.ListMetricAssets" => {
"metric_name" => "String",
Expand Down
21 changes: 20 additions & 1 deletion lib/datadog_api_client/v2/api/metrics_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -781,10 +781,17 @@ def list_tags_by_metric_name(metric_name, opts = {})

# List tags by metric name.
#
# View indexed tag key-value pairs for a given metric name over the previous hour.
# View indexed and ingested tags for a given metric name.
# Results are filtered by the `window[seconds]` parameter, which defaults to 14400 (4 hours).
#
# @param metric_name [String] The name of the metric.
# @param opts [Hash] the optional parameters
# @option opts [Integer] :window_seconds The number of seconds of look back (from now) to query for tag data. Default value is 14400 (4 hours), minimum value is 14400 (4 hours).
# @option opts [String] :filter_tags Filter to specific tags.
# @option opts [String] :filter_match Match pattern for filtering tags.
# @option opts [Boolean] :filter_include_tag_values Whether to include tag values in the response. Defaults to true.
# @option opts [Boolean] :filter_allow_partial Whether to allow partial results. Defaults to false.
# @option opts [Integer] :page_limit Maximum number of results to return.
# @return [Array<(MetricAllTagsResponse, Integer, Hash)>] MetricAllTagsResponse data, response status code and response headers
def list_tags_by_metric_name_with_http_info(metric_name, opts = {})

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

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

# header parameters
header_params = opts[:header_params] || {}
Expand Down
4 changes: 2 additions & 2 deletions lib/datadog_api_client/v2/models/metric_all_tags.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
require 'time'

module DatadogAPIClient::V2
# Object for a single metric's indexed tags.
# Object for a single metric's indexed and ingested tags.
class MetricAllTags
include BaseGenericModel

# Object containing the definition of a metric's tags.
# Object containing the definition of a metric's indexed and ingested tags.
attr_accessor :attributes

# The metric name for this resource.
Expand Down
18 changes: 15 additions & 3 deletions lib/datadog_api_client/v2/models/metric_all_tags_attributes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,14 @@
require 'time'

module DatadogAPIClient::V2
# Object containing the definition of a metric's tags.
# Object containing the definition of a metric's indexed and ingested tags.
class MetricAllTagsAttributes
include BaseGenericModel

# List of indexed tag value pairs.
# List of ingested tags that are not indexed.
attr_accessor :ingested_tags

# List of indexed tags.
attr_accessor :tags

attr_accessor :additional_properties
Expand All @@ -30,6 +33,7 @@ class MetricAllTagsAttributes
# @!visibility private
def self.attribute_map
{
:'ingested_tags' => :'ingested_tags',
:'tags' => :'tags'
}
end
Expand All @@ -38,6 +42,7 @@ def self.attribute_map
# @!visibility private
def self.openapi_types
{
:'ingested_tags' => :'Array<String>',
:'tags' => :'Array<String>'
}
end
Expand All @@ -60,6 +65,12 @@ def initialize(attributes = {})
end
}

if attributes.key?(:'ingested_tags')
if (value = attributes[:'ingested_tags']).is_a?(Array)
self.ingested_tags = value
end
end

if attributes.key?(:'tags')
if (value = attributes[:'tags']).is_a?(Array)
self.tags = value
Expand Down Expand Up @@ -93,6 +104,7 @@ def to_hash
def ==(o)
return true if self.equal?(o)
self.class == o.class &&
ingested_tags == o.ingested_tags &&
tags == o.tags &&
additional_properties == o.additional_properties
end
Expand All @@ -101,7 +113,7 @@ def ==(o)
# @return [Integer] Hash code
# @!visibility private
def hash
[tags, additional_properties].hash
[ingested_tags, tags, additional_properties].hash
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
require 'time'

module DatadogAPIClient::V2
# Response object that includes a single metric's indexed tags.
# Response object that includes a single metric's indexed and ingested tags.
class MetricAllTagsResponse
include BaseGenericModel

# Object for a single metric's indexed tags.
# Object for a single metric's indexed and ingested tags.
attr_accessor :data

attr_accessor :additional_properties
Expand Down
Loading