Skip to content

Commit bd2a2ec

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Update metrics all-tags endpoint documentation (#3601)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent 90bd7e6 commit bd2a2ec

6 files changed

Lines changed: 207 additions & 18 deletions

File tree

.generator/schemas/v2/openapi.yaml

Lines changed: 82 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32619,7 +32619,7 @@ components:
3261932619
x-enum-varnames:
3262032620
- ACTIVELY_QUERIED_CONFIGURATIONS
3262132621
MetricAllTags:
32622-
description: Object for a single metric's indexed tags.
32622+
description: Object for a single metric's indexed and ingested tags.
3262332623
properties:
3262432624
attributes:
3262532625
$ref: '#/components/schemas/MetricAllTagsAttributes'
@@ -32629,21 +32629,33 @@ components:
3262932629
$ref: '#/components/schemas/MetricType'
3263032630
type: object
3263132631
MetricAllTagsAttributes:
32632-
description: Object containing the definition of a metric's tags.
32632+
description: Object containing the definition of a metric's indexed and ingested
32633+
tags.
3263332634
properties:
32635+
ingested_tags:
32636+
description: List of ingested tags that are not indexed.
32637+
example:
32638+
- env:prod
32639+
- service:web
32640+
- version:1.0
32641+
items:
32642+
description: Ingested tags for the metric.
32643+
type: string
32644+
type: array
3263432645
tags:
32635-
description: List of indexed tag value pairs.
32646+
description: List of indexed tags.
3263632647
example:
3263732648
- sport:golf
3263832649
- sport:football
3263932650
- animal:dog
3264032651
items:
32641-
description: Tag key-value pairs.
32652+
description: Indexed tags for the metric.
3264232653
type: string
3264332654
type: array
3264432655
type: object
3264532656
MetricAllTagsResponse:
32646-
description: Response object that includes a single metric's indexed tags.
32657+
description: Response object that includes a single metric's indexed and ingested
32658+
tags.
3264732659
properties:
3264832660
data:
3264932661
$ref: '#/components/schemas/MetricAllTags'
@@ -77321,11 +77333,74 @@ paths:
7732177333
- metrics_read
7732277334
/api/v2/metrics/{metric_name}/all-tags:
7732377335
get:
77324-
description: View indexed tag key-value pairs for a given metric name over the
77325-
previous hour.
77336+
description: 'View indexed and ingested tags for a given metric name.
77337+
77338+
Results are filtered by the `window[seconds]` parameter, which defaults to
77339+
14400 (4 hours).'
7732677340
operationId: ListTagsByMetricName
7732777341
parameters:
7732877342
- $ref: '#/components/parameters/MetricName'
77343+
- description: 'The number of seconds of look back (from now) to query for tag
77344+
data.
77345+
77346+
Default value is 14400 (4 hours), minimum value is 14400 (4 hours).'
77347+
example: 14400
77348+
in: query
77349+
name: window[seconds]
77350+
required: false
77351+
schema:
77352+
format: int64
77353+
type: integer
77354+
- description: 'Filter results to tags from data points that have the specified
77355+
tags.
77356+
77357+
For example, `filter[tags]=env:staging,host:123` returns tags only from
77358+
data points with both `env:staging` and `host:123`.'
77359+
example: env:staging,host:123
77360+
in: query
77361+
name: filter[tags]
77362+
required: false
77363+
schema:
77364+
type: string
77365+
- description: 'Filter returned tags to those matching a substring.
77366+
77367+
For example, `filter[match]=env` returns tags like `env:prod`, `environment:staging`,
77368+
etc.'
77369+
example: env
77370+
in: query
77371+
name: filter[match]
77372+
required: false
77373+
schema:
77374+
type: string
77375+
- description: 'Whether to include tag values in the response.
77376+
77377+
Defaults to true.'
77378+
example: true
77379+
in: query
77380+
name: filter[include_tag_values]
77381+
required: false
77382+
schema:
77383+
type: boolean
77384+
- description: 'Whether to allow partial results.
77385+
77386+
Defaults to false.'
77387+
example: false
77388+
in: query
77389+
name: filter[allow_partial]
77390+
required: false
77391+
schema:
77392+
type: boolean
77393+
- description: Maximum number of results to return.
77394+
example: 1000
77395+
in: query
77396+
name: page[limit]
77397+
required: false
77398+
schema:
77399+
default: 1000000
77400+
format: int32
77401+
maximum: 1000000
77402+
minimum: 1
77403+
type: integer
7732977404
responses:
7733077405
'200':
7733177406
content:

api/datadogV2/api_metrics.go

Lines changed: 81 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1080,15 +1080,76 @@ func (a *MetricsApi) ListTagConfigurationsWithPagination(ctx _context.Context, o
10801080
return items, cancel
10811081
}
10821082

1083+
// ListTagsByMetricNameOptionalParameters holds optional parameters for ListTagsByMetricName.
1084+
type ListTagsByMetricNameOptionalParameters struct {
1085+
WindowSeconds *int64
1086+
FilterTags *string
1087+
FilterMatch *string
1088+
FilterIncludeTagValues *bool
1089+
FilterAllowPartial *bool
1090+
PageLimit *int32
1091+
}
1092+
1093+
// NewListTagsByMetricNameOptionalParameters creates an empty struct for parameters.
1094+
func NewListTagsByMetricNameOptionalParameters() *ListTagsByMetricNameOptionalParameters {
1095+
this := ListTagsByMetricNameOptionalParameters{}
1096+
return &this
1097+
}
1098+
1099+
// WithWindowSeconds sets the corresponding parameter name and returns the struct.
1100+
func (r *ListTagsByMetricNameOptionalParameters) WithWindowSeconds(windowSeconds int64) *ListTagsByMetricNameOptionalParameters {
1101+
r.WindowSeconds = &windowSeconds
1102+
return r
1103+
}
1104+
1105+
// WithFilterTags sets the corresponding parameter name and returns the struct.
1106+
func (r *ListTagsByMetricNameOptionalParameters) WithFilterTags(filterTags string) *ListTagsByMetricNameOptionalParameters {
1107+
r.FilterTags = &filterTags
1108+
return r
1109+
}
1110+
1111+
// WithFilterMatch sets the corresponding parameter name and returns the struct.
1112+
func (r *ListTagsByMetricNameOptionalParameters) WithFilterMatch(filterMatch string) *ListTagsByMetricNameOptionalParameters {
1113+
r.FilterMatch = &filterMatch
1114+
return r
1115+
}
1116+
1117+
// WithFilterIncludeTagValues sets the corresponding parameter name and returns the struct.
1118+
func (r *ListTagsByMetricNameOptionalParameters) WithFilterIncludeTagValues(filterIncludeTagValues bool) *ListTagsByMetricNameOptionalParameters {
1119+
r.FilterIncludeTagValues = &filterIncludeTagValues
1120+
return r
1121+
}
1122+
1123+
// WithFilterAllowPartial sets the corresponding parameter name and returns the struct.
1124+
func (r *ListTagsByMetricNameOptionalParameters) WithFilterAllowPartial(filterAllowPartial bool) *ListTagsByMetricNameOptionalParameters {
1125+
r.FilterAllowPartial = &filterAllowPartial
1126+
return r
1127+
}
1128+
1129+
// WithPageLimit sets the corresponding parameter name and returns the struct.
1130+
func (r *ListTagsByMetricNameOptionalParameters) WithPageLimit(pageLimit int32) *ListTagsByMetricNameOptionalParameters {
1131+
r.PageLimit = &pageLimit
1132+
return r
1133+
}
1134+
10831135
// ListTagsByMetricName List tags by metric name.
1084-
// View indexed tag key-value pairs for a given metric name over the previous hour.
1085-
func (a *MetricsApi) ListTagsByMetricName(ctx _context.Context, metricName string) (MetricAllTagsResponse, *_nethttp.Response, error) {
1136+
// View indexed and ingested tags for a given metric name.
1137+
// Results are filtered by the `window[seconds]` parameter, which defaults to 14400 (4 hours).
1138+
func (a *MetricsApi) ListTagsByMetricName(ctx _context.Context, metricName string, o ...ListTagsByMetricNameOptionalParameters) (MetricAllTagsResponse, *_nethttp.Response, error) {
10861139
var (
10871140
localVarHTTPMethod = _nethttp.MethodGet
10881141
localVarPostBody interface{}
10891142
localVarReturnValue MetricAllTagsResponse
1143+
optionalParams ListTagsByMetricNameOptionalParameters
10901144
)
10911145

1146+
if len(o) > 1 {
1147+
return localVarReturnValue, nil, datadog.ReportError("only one argument of type ListTagsByMetricNameOptionalParameters is allowed")
1148+
}
1149+
if len(o) == 1 {
1150+
optionalParams = o[0]
1151+
}
1152+
10921153
localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.MetricsApi.ListTagsByMetricName")
10931154
if err != nil {
10941155
return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()}
@@ -1100,6 +1161,24 @@ func (a *MetricsApi) ListTagsByMetricName(ctx _context.Context, metricName strin
11001161
localVarHeaderParams := make(map[string]string)
11011162
localVarQueryParams := _neturl.Values{}
11021163
localVarFormParams := _neturl.Values{}
1164+
if optionalParams.WindowSeconds != nil {
1165+
localVarQueryParams.Add("window[seconds]", datadog.ParameterToString(*optionalParams.WindowSeconds, ""))
1166+
}
1167+
if optionalParams.FilterTags != nil {
1168+
localVarQueryParams.Add("filter[tags]", datadog.ParameterToString(*optionalParams.FilterTags, ""))
1169+
}
1170+
if optionalParams.FilterMatch != nil {
1171+
localVarQueryParams.Add("filter[match]", datadog.ParameterToString(*optionalParams.FilterMatch, ""))
1172+
}
1173+
if optionalParams.FilterIncludeTagValues != nil {
1174+
localVarQueryParams.Add("filter[include_tag_values]", datadog.ParameterToString(*optionalParams.FilterIncludeTagValues, ""))
1175+
}
1176+
if optionalParams.FilterAllowPartial != nil {
1177+
localVarQueryParams.Add("filter[allow_partial]", datadog.ParameterToString(*optionalParams.FilterAllowPartial, ""))
1178+
}
1179+
if optionalParams.PageLimit != nil {
1180+
localVarQueryParams.Add("page[limit]", datadog.ParameterToString(*optionalParams.PageLimit, ""))
1181+
}
11031182
localVarHeaderParams["Accept"] = "application/json"
11041183

11051184
if a.Client.Cfg.DelegatedTokenConfig != nil {

api/datadogV2/model_metric_all_tags.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ import (
88
"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
99
)
1010

11-
// MetricAllTags Object for a single metric's indexed tags.
11+
// MetricAllTags Object for a single metric's indexed and ingested tags.
1212
type MetricAllTags struct {
13-
// Object containing the definition of a metric's tags.
13+
// Object containing the definition of a metric's indexed and ingested tags.
1414
Attributes *MetricAllTagsAttributes `json:"attributes,omitempty"`
1515
// The metric name for this resource.
1616
Id *string `json:"id,omitempty"`

api/datadogV2/model_metric_all_tags_attributes.go

Lines changed: 39 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,11 @@ import (
88
"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
99
)
1010

11-
// MetricAllTagsAttributes Object containing the definition of a metric's tags.
11+
// MetricAllTagsAttributes Object containing the definition of a metric's indexed and ingested tags.
1212
type MetricAllTagsAttributes struct {
13-
// List of indexed tag value pairs.
13+
// List of ingested tags that are not indexed.
14+
IngestedTags []string `json:"ingested_tags,omitempty"`
15+
// List of indexed tags.
1416
Tags []string `json:"tags,omitempty"`
1517
// UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
1618
UnparsedObject map[string]interface{} `json:"-"`
@@ -34,6 +36,34 @@ func NewMetricAllTagsAttributesWithDefaults() *MetricAllTagsAttributes {
3436
return &this
3537
}
3638

39+
// GetIngestedTags returns the IngestedTags field value if set, zero value otherwise.
40+
func (o *MetricAllTagsAttributes) GetIngestedTags() []string {
41+
if o == nil || o.IngestedTags == nil {
42+
var ret []string
43+
return ret
44+
}
45+
return o.IngestedTags
46+
}
47+
48+
// GetIngestedTagsOk returns a tuple with the IngestedTags field value if set, nil otherwise
49+
// and a boolean to check if the value has been set.
50+
func (o *MetricAllTagsAttributes) GetIngestedTagsOk() (*[]string, bool) {
51+
if o == nil || o.IngestedTags == nil {
52+
return nil, false
53+
}
54+
return &o.IngestedTags, true
55+
}
56+
57+
// HasIngestedTags returns a boolean if a field has been set.
58+
func (o *MetricAllTagsAttributes) HasIngestedTags() bool {
59+
return o != nil && o.IngestedTags != nil
60+
}
61+
62+
// SetIngestedTags gets a reference to the given []string and assigns it to the IngestedTags field.
63+
func (o *MetricAllTagsAttributes) SetIngestedTags(v []string) {
64+
o.IngestedTags = v
65+
}
66+
3767
// GetTags returns the Tags field value if set, zero value otherwise.
3868
func (o *MetricAllTagsAttributes) GetTags() []string {
3969
if o == nil || o.Tags == nil {
@@ -68,6 +98,9 @@ func (o MetricAllTagsAttributes) MarshalJSON() ([]byte, error) {
6898
if o.UnparsedObject != nil {
6999
return datadog.Marshal(o.UnparsedObject)
70100
}
101+
if o.IngestedTags != nil {
102+
toSerialize["ingested_tags"] = o.IngestedTags
103+
}
71104
if o.Tags != nil {
72105
toSerialize["tags"] = o.Tags
73106
}
@@ -81,17 +114,19 @@ func (o MetricAllTagsAttributes) MarshalJSON() ([]byte, error) {
81114
// UnmarshalJSON deserializes the given payload.
82115
func (o *MetricAllTagsAttributes) UnmarshalJSON(bytes []byte) (err error) {
83116
all := struct {
84-
Tags []string `json:"tags,omitempty"`
117+
IngestedTags []string `json:"ingested_tags,omitempty"`
118+
Tags []string `json:"tags,omitempty"`
85119
}{}
86120
if err = datadog.Unmarshal(bytes, &all); err != nil {
87121
return datadog.Unmarshal(bytes, &o.UnparsedObject)
88122
}
89123
additionalProperties := make(map[string]interface{})
90124
if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil {
91-
datadog.DeleteKeys(additionalProperties, &[]string{"tags"})
125+
datadog.DeleteKeys(additionalProperties, &[]string{"ingested_tags", "tags"})
92126
} else {
93127
return err
94128
}
129+
o.IngestedTags = all.IngestedTags
95130
o.Tags = all.Tags
96131

97132
if len(additionalProperties) > 0 {

api/datadogV2/model_metric_all_tags_response.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ import (
88
"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
99
)
1010

11-
// MetricAllTagsResponse Response object that includes a single metric's indexed tags.
11+
// MetricAllTagsResponse Response object that includes a single metric's indexed and ingested tags.
1212
type MetricAllTagsResponse struct {
13-
// Object for a single metric's indexed tags.
13+
// Object for a single metric's indexed and ingested tags.
1414
Data *MetricAllTags `json:"data,omitempty"`
1515
// UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
1616
UnparsedObject map[string]interface{} `json:"-"`

examples/v2/metrics/ListTagsByMetricName.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ func main() {
2020
configuration := datadog.NewConfiguration()
2121
apiClient := datadog.NewAPIClient(configuration)
2222
api := datadogV2.NewMetricsApi(apiClient)
23-
resp, r, err := api.ListTagsByMetricName(ctx, MetricTagConfigurationDataID)
23+
resp, r, err := api.ListTagsByMetricName(ctx, MetricTagConfigurationDataID, *datadogV2.NewListTagsByMetricNameOptionalParameters())
2424

2525
if err != nil {
2626
fmt.Fprintf(os.Stderr, "Error when calling `MetricsApi.ListTagsByMetricName`: %v\n", err)

0 commit comments

Comments
 (0)