diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 77abb46069d..74c70d75ea1 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -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' @@ -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' @@ -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: diff --git a/src/main/java/com/datadog/api/client/v2/api/MetricsApi.java b/src/main/java/com/datadog/api/client/v2/api/MetricsApi.java index b345287e4b7..c0063d7ed52 100644 --- a/src/main/java/com/datadog/api/client/v2/api/MetricsApi.java +++ b/src/main/java/com/datadog/api/client/v2/api/MetricsApi.java @@ -1988,6 +1988,85 @@ public ApiResponse listTagConfigurati new GenericType() {}); } + /** Manage optional parameters to listTagsByMetricName. */ + public static class ListTagsByMetricNameOptionalParameters { + private Long windowSeconds; + private String filterTags; + private String filterMatch; + private Boolean filterIncludeTagValues; + private Boolean filterAllowPartial; + private Integer pageLimit; + + /** + * Set windowSeconds. + * + * @param windowSeconds 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). (optional) + * @return ListTagsByMetricNameOptionalParameters + */ + public ListTagsByMetricNameOptionalParameters windowSeconds(Long windowSeconds) { + this.windowSeconds = windowSeconds; + return this; + } + + /** + * Set filterTags. + * + * @param filterTags Filter to specific tags. (optional) + * @return ListTagsByMetricNameOptionalParameters + */ + public ListTagsByMetricNameOptionalParameters filterTags(String filterTags) { + this.filterTags = filterTags; + return this; + } + + /** + * Set filterMatch. + * + * @param filterMatch Match pattern for filtering tags. (optional) + * @return ListTagsByMetricNameOptionalParameters + */ + public ListTagsByMetricNameOptionalParameters filterMatch(String filterMatch) { + this.filterMatch = filterMatch; + return this; + } + + /** + * Set filterIncludeTagValues. + * + * @param filterIncludeTagValues Whether to include tag values in the response. Defaults to + * true. (optional) + * @return ListTagsByMetricNameOptionalParameters + */ + public ListTagsByMetricNameOptionalParameters filterIncludeTagValues( + Boolean filterIncludeTagValues) { + this.filterIncludeTagValues = filterIncludeTagValues; + return this; + } + + /** + * Set filterAllowPartial. + * + * @param filterAllowPartial Whether to allow partial results. Defaults to false. (optional) + * @return ListTagsByMetricNameOptionalParameters + */ + public ListTagsByMetricNameOptionalParameters filterAllowPartial(Boolean filterAllowPartial) { + this.filterAllowPartial = filterAllowPartial; + return this; + } + + /** + * Set pageLimit. + * + * @param pageLimit Maximum number of results to return. (optional, default to 1000000) + * @return ListTagsByMetricNameOptionalParameters + */ + public ListTagsByMetricNameOptionalParameters pageLimit(Integer pageLimit) { + this.pageLimit = pageLimit; + return this; + } + } + /** * List tags by metric name. * @@ -1998,7 +2077,9 @@ public ApiResponse listTagConfigurati * @throws ApiException if fails to make API call */ public MetricAllTagsResponse listTagsByMetricName(String metricName) throws ApiException { - return listTagsByMetricNameWithHttpInfo(metricName).getData(); + return listTagsByMetricNameWithHttpInfo( + metricName, new ListTagsByMetricNameOptionalParameters()) + .getData(); } /** @@ -2010,7 +2091,8 @@ public MetricAllTagsResponse listTagsByMetricName(String metricName) throws ApiE * @return CompletableFuture<MetricAllTagsResponse> */ public CompletableFuture listTagsByMetricNameAsync(String metricName) { - return listTagsByMetricNameWithHttpInfoAsync(metricName) + return listTagsByMetricNameWithHttpInfoAsync( + metricName, new ListTagsByMetricNameOptionalParameters()) .thenApply( response -> { return response.getData(); @@ -2018,9 +2100,44 @@ public CompletableFuture listTagsByMetricNameAsync(String } /** - * View indexed tag key-value pairs for a given metric name over the previous hour. + * List tags by metric name. + * + *

See {@link #listTagsByMetricNameWithHttpInfo}. * * @param metricName The name of the metric. (required) + * @param parameters Optional parameters for the request. + * @return MetricAllTagsResponse + * @throws ApiException if fails to make API call + */ + public MetricAllTagsResponse listTagsByMetricName( + String metricName, ListTagsByMetricNameOptionalParameters parameters) throws ApiException { + return listTagsByMetricNameWithHttpInfo(metricName, parameters).getData(); + } + + /** + * List tags by metric name. + * + *

See {@link #listTagsByMetricNameWithHttpInfoAsync}. + * + * @param metricName The name of the metric. (required) + * @param parameters Optional parameters for the request. + * @return CompletableFuture<MetricAllTagsResponse> + */ + public CompletableFuture listTagsByMetricNameAsync( + String metricName, ListTagsByMetricNameOptionalParameters parameters) { + return listTagsByMetricNameWithHttpInfoAsync(metricName, parameters) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * 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 metricName The name of the metric. (required) + * @param parameters Optional parameters for the request. * @return ApiResponse<MetricAllTagsResponse> * @throws ApiException if fails to make API call * @http.response.details @@ -2034,8 +2151,8 @@ public CompletableFuture listTagsByMetricNameAsync(String * 429 Too Many Requests - * */ - public ApiResponse listTagsByMetricNameWithHttpInfo(String metricName) - throws ApiException { + public ApiResponse listTagsByMetricNameWithHttpInfo( + String metricName, ListTagsByMetricNameOptionalParameters parameters) throws ApiException { Object localVarPostBody = null; // verify the required parameter 'metricName' is set @@ -2043,19 +2160,35 @@ public ApiResponse listTagsByMetricNameWithHttpInfo(Strin throw new ApiException( 400, "Missing the required parameter 'metricName' when calling listTagsByMetricName"); } + Long windowSeconds = parameters.windowSeconds; + String filterTags = parameters.filterTags; + String filterMatch = parameters.filterMatch; + Boolean filterIncludeTagValues = parameters.filterIncludeTagValues; + Boolean filterAllowPartial = parameters.filterAllowPartial; + Integer pageLimit = parameters.pageLimit; // create path and map variables String localVarPath = "/api/v2/metrics/{metric_name}/all-tags" .replaceAll( "\\{" + "metric_name" + "\\}", apiClient.escapeString(metricName.toString())); + List localVarQueryParams = new ArrayList(); Map localVarHeaderParams = new HashMap(); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "window[seconds]", windowSeconds)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "filter[tags]", filterTags)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "filter[match]", filterMatch)); + localVarQueryParams.addAll( + apiClient.parameterToPairs("", "filter[include_tag_values]", filterIncludeTagValues)); + localVarQueryParams.addAll( + apiClient.parameterToPairs("", "filter[allow_partial]", filterAllowPartial)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[limit]", pageLimit)); + Invocation.Builder builder = apiClient.createBuilder( "v2.MetricsApi.listTagsByMetricName", localVarPath, - new ArrayList(), + localVarQueryParams, localVarHeaderParams, new HashMap(), new String[] {"application/json"}, @@ -2077,10 +2210,12 @@ public ApiResponse listTagsByMetricNameWithHttpInfo(Strin *

See {@link #listTagsByMetricNameWithHttpInfo}. * * @param metricName The name of the metric. (required) + * @param parameters Optional parameters for the request. * @return CompletableFuture<ApiResponse<MetricAllTagsResponse>> */ public CompletableFuture> - listTagsByMetricNameWithHttpInfoAsync(String metricName) { + listTagsByMetricNameWithHttpInfoAsync( + String metricName, ListTagsByMetricNameOptionalParameters parameters) { Object localVarPostBody = null; // verify the required parameter 'metricName' is set @@ -2092,21 +2227,37 @@ public ApiResponse listTagsByMetricNameWithHttpInfo(Strin "Missing the required parameter 'metricName' when calling listTagsByMetricName")); return result; } + Long windowSeconds = parameters.windowSeconds; + String filterTags = parameters.filterTags; + String filterMatch = parameters.filterMatch; + Boolean filterIncludeTagValues = parameters.filterIncludeTagValues; + Boolean filterAllowPartial = parameters.filterAllowPartial; + Integer pageLimit = parameters.pageLimit; // create path and map variables String localVarPath = "/api/v2/metrics/{metric_name}/all-tags" .replaceAll( "\\{" + "metric_name" + "\\}", apiClient.escapeString(metricName.toString())); + List localVarQueryParams = new ArrayList(); Map localVarHeaderParams = new HashMap(); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "window[seconds]", windowSeconds)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "filter[tags]", filterTags)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "filter[match]", filterMatch)); + localVarQueryParams.addAll( + apiClient.parameterToPairs("", "filter[include_tag_values]", filterIncludeTagValues)); + localVarQueryParams.addAll( + apiClient.parameterToPairs("", "filter[allow_partial]", filterAllowPartial)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[limit]", pageLimit)); + Invocation.Builder builder; try { builder = apiClient.createBuilder( "v2.MetricsApi.listTagsByMetricName", localVarPath, - new ArrayList(), + localVarQueryParams, localVarHeaderParams, new HashMap(), new String[] {"application/json"}, diff --git a/src/main/java/com/datadog/api/client/v2/model/MetricAllTags.java b/src/main/java/com/datadog/api/client/v2/model/MetricAllTags.java index 8cf45cb6b96..5dadf26c7a8 100644 --- a/src/main/java/com/datadog/api/client/v2/model/MetricAllTags.java +++ b/src/main/java/com/datadog/api/client/v2/model/MetricAllTags.java @@ -16,7 +16,7 @@ import java.util.Map; import java.util.Objects; -/** Object for a single metric's indexed tags. */ +/** Object for a single metric's indexed and ingested tags. */ @JsonPropertyOrder({ MetricAllTags.JSON_PROPERTY_ATTRIBUTES, MetricAllTags.JSON_PROPERTY_ID, @@ -42,7 +42,7 @@ public MetricAllTags attributes(MetricAllTagsAttributes attributes) { } /** - * Object containing the definition of a metric's tags. + * Object containing the definition of a metric's indexed and ingested tags. * * @return attributes */ diff --git a/src/main/java/com/datadog/api/client/v2/model/MetricAllTagsAttributes.java b/src/main/java/com/datadog/api/client/v2/model/MetricAllTagsAttributes.java index cb93deb40dd..69f3819fd41 100644 --- a/src/main/java/com/datadog/api/client/v2/model/MetricAllTagsAttributes.java +++ b/src/main/java/com/datadog/api/client/v2/model/MetricAllTagsAttributes.java @@ -18,15 +18,50 @@ import java.util.Map; import java.util.Objects; -/** Object containing the definition of a metric's tags. */ -@JsonPropertyOrder({MetricAllTagsAttributes.JSON_PROPERTY_TAGS}) +/** Object containing the definition of a metric's indexed and ingested tags. */ +@JsonPropertyOrder({ + MetricAllTagsAttributes.JSON_PROPERTY_INGESTED_TAGS, + MetricAllTagsAttributes.JSON_PROPERTY_TAGS +}) @jakarta.annotation.Generated( value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") public class MetricAllTagsAttributes { @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_INGESTED_TAGS = "ingested_tags"; + private List ingestedTags = null; + public static final String JSON_PROPERTY_TAGS = "tags"; private List tags = null; + public MetricAllTagsAttributes ingestedTags(List ingestedTags) { + this.ingestedTags = ingestedTags; + return this; + } + + public MetricAllTagsAttributes addIngestedTagsItem(String ingestedTagsItem) { + if (this.ingestedTags == null) { + this.ingestedTags = new ArrayList<>(); + } + this.ingestedTags.add(ingestedTagsItem); + return this; + } + + /** + * List of ingested tags that are not indexed. + * + * @return ingestedTags + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_INGESTED_TAGS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getIngestedTags() { + return ingestedTags; + } + + public void setIngestedTags(List ingestedTags) { + this.ingestedTags = ingestedTags; + } + public MetricAllTagsAttributes tags(List tags) { this.tags = tags; return this; @@ -41,7 +76,7 @@ public MetricAllTagsAttributes addTagsItem(String tagsItem) { } /** - * List of indexed tag value pairs. + * List of indexed tags. * * @return tags */ @@ -112,19 +147,21 @@ public boolean equals(Object o) { return false; } MetricAllTagsAttributes metricAllTagsAttributes = (MetricAllTagsAttributes) o; - return Objects.equals(this.tags, metricAllTagsAttributes.tags) + return Objects.equals(this.ingestedTags, metricAllTagsAttributes.ingestedTags) + && Objects.equals(this.tags, metricAllTagsAttributes.tags) && Objects.equals(this.additionalProperties, metricAllTagsAttributes.additionalProperties); } @Override public int hashCode() { - return Objects.hash(tags, additionalProperties); + return Objects.hash(ingestedTags, tags, additionalProperties); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class MetricAllTagsAttributes {\n"); + sb.append(" ingestedTags: ").append(toIndentedString(ingestedTags)).append("\n"); sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); sb.append(" additionalProperties: ") .append(toIndentedString(additionalProperties)) diff --git a/src/main/java/com/datadog/api/client/v2/model/MetricAllTagsResponse.java b/src/main/java/com/datadog/api/client/v2/model/MetricAllTagsResponse.java index b0c14c70e22..9dccb2d4619 100644 --- a/src/main/java/com/datadog/api/client/v2/model/MetricAllTagsResponse.java +++ b/src/main/java/com/datadog/api/client/v2/model/MetricAllTagsResponse.java @@ -16,7 +16,7 @@ import java.util.Map; import java.util.Objects; -/** Response object that includes a single metric's indexed tags. */ +/** Response object that includes a single metric's indexed and ingested tags. */ @JsonPropertyOrder({MetricAllTagsResponse.JSON_PROPERTY_DATA}) @jakarta.annotation.Generated( value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") @@ -32,7 +32,7 @@ public MetricAllTagsResponse data(MetricAllTags data) { } /** - * Object for a single metric's indexed tags. + * Object for a single metric's indexed and ingested tags. * * @return data */