diff --git a/.apigentools-info b/.apigentools-info index 527f751f3d0..fef0549938c 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.4", - "regenerated": "2022-08-26 14:02:53.343399", - "spec_repo_commit": "3f049059" + "regenerated": "2022-08-26 17:53:59.790126", + "spec_repo_commit": "c392c0b2" }, "v2": { "apigentools_version": "1.6.4", - "regenerated": "2022-08-26 14:02:53.357032", - "spec_repo_commit": "3f049059" + "regenerated": "2022-08-26 17:53:59.802556", + "spec_repo_commit": "c392c0b2" } } } \ No newline at end of file diff --git a/.generator/schemas/v1/openapi.yaml b/.generator/schemas/v1/openapi.yaml index 2693b1f7317..eddc771853b 100644 --- a/.generator/schemas/v1/openapi.yaml +++ b/.generator/schemas/v1/openapi.yaml @@ -5513,12 +5513,16 @@ components: x-enum-varnames: - USER_AGENT_PARSER MetricContentEncoding: + default: deflate description: HTTP header used to compress the media-type. enum: - deflate + - gzip + example: deflate type: string x-enum-varnames: - DEFLATE + - GZIP MetricMetadata: description: Object with all metric related metadata. properties: diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 49942e46653..93743c41956 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -4319,9 +4319,14 @@ components: description: HTTP header used to compress the media-type. enum: - deflate + - zstd1 + - gzip + example: deflate type: string x-enum-varnames: - DEFLATE + - ZSTD1 + - GZIP MetricCustomAggregation: description: A time and space aggregation combination for use in query. example: diff --git a/examples/v2/metrics/SubmitMetrics_1762007427.java b/examples/v2/metrics/SubmitMetrics_1762007427.java new file mode 100644 index 00000000000..38130eb0fb4 --- /dev/null +++ b/examples/v2/metrics/SubmitMetrics_1762007427.java @@ -0,0 +1,47 @@ +// Submit metrics with compression returns "Payload accepted" response +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.MetricsApi; +import com.datadog.api.client.v2.api.MetricsApi.SubmitMetricsOptionalParameters; +import com.datadog.api.client.v2.model.IntakePayloadAccepted; +import com.datadog.api.client.v2.model.MetricContentEncoding; +import com.datadog.api.client.v2.model.MetricIntakeType; +import com.datadog.api.client.v2.model.MetricPayload; +import com.datadog.api.client.v2.model.MetricPoint; +import com.datadog.api.client.v2.model.MetricSeries; +import java.time.OffsetDateTime; +import java.util.Collections; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + MetricsApi apiInstance = new MetricsApi(defaultClient); + + MetricPayload body = + new MetricPayload() + .series( + Collections.singletonList( + new MetricSeries() + .metric("system.load.1") + .type(MetricIntakeType.UNSPECIFIED) + .points( + Collections.singletonList( + new MetricPoint() + .timestamp(OffsetDateTime.now().toInstant().getEpochSecond()) + .value(0.7))))); + + try { + IntakePayloadAccepted result = + apiInstance.submitMetrics( + body, + new SubmitMetricsOptionalParameters().contentEncoding(MetricContentEncoding.ZSTD1)); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling MetricsApi#submitMetrics"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/src/main/java/com/datadog/api/client/v1/api/MetricsApi.java b/src/main/java/com/datadog/api/client/v1/api/MetricsApi.java index 105f7970bea..5cabbd891dd 100644 --- a/src/main/java/com/datadog/api/client/v1/api/MetricsApi.java +++ b/src/main/java/com/datadog/api/client/v1/api/MetricsApi.java @@ -923,7 +923,8 @@ public static class SubmitMetricsOptionalParameters { /** * Set contentEncoding. * - * @param contentEncoding HTTP header used to compress the media-type. (optional) + * @param contentEncoding HTTP header used to compress the media-type. (optional, default to + * "deflate") * @return SubmitMetricsOptionalParameters */ public SubmitMetricsOptionalParameters contentEncoding(MetricContentEncoding contentEncoding) { diff --git a/src/main/java/com/datadog/api/client/v1/model/MetricContentEncoding.java b/src/main/java/com/datadog/api/client/v1/model/MetricContentEncoding.java index d79543be2f7..e67804ff914 100644 --- a/src/main/java/com/datadog/api/client/v1/model/MetricContentEncoding.java +++ b/src/main/java/com/datadog/api/client/v1/model/MetricContentEncoding.java @@ -24,8 +24,10 @@ public class MetricContentEncoding { public static final MetricContentEncoding DEFLATE = new MetricContentEncoding("deflate"); + public static final MetricContentEncoding GZIP = new MetricContentEncoding("gzip"); - private static final Set allowedValues = new HashSet(Arrays.asList("deflate")); + private static final Set allowedValues = + new HashSet(Arrays.asList("deflate", "gzip")); private String value; diff --git a/src/main/java/com/datadog/api/client/v2/model/MetricContentEncoding.java b/src/main/java/com/datadog/api/client/v2/model/MetricContentEncoding.java index 31b621b430f..17e5b8af0ac 100644 --- a/src/main/java/com/datadog/api/client/v2/model/MetricContentEncoding.java +++ b/src/main/java/com/datadog/api/client/v2/model/MetricContentEncoding.java @@ -24,8 +24,11 @@ public class MetricContentEncoding { public static final MetricContentEncoding DEFLATE = new MetricContentEncoding("deflate"); + public static final MetricContentEncoding ZSTD1 = new MetricContentEncoding("zstd1"); + public static final MetricContentEncoding GZIP = new MetricContentEncoding("gzip"); - private static final Set allowedValues = new HashSet(Arrays.asList("deflate")); + private static final Set allowedValues = + new HashSet(Arrays.asList("deflate", "zstd1", "gzip")); private String value; diff --git a/src/test/resources/com/datadog/api/client/v2/api/metrics.feature b/src/test/resources/com/datadog/api/client/v2/api/metrics.feature index fefa342fffe..48f43ab4d55 100644 --- a/src/test/resources/com/datadog/api/client/v2/api/metrics.feature +++ b/src/test/resources/com/datadog/api/client/v2/api/metrics.feature @@ -216,6 +216,14 @@ Feature: Metrics When the request is sent Then the response status is 408 Request timeout + @integration-only @skip-terraform-config @skip-validation @team:DataDog/metrics-intake @team:DataDog/metrics-query + Scenario: Submit metrics with compression returns "Payload accepted" response + Given new "SubmitMetrics" request + And body with value {"series": [{"metric": "system.load.1", "type": 0, "points": [{"timestamp": {{ timestamp('now') }}, "value": 0.7}]}]} + And request contains "Content-Encoding" parameter with value "zstd1" + When the request is sent + Then the response status is 202 Payload accepted + @generated @skip @team:DataDog/points-aggregation Scenario: Tag Configuration Cardinality Estimator returns "API error response." response Given a valid "appKeyAuth" key in the system