-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Add detailed client information to User-Agent #25889
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
base: master
Are you sure you want to change the base?
Conversation
client/trino-client/src/main/java/io/trino/client/SourceBuilder.java
Outdated
Show resolved
Hide resolved
0a48c6f
to
c32f0dd
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The “source” field is user visible and used by resource groups for matching. It’s often set by applications for queuing purposes. It is not intended to be used for client version information.
The standard User-Agent header is appropriate for this purpose. If the intent is to log this in query history, user agent could be included there.
@electrum we send source as User-Agent |
Source is sent as
trino/client/trino-client/src/main/java/io/trino/client/StatementClientV1.java Lines 85 to 87 in ed87ef5
|
It's been that way since the beginning: 33032e7 |
c32f0dd
to
91e68bf
Compare
91e68bf
to
9830bbb
Compare
@VisibleForTesting | ||
static String sanitize(String value) | ||
{ | ||
return value.replaceAll("[^a-zA-Z0-9_.-]", "_"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: colapse mutiple unsane characters into single _
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. Added a test
This sends more information about the client to the Trino cluster. Structure is similiar to other tools like AWS SDK: ``` aws-sdk-java/2.31.42 md/io#sync md/http#Apache ua/2.1 os/Linux#5.10.236-228.935.amzn2.aarch64 lang/java#24.0.1 md/OpenJDK_64-Bit_Server_VM#24.0.1+9 md/vendor#Eclipse_Adoptium md/en_US app/Trino cfg/auth-source#stsweb m/D ``` For our own clients it will be similiar to: ``` trino-cli/1.0.0 os=Mac_OS_X os/version=15.3.1 arch=aarch64 lang/java=24+36 java/vm=OpenJDK_64-Bit_Server_VM java/vendor=Eclipse_Adoptium locale=pl-PL md/lang=en-US md/feature=experimental ```
User-Agent header is already added when HttpClientFactory is used to construct OkHttpClient
04d65f3
to
ee1b720
Compare
This sends more information about the client to the Trino cluster.
Structure is similiar to other tools like AWS SDK:
For our own clients it will be similiar to:
Description
Additional context and related issues
Release notes
( ) This is not user-visible or is docs only, and no release notes are required.
( ) Release notes are required. Please propose a release note for me.
(x) Release notes are required, with the following suggested text: