Skip to content

Conversation

@singhpk234
Copy link
Contributor

@singhpk234 singhpk234 commented Jun 4, 2025

About the change

This change attempts to add UA so that clients can set this at their end and it can supplement the server for audit and debugging purpose, we do have X-Client-Version which helps solve most of the cases as this helps server understand that what version of the client the server is interacted, but in a world where we want to see the logs at server end and identify what happened to a client will be very hard.

Putting this change out to see if folks are interested in this !

Testing

Added a new UT

@github-actions github-actions bot added the core label Jun 4, 2025
@singhpk234 singhpk234 changed the title REST: Add UA REST: Add UA to IRC calls Jun 4, 2025
@amogh-jahagirdar amogh-jahagirdar changed the title REST: Add UA to IRC calls REST: Add property for configuring user agent in REST http client Jun 5, 2025
.withHeader(HTTPClient.CLIENT_VERSION_HEADER, icebergBuildFullVersion)
.withHeader(HTTPClient.CLIENT_GIT_COMMIT_SHORT_HEADER, icebergBuildGitCommitShort);
.withHeader(HTTPClient.CLIENT_GIT_COMMIT_SHORT_HEADER, icebergBuildGitCommitShort)
.withHeader(USER_AGENT, TEST_USER_AGENT);
Copy link
Contributor

Choose a reason for hiding this comment

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

Just for my understanding, if I have a HTTP client configured to "my-user-agent" and then I later set it to "some-new-agent" on the request level, it will override it at the request level right? Just wanted to double check the order of precedence (not that I expect it to be used in practice that way)

Copy link
Contributor Author

@singhpk234 singhpk234 Jun 5, 2025

Choose a reason for hiding this comment

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

precisely, request level override always wins over the client level override.

@amogh-jahagirdar amogh-jahagirdar changed the title REST: Add property for configuring user agent in REST http client REST: Add property for configuring user agent in http client Jun 5, 2025

private static final int PORT = 1080;
private static final String BEARER_AUTH_TOKEN = "auth_token";
private static final String USER_AGENT = "User-Agent";
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: USER_AGENT constant exists in HttpHeaders class.

Copy link
Contributor

Choose a reason for hiding this comment

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

I was thinking about adding this constant to class HTTPClient, but if it's only used by test, we might not do that.

Copy link
Contributor

Choose a reason for hiding this comment

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

btw, I didn't find the constant in the class org.apache.iceberg.rest.HttpHeaders. Are you referring to another class with the same name?

Copy link
Contributor

@HonahX HonahX left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Contributor

@flyrain flyrain left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks for adding this @singhpk234 !

Copy link
Contributor

@amogh-jahagirdar amogh-jahagirdar left a comment

Choose a reason for hiding this comment

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

I think this looks good, I'll go ahead and merge. Thanks @singhpk234 and @nastra @HonahX @ebyhr @flyrain for reviewing!

@amogh-jahagirdar amogh-jahagirdar merged commit 17f9a9f into apache:main Jun 13, 2025
42 checks passed
eric-maynard pushed a commit to eric-maynard/iceberg that referenced this pull request Jun 18, 2025
…13234)

Co-authored-by: Prashant Singh <prashant.singh@snowflake.com>
devendra-nr pushed a commit to devendra-nr/iceberg that referenced this pull request Dec 8, 2025
…13234)

Co-authored-by: Prashant Singh <prashant.singh@snowflake.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants