Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tag exclusion field to metrics configuration API #1453

Merged
Merged
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
8 changes: 4 additions & 4 deletions .apigentools-info
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
"spec_versions": {
"v1": {
"apigentools_version": "1.6.6",
"regenerated": "2023-10-31 16:58:24.822581",
"spec_repo_commit": "781a7cfb"
"regenerated": "2023-11-02 14:42:10.925915",
"spec_repo_commit": "97ff7561"
},
"v2": {
"apigentools_version": "1.6.6",
"regenerated": "2023-10-31 16:58:24.844717",
"spec_repo_commit": "781a7cfb"
"regenerated": "2023-11-02 14:42:10.940908",
"spec_repo_commit": "97ff7561"
}
}
}
46 changes: 44 additions & 2 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9530,6 +9530,15 @@ components:
properties:
emails:
$ref: '#/components/schemas/MetricBulkTagConfigEmailList'
exclude_tags_mode:
description: 'When set to true, the configuration will exclude the configured
tags and include any other submitted tags.

When set to false, the configuration will include the configured tags
and exclude any other submitted tags.

Defaults to false.'
type: boolean
tags:
$ref: '#/components/schemas/MetricBulkTagConfigTagNameList'
type: object
Expand Down Expand Up @@ -9610,6 +9619,13 @@ components:
properties:
emails:
$ref: '#/components/schemas/MetricBulkTagConfigEmailList'
exclude_tags_mode:
description: 'When set to true, the configuration will exclude the configured
tags and include any other submitted tags.

When set to false, the configuration will include the configured tags
and exclude any other submitted tags.'
type: boolean
status:
description: The status of the request.
example: Accepted
Expand Down Expand Up @@ -10074,6 +10090,15 @@ components:
example: '2020-03-25T09:48:37.463835Z'
format: date-time
type: string
exclude_tags_mode:
description: 'When set to true, the configuration will exclude the configured
tags and include any other submitted tags.

When set to false, the configuration will include the configured tags
and exclude any other submitted tags.

Defaults to false. Requires `tags` property.'
type: boolean
include_percentiles:
description: 'Toggle to include or exclude percentile aggregations for distribution
metrics.
Expand Down Expand Up @@ -10104,6 +10129,15 @@ components:
properties:
aggregations:
$ref: '#/components/schemas/MetricCustomAggregations'
exclude_tags_mode:
description: 'When set to true, the configuration will exclude the configured
tags and include any other submitted tags.

When set to false, the configuration will include the configured tags
and exclude any other submitted tags.

Defaults to false. Requires `tags` property.'
type: boolean
include_percentiles:
description: 'Toggle to include/exclude percentiles for a distribution metric.

Expand Down Expand Up @@ -23621,7 +23655,11 @@ paths:
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.
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.'
Expand Down Expand Up @@ -24002,7 +24040,11 @@ paths:
Optionally, include percentile aggregations on any distribution metric or
configure custom aggregations

on any count, rate, or gauge metric.
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.'
Expand Down
6 changes: 4 additions & 2 deletions src/datadog_api_client/v2/api/metrics_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,8 @@ def create_bulk_tags_metrics_configuration(
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.
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.

:type body: MetricBulkTagConfigCreateRequest
Expand All @@ -474,7 +475,8 @@ def create_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.
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.

:param metric_name: The name of the metric.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,20 @@ def openapi_types(_):

return {
"emails": (MetricBulkTagConfigEmailList,),
"exclude_tags_mode": (bool,),
"tags": (MetricBulkTagConfigTagNameList,),
}

attribute_map = {
"emails": "emails",
"exclude_tags_mode": "exclude_tags_mode",
"tags": "tags",
}

def __init__(
self_,
emails: Union[MetricBulkTagConfigEmailList, UnsetType] = unset,
exclude_tags_mode: Union[bool, UnsetType] = unset,
tags: Union[MetricBulkTagConfigTagNameList, UnsetType] = unset,
**kwargs,
):
Expand All @@ -46,11 +49,18 @@ def __init__(
:param emails: A list of account emails to notify when the configuration is applied.
:type emails: MetricBulkTagConfigEmailList, optional

:param exclude_tags_mode: When set to true, the configuration will exclude the configured tags and include any other submitted tags.
When set to false, the configuration will include the configured tags and exclude any other submitted tags.
Defaults to false.
:type exclude_tags_mode: bool, optional

:param tags: A list of tag names to apply to the configuration.
:type tags: MetricBulkTagConfigTagNameList, optional
"""
if emails is not unset:
kwargs["emails"] = emails
if exclude_tags_mode is not unset:
kwargs["exclude_tags_mode"] = exclude_tags_mode
if tags is not unset:
kwargs["tags"] = tags
super().__init__(kwargs)
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,22 @@ def openapi_types(_):

return {
"emails": (MetricBulkTagConfigEmailList,),
"exclude_tags_mode": (bool,),
"status": (str,),
"tags": (MetricBulkTagConfigTagNameList,),
}

attribute_map = {
"emails": "emails",
"exclude_tags_mode": "exclude_tags_mode",
"status": "status",
"tags": "tags",
}

def __init__(
self_,
emails: Union[MetricBulkTagConfigEmailList, UnsetType] = unset,
exclude_tags_mode: Union[bool, UnsetType] = unset,
status: Union[str, UnsetType] = unset,
tags: Union[MetricBulkTagConfigTagNameList, UnsetType] = unset,
**kwargs,
Expand All @@ -49,6 +52,10 @@ def __init__(
:param emails: A list of account emails to notify when the configuration is applied.
:type emails: MetricBulkTagConfigEmailList, optional

:param exclude_tags_mode: When set to true, the configuration will exclude the configured tags and include any other submitted tags.
When set to false, the configuration will include the configured tags and exclude any other submitted tags.
:type exclude_tags_mode: bool, optional

:param status: The status of the request.
:type status: str, optional

Expand All @@ -57,6 +64,8 @@ def __init__(
"""
if emails is not unset:
kwargs["emails"] = emails
if exclude_tags_mode is not unset:
kwargs["exclude_tags_mode"] = exclude_tags_mode
if status is not unset:
kwargs["status"] = status
if tags is not unset:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ def openapi_types(_):
return {
"aggregations": (MetricCustomAggregations,),
"created_at": (datetime,),
"exclude_tags_mode": (bool,),
"include_percentiles": (bool,),
"metric_type": (MetricTagConfigurationMetricTypes,),
"modified_at": (datetime,),
Expand All @@ -37,6 +38,7 @@ def openapi_types(_):
attribute_map = {
"aggregations": "aggregations",
"created_at": "created_at",
"exclude_tags_mode": "exclude_tags_mode",
"include_percentiles": "include_percentiles",
"metric_type": "metric_type",
"modified_at": "modified_at",
Expand All @@ -47,6 +49,7 @@ def __init__(
self_,
aggregations: Union[MetricCustomAggregations, UnsetType] = unset,
created_at: Union[datetime, UnsetType] = unset,
exclude_tags_mode: Union[bool, UnsetType] = unset,
include_percentiles: Union[bool, UnsetType] = unset,
metric_type: Union[MetricTagConfigurationMetricTypes, UnsetType] = unset,
modified_at: Union[datetime, UnsetType] = unset,
Expand Down Expand Up @@ -77,6 +80,11 @@ def __init__(
:param created_at: Timestamp when the tag configuration was created.
:type created_at: datetime, optional

:param exclude_tags_mode: When set to true, the configuration will exclude the configured tags and include any other submitted tags.
When set to false, the configuration will include the configured tags and exclude any other submitted tags.
Defaults to false. Requires ``tags`` property.
:type exclude_tags_mode: bool, optional

:param include_percentiles: Toggle to include or exclude percentile aggregations for distribution metrics.
Only present when the ``metric_type`` is ``distribution``.
:type include_percentiles: bool, optional
Expand All @@ -94,6 +102,8 @@ def __init__(
kwargs["aggregations"] = aggregations
if created_at is not unset:
kwargs["created_at"] = created_at
if exclude_tags_mode is not unset:
kwargs["exclude_tags_mode"] = exclude_tags_mode
if include_percentiles is not unset:
kwargs["include_percentiles"] = include_percentiles
if metric_type is not unset:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,15 @@ def openapi_types(_):

return {
"aggregations": (MetricCustomAggregations,),
"exclude_tags_mode": (bool,),
"include_percentiles": (bool,),
"metric_type": (MetricTagConfigurationMetricTypes,),
"tags": ([str],),
}

attribute_map = {
"aggregations": "aggregations",
"exclude_tags_mode": "exclude_tags_mode",
"include_percentiles": "include_percentiles",
"metric_type": "metric_type",
"tags": "tags",
Expand All @@ -42,6 +44,7 @@ def __init__(
self_,
metric_type: MetricTagConfigurationMetricTypes,
aggregations: Union[MetricCustomAggregations, UnsetType] = unset,
exclude_tags_mode: Union[bool, UnsetType] = unset,
include_percentiles: Union[bool, UnsetType] = unset,
**kwargs,
):
Expand All @@ -66,6 +69,11 @@ def __init__(
Can only be applied to metrics that have a ``metric_type`` of ``count`` , ``rate`` , or ``gauge``.
:type aggregations: MetricCustomAggregations, optional

:param exclude_tags_mode: When set to true, the configuration will exclude the configured tags and include any other submitted tags.
When set to false, the configuration will include the configured tags and exclude any other submitted tags.
Defaults to false. Requires ``tags`` property.
:type exclude_tags_mode: bool, optional

:param include_percentiles: Toggle to include/exclude percentiles for a distribution metric.
Defaults to false. Can only be applied to metrics that have a ``metric_type`` of ``distribution``.
:type include_percentiles: bool, optional
Expand All @@ -78,6 +86,8 @@ def __init__(
"""
if aggregations is not unset:
kwargs["aggregations"] = aggregations
if exclude_tags_mode is not unset:
kwargs["exclude_tags_mode"] = exclude_tags_mode
if include_percentiles is not unset:
kwargs["include_percentiles"] = include_percentiles
super().__init__(kwargs)
Expand Down
Loading