Skip to content
Open
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
1 change: 1 addition & 0 deletions .generator/schemas/v1/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1390,6 +1390,7 @@ components:
- PREVIOUS_WEEK
- PREVIOUS_MONTH
ContentEncoding:
default: gzip
description: HTTP header used to compress the media-type.
enum:
- gzip
Expand Down
1 change: 1 addition & 0 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22550,6 +22550,7 @@ components:
type: string
type: object
ContentEncoding:
default: gzip
description: HTTP header used to compress the media-type.
enum:
- identity
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/com/datadog/api/client/v1/api/LogsApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -187,13 +187,14 @@ public CompletableFuture<ApiResponse<LogsListResponse>> listLogsWithHttpInfoAsyn

/** Manage optional parameters to submitLog. */
public static class SubmitLogOptionalParameters {
private ContentEncoding contentEncoding;
private ContentEncoding contentEncoding = ContentEncoding.GZIP;
private String ddtags;

/**
* 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
* "gzip")
* @return SubmitLogOptionalParameters
*/
public SubmitLogOptionalParameters contentEncoding(ContentEncoding contentEncoding) {
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/com/datadog/api/client/v2/api/LogsApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -765,13 +765,14 @@ public CompletableFuture<ApiResponse<LogsListResponse>> listLogsGetWithHttpInfoA

/** Manage optional parameters to submitLog. */
public static class SubmitLogOptionalParameters {
private ContentEncoding contentEncoding;
private ContentEncoding contentEncoding = ContentEncoding.GZIP;
private String ddtags;

/**
* 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
* "gzip")
* @return SubmitLogOptionalParameters
*/
public SubmitLogOptionalParameters contentEncoding(ContentEncoding contentEncoding) {
Expand Down
11 changes: 11 additions & 0 deletions src/test/java/com/datadog/api/RecorderSteps.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import io.cucumber.java.BeforeAll;
import io.cucumber.java.Scenario;
import io.cucumber.java.Status;
import io.cucumber.java.en.Given;
import io.cucumber.java.en.When;
import java.io.File;
import java.io.IOException;
Expand Down Expand Up @@ -197,6 +198,16 @@ public String getCassetteName() {
return world.getName() + ".json";
}

@Given("the request uses {string} compression")
public void theRequestUsesCompression(String compression) {
// The generated replay server validates the Content-Encoding header and compressed body.
}

@Given("the user selects {string} compression")
public void theUserSelectsCompression(String compression) {
// The generated request plan passes the selected compression to the client call.
}

@When("the request is sent")
public void theRequestIsSent() throws Exception {
TestRunner.applyPlan(world, false);
Expand Down
4 changes: 4 additions & 0 deletions src/test/java/com/datadog/api/TestRunner.java
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,10 @@ public static void applyPlan(World world, boolean pagination) throws Exception {
Object value = materialize(body.get("value"), world);
world.addMaterializedRequestParameter("body", MAPPER.writeValueAsString(value));
}
if (request.get("selected_compression") != null) {
world.addMaterializedRequestParameter(
"Content-Encoding", MAPPER.writeValueAsString(request.get("selected_compression")));
}
for (Map<String, Object> parameter : parameters) {
if (!"path".equals(parameter.get("in")) && !Boolean.TRUE.equals(parameter.get("required"))) {
applyParameter(world, parameter);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ Feature: Logs
When the request is sent
Then the response status is 200 OK

@integration-only @skip-terraform-config @skip-validation @team:DataDog/event-platform-intake
@skip-terraform-config @skip-validation @team:DataDog/event-platform-intake
Scenario: Send deflate logs returns "Response from server (always 200 empty JSON)." response
Given new "SubmitLog" request
And body with value [{"message": "{{ unique }}", "ddtags": "host:{{ unique_alnum }}"}]
And request contains "Content-Encoding" parameter with value "deflate"
And the user selects "deflate" compression
When the request is sent
Then the response status is 200 Response from server (always 200 empty JSON).

Expand All @@ -52,6 +52,7 @@ Feature: Logs
Scenario: Send logs returns "Response from server (always 200 empty JSON)." response
Given new "SubmitLog" request
And body with value [{"message": "{{ unique }}", "ddtags": "host:{{ unique_alnum }}"}]
And the request uses "gzip" compression
When the request is sent
Then the response status is 200 Response from server (always 200 empty JSON).

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,11 @@ Feature: Logs
Then the response status is 200 OK
And the response has 3 items

@integration-only @skip-terraform-config @skip-validation @team:DataDog/event-platform-intake @team:DataDog/logs-backend @team:DataDog/logs-ingestion
@skip-terraform-config @skip-validation @team:DataDog/event-platform-intake @team:DataDog/logs-backend @team:DataDog/logs-ingestion
Scenario: Send deflate logs returns "Request accepted for processing (always 202 empty JSON)." response
Given new "SubmitLog" request
And body with value [{"ddsource": "nginx", "ddtags": "env:staging,version:5.1", "hostname": "i-012345678", "message": "2019-11-19T14:37:58,995 INFO [process.name][20081] Hello World", "service": "payment"}]
And request contains "Content-Encoding" parameter with value "deflate"
And the user selects "deflate" compression
When the request is sent
Then the response status is 202 Response from server (always 202 empty JSON).

Expand Down Expand Up @@ -169,5 +169,6 @@ Feature: Logs
Scenario: Send logs returns "Request accepted for processing (always 202 empty JSON)." response
Given new "SubmitLog" request
And body with value [{"ddsource": "nginx", "ddtags": "env:staging,version:5.1", "hostname": "i-012345678", "message": "2019-11-19T14:37:58,995 INFO [process.name][20081] Hello World", "service": "payment", "status": "info"}]
And the request uses "gzip" compression
When the request is sent
Then the response status is 202 Request accepted for processing (always 202 empty JSON).
Original file line number Diff line number Diff line change
Expand Up @@ -1211,6 +1211,13 @@
"scenario": "Search test logs returns \"OK\" response",
"version": "v1"
},
{
"feature": "Logs",
"feature_file": "../../com/datadog/api/client/v1/api/logs.feature",
"file": "v1/logs/send-deflate-logs-returns-response-from-server-always-200-empty-json-response.json",
"scenario": "Send deflate logs returns \"Response from server (always 200 empty JSON).\" response",
"version": "v1"
},
{
"feature": "Logs",
"feature_file": "../../com/datadog/api/client/v1/api/logs.feature",
Expand Down Expand Up @@ -6377,6 +6384,13 @@
"scenario": "Search logs returns \"OK\" response with pagination",
"version": "v2"
},
{
"feature": "Logs",
"feature_file": "../../com/datadog/api/client/v2/api/logs.feature",
"file": "v2/logs/send-deflate-logs-returns-request-accepted-for-processing-always-202-empty-json-response.json",
"scenario": "Send deflate logs returns \"Request accepted for processing (always 202 empty JSON).\" response",
"version": "v2"
},
{
"feature": "Logs",
"feature_file": "../../com/datadog/api/client/v2/api/logs.feature",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"api": "Logs",
"expected_status": 200,
"feature": "Logs",
"id": "v1/Logs/Send deflate logs returns \"Response from server (always 200 empty JSON).\" response",
"operation_id": "SubmitLog",
"request": {
"body": {
"schema": {
"format": null,
"items": {
"format": null,
"ref": "HTTPLogItem",
"type": "object"
},
"ref": "HTTPLog",
"type": "array"
},
"source": "inline",
"value": [
{
"ddtags": "host:{{ unique_alnum }}",
"message": "{{ unique }}"
}
]
},
"compression": "deflate",
"content_type": "application/json",
"method": "POST",
"pagination": false,
"parameters": [],
"path": "/v1/input",
"selected_compression": "deflate"
},
"scenario": "Send deflate logs returns \"Response from server (always 200 empty JSON).\" response",
"schema_version": 1,
"version": "v1"
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
}
]
},
"compression": "gzip",
"content_type": "application/json",
"method": "POST",
"pagination": false,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"api": "Logs",
"expected_status": 202,
"feature": "Logs",
"id": "v2/Logs/Send deflate logs returns \"Request accepted for processing (always 202 empty JSON).\" response",
"operation_id": "SubmitLog",
"request": {
"body": {
"schema": {
"format": null,
"items": {
"format": null,
"ref": "HTTPLogItem",
"type": "object"
},
"ref": "HTTPLog",
"type": "array"
},
"source": "inline",
"value": [
{
"ddsource": "nginx",
"ddtags": "env:staging,version:5.1",
"hostname": "i-012345678",
"message": "2019-11-19T14:37:58,995 INFO [process.name][20081] Hello World",
"service": "payment"
}
]
},
"compression": "deflate",
"content_type": "application/json",
"method": "POST",
"pagination": false,
"parameters": [],
"path": "/api/v2/logs",
"selected_compression": "deflate"
},
"scenario": "Send deflate logs returns \"Request accepted for processing (always 202 empty JSON).\" response",
"schema_version": 1,
"version": "v2"
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
}
]
},
"compression": "gzip",
"content_type": "application/json",
"method": "POST",
"pagination": false,
Expand Down
Loading
Loading