diff --git a/.apigentools-info b/.apigentools-info index 00e69611ed5e..c1747ca0b156 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.4", - "regenerated": "2022-08-29 15:23:50.079765", - "spec_repo_commit": "592474c8" + "regenerated": "2022-08-29 17:43:22.563285", + "spec_repo_commit": "0050c4a2" }, "v2": { "apigentools_version": "1.6.4", - "regenerated": "2022-08-29 15:23:50.095711", - "spec_repo_commit": "592474c8" + "regenerated": "2022-08-29 17:43:22.580143", + "spec_repo_commit": "0050c4a2" } } } \ No newline at end of file diff --git a/.generator/schemas/v1/openapi.yaml b/.generator/schemas/v1/openapi.yaml index b9d2683cd813..cf5b19723d77 100644 --- a/.generator/schemas/v1/openapi.yaml +++ b/.generator/schemas/v1/openapi.yaml @@ -5515,12 +5515,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 49942e46653c..93743c419560 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/.github/workflows/test_integration.yml b/.github/workflows/test_integration.yml index 3ea31bc46f88..72bc144b8849 100644 --- a/.github/workflows/test_integration.yml +++ b/.github/workflows/test_integration.yml @@ -50,6 +50,10 @@ jobs: repo: datadog-api-spec status: pending context: integration + - name: Install system zstd + run: | + sudo apt-get -y install zstd + echo "ZSTANDARD_LIBRARY=$(find /usr/lib -iname libzstd.so.1)" >> $GITHUB_ENV - name: Set up Ruby 3.1 uses: ruby/setup-ruby@v1 with: diff --git a/examples/v2/metrics/SubmitMetrics_1762007427.rb b/examples/v2/metrics/SubmitMetrics_1762007427.rb new file mode 100644 index 000000000000..e93001fb2084 --- /dev/null +++ b/examples/v2/metrics/SubmitMetrics_1762007427.rb @@ -0,0 +1,23 @@ +# Submit metrics with compression returns "Payload accepted" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::MetricsAPI.new + +body = DatadogAPIClient::V2::MetricPayload.new({ + series: [ + DatadogAPIClient::V2::MetricSeries.new({ + metric: "system.load.1", + type: DatadogAPIClient::V2::MetricIntakeType::UNSPECIFIED, + points: [ + DatadogAPIClient::V2::MetricPoint.new({ + timestamp: Time.now.to_i, + value: 0.7, + }), + ], + }), + ], +}) +opts = { + content_encoding: MetricContentEncoding::ZSTD1, +} +p api_instance.submit_metrics(body, opts) diff --git a/features/v2/metrics.feature b/features/v2/metrics.feature index fefa342fffe1..48f43ab4d55b 100644 --- a/features/v2/metrics.feature +++ b/features/v2/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 diff --git a/lib/datadog_api_client/v1/api/metrics_api.rb b/lib/datadog_api_client/v1/api/metrics_api.rb index 6d1ce2a4804c..781501336335 100644 --- a/lib/datadog_api_client/v1/api/metrics_api.rb +++ b/lib/datadog_api_client/v1/api/metrics_api.rb @@ -406,7 +406,7 @@ def submit_metrics_with_http_info(body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: MetricsAPI.submit_metrics ...' end - allowable_values = ['deflate'] + allowable_values = ['deflate', 'gzip'] if @api_client.config.client_side_validation && opts[:'content_encoding'] && !allowable_values.include?(opts[:'content_encoding']) fail ArgumentError, "invalid value for \"content_encoding\", must be one of #{allowable_values}" end diff --git a/lib/datadog_api_client/v1/models/metric_content_encoding.rb b/lib/datadog_api_client/v1/models/metric_content_encoding.rb index a2542c22066f..99376e4e7c26 100644 --- a/lib/datadog_api_client/v1/models/metric_content_encoding.rb +++ b/lib/datadog_api_client/v1/models/metric_content_encoding.rb @@ -22,5 +22,6 @@ class MetricContentEncoding include BaseEnumModel DEFLATE = "deflate".freeze + GZIP = "gzip".freeze end end diff --git a/lib/datadog_api_client/v2/api/metrics_api.rb b/lib/datadog_api_client/v2/api/metrics_api.rb index bf78267f8b65..5b4697752f16 100644 --- a/lib/datadog_api_client/v2/api/metrics_api.rb +++ b/lib/datadog_api_client/v2/api/metrics_api.rb @@ -687,7 +687,7 @@ def submit_metrics_with_http_info(body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: MetricsAPI.submit_metrics ...' end - allowable_values = ['deflate'] + allowable_values = ['deflate', 'zstd1', 'gzip'] if @api_client.config.client_side_validation && opts[:'content_encoding'] && !allowable_values.include?(opts[:'content_encoding']) fail ArgumentError, "invalid value for \"content_encoding\", must be one of #{allowable_values}" end diff --git a/lib/datadog_api_client/v2/models/metric_content_encoding.rb b/lib/datadog_api_client/v2/models/metric_content_encoding.rb index f4a4de53e883..f0973f569073 100644 --- a/lib/datadog_api_client/v2/models/metric_content_encoding.rb +++ b/lib/datadog_api_client/v2/models/metric_content_encoding.rb @@ -22,5 +22,7 @@ class MetricContentEncoding include BaseEnumModel DEFLATE = "deflate".freeze + ZSTD1 = "zstd1".freeze + GZIP = "gzip".freeze end end