Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SNOW-1357377 Add request Id in all streaming ingest APIs #759

Merged
merged 4 commits into from
Jun 13, 2024

Conversation

sfc-gh-japatel
Copy link
Collaborator

  • Add requestId as a Query Parameter.
  • Remove requestId from payload since it is not used anywhere on server side.

Along with this, our response should also include requestId but that can come later since they can still rely on offsetToken API. (Wont work for other APIs but there hasn't been any request)

This is for internal logging purposes.

@sfc-gh-japatel sfc-gh-japatel marked this pull request as ready for review June 7, 2024 18:24
@sfc-gh-japatel sfc-gh-japatel requested review from sfc-gh-tzhang and a team as code owners June 7, 2024 18:24
Copy link
Contributor

@sfc-gh-asen sfc-gh-asen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

Copy link
Collaborator

@sfc-gh-rcheng sfc-gh-rcheng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm! small question on if we want to log the requestid

.setHost(host)
.setPort(port)
.setPath(endPoint)
.setParameter(REQUEST_ID, UUID.randomUUID().toString())
Copy link
Collaborator

@sfc-gh-rcheng sfc-gh-rcheng Jun 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we log this requestid? might be too many logs, but it will be useful to know where/when the request was created in the ingest sdk

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Valid point. added requestId in above debug log! we dont need everywhere IMO. this requestId is mainly for internal debugging.

@sfc-gh-japatel sfc-gh-japatel force-pushed the japatel-SNOW-1357377-requestid-qp branch from 0dee895 to d47b5c1 Compare June 7, 2024 21:05
@@ -678,12 +678,23 @@ public HttpGet generateHistoryRangeRequest(
*/
public HttpPost generateStreamingIngestPostRequest(
String payload, String endPoint, String message) {
LOGGER.debug("Generate Snowpipe streaming request: endpoint={}, payload={}", endPoint, payload);
final String requestId = UUID.randomUUID().toString();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My assumption is that the request id will remain the same with retry?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thats true!

@@ -493,7 +493,6 @@ ChannelsStatusResponse getChannelsStatus(
.collect(Collectors.toList());
request.setChannels(requestDTOs);
request.setRole(this.role);
request.setRequestId(this.flushService.getClientPrefix() + "_" + counter.getAndIncrement());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should remove request_id in the request as well

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you mean in the POJO?

Copy link
Contributor

@sfc-gh-tzhang sfc-gh-tzhang Jun 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, in the request class

@sfc-gh-japatel sfc-gh-japatel force-pushed the japatel-SNOW-1357377-requestid-qp branch from d47b5c1 to 168f3d3 Compare June 11, 2024 21:21
Copy link
Contributor

@sfc-gh-tzhang sfc-gh-tzhang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's remove the request_id in the ChannelsStatusRequest class, otherwise LGTM, thanks

import static net.snowflake.ingest.utils.Constants.RESPONSE_SUCCESS;
import static net.snowflake.ingest.utils.Constants.ROLE;
import static net.snowflake.ingest.utils.Constants.USER;
import static net.snowflake.ingest.utils.Constants.*;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no star import

@sfc-gh-japatel sfc-gh-japatel merged commit e233920 into master Jun 13, 2024
93 checks passed
@sfc-gh-japatel sfc-gh-japatel deleted the japatel-SNOW-1357377-requestid-qp branch June 13, 2024 19:28
sfc-gh-kgaputis pushed a commit to sfc-gh-kgaputis/snowflake-ingest-java that referenced this pull request Sep 12, 2024
…#759)

* SNOW-1357377 Add request Id in all streaming ingest APIs

* Fix tests and log requestId

* Format

* Remove request_id and no star imports
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants