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
77 changes: 76 additions & 1 deletion src/datadog_api_client/v2/api/metrics_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,40 @@ def __init__(self, api_client=None):
"attribute": "metric_name",
"location": "path",
},
"window_seconds": {
"openapi_types": (int,),
"attribute": "window[seconds]",
"location": "query",
},
"filter_tags": {
"openapi_types": (str,),
"attribute": "filter[tags]",
"location": "query",
},
"filter_match": {
"openapi_types": (str,),
"attribute": "filter[match]",
"location": "query",
},
"filter_include_tag_values": {
"openapi_types": (bool,),
"attribute": "filter[include_tag_values]",
"location": "query",
},
"filter_allow_partial": {
"openapi_types": (bool,),
"attribute": "filter[allow_partial]",
"location": "query",
},
"page_limit": {
"validation": {
"inclusive_maximum": 1000000,
"inclusive_minimum": 1,
},
"openapi_types": (int,),
"attribute": "page[limit]",
"location": "query",
},
},
headers_map={
"accept": ["application/json"],
Expand Down Expand Up @@ -905,18 +939,59 @@ def list_tag_configurations_with_pagination(
def list_tags_by_metric_name(
self,
metric_name: str,
*,
window_seconds: Union[int, UnsetType] = unset,
filter_tags: Union[str, UnsetType] = unset,
filter_match: Union[str, UnsetType] = unset,
filter_include_tag_values: Union[bool, UnsetType] = unset,
filter_allow_partial: Union[bool, UnsetType] = unset,
page_limit: Union[int, UnsetType] = unset,
) -> MetricAllTagsResponse:
"""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: The name of the metric.
:type metric_name: str
:param 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).
:type window_seconds: int, optional
:param filter_tags: Filter to specific tags.
:type filter_tags: str, optional
:param filter_match: Match pattern for filtering tags.
:type filter_match: str, optional
:param filter_include_tag_values: Whether to include tag values in the response.
Defaults to true.
:type filter_include_tag_values: bool, optional
:param filter_allow_partial: Whether to allow partial results.
Defaults to false.
:type filter_allow_partial: bool, optional
:param page_limit: Maximum number of results to return.
:type page_limit: int, optional
:rtype: MetricAllTagsResponse
"""
kwargs: Dict[str, Any] = {}
kwargs["metric_name"] = metric_name

if window_seconds is not unset:
kwargs["window_seconds"] = window_seconds

if filter_tags is not unset:
kwargs["filter_tags"] = filter_tags

if filter_match is not unset:
kwargs["filter_match"] = filter_match

if filter_include_tag_values is not unset:
kwargs["filter_include_tag_values"] = filter_include_tag_values

if filter_allow_partial is not unset:
kwargs["filter_allow_partial"] = filter_allow_partial

if page_limit is not unset:
kwargs["page_limit"] = page_limit

return self._list_tags_by_metric_name_endpoint.call_with_http_info(**kwargs)

def list_volumes_by_metric_name(
Expand Down
4 changes: 2 additions & 2 deletions src/datadog_api_client/v2/model/metric_all_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ def __init__(
**kwargs,
):
"""
Object for a single metric's indexed tags.
Object for a single metric's indexed and ingested tags.

:param attributes: Object containing the definition of a metric's tags.
:param attributes: Object containing the definition of a metric's indexed and ingested tags.
:type attributes: MetricAllTagsAttributes, optional

:param id: The metric name for this resource.
Expand Down
15 changes: 12 additions & 3 deletions src/datadog_api_client/v2/model/metric_all_tags_attributes.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,29 @@ class MetricAllTagsAttributes(ModelNormal):
@cached_property
def openapi_types(_):
return {
"ingested_tags": ([str],),
"tags": ([str],),
}

attribute_map = {
"ingested_tags": "ingested_tags",
"tags": "tags",
}

def __init__(self_, tags: Union[List[str], UnsetType] = unset, **kwargs):
def __init__(
self_, ingested_tags: Union[List[str], UnsetType] = unset, tags: Union[List[str], UnsetType] = unset, **kwargs
):
"""
Object containing the definition of a metric's tags.
Object containing the definition of a metric's indexed and ingested tags.

:param tags: List of indexed tag value pairs.
:param ingested_tags: List of ingested tags that are not indexed.
:type ingested_tags: [str], optional

:param tags: List of indexed tags.
:type tags: [str], optional
"""
if ingested_tags is not unset:
kwargs["ingested_tags"] = ingested_tags
if tags is not unset:
kwargs["tags"] = tags
super().__init__(kwargs)
4 changes: 2 additions & 2 deletions src/datadog_api_client/v2/model/metric_all_tags_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ def openapi_types(_):

def __init__(self_, data: Union[MetricAllTags, UnsetType] = unset, **kwargs):
"""
Response object that includes a single metric's indexed tags.
Response object that includes a single metric's indexed and ingested tags.

:param data: Object for a single metric's indexed tags.
:param data: Object for a single metric's indexed and ingested tags.
:type data: MetricAllTags, optional
"""
if data is not unset:
Expand Down