-
Notifications
You must be signed in to change notification settings - Fork 1k
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
fix: 404 for /topics connect endpoint logs a warn instead of showing up in CLI #8462
Conversation
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.
Thanks for the quick fix, @Gerrrr ! Any chance we can add a quick unit test to prevent regressions on this new behavior?
@@ -99,7 +104,12 @@ public StatementExecutorResponse execute( | |||
final ConnectResponse<Map<String, Map<String, List<String>>>> topicsResponse = serviceContext | |||
.getConnectClient() | |||
.topics(connectorName); | |||
if (topicsResponse.error().isPresent()) { | |||
if (topicsResponse.error().isPresent() | |||
&& topicsResponse.httpCode() == HttpStatus.SC_NOT_FOUND) { |
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.
Can we add a quick comment in the code about why we handle the 404 case differently? I can imagine future readers seeing this and being confused.
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 in 9eda284.
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.
Yup, just wanted to see the unit test. Thanks a bunch, @Gerrrr !
Description
The
/topics
connector endpoint is relatively new in CP. This endpoint is exercised by ksqlDB as part ofDESCRIBE CONNECTOR
. If the endpoint is not available (i.e., a 404 response is returned), ksql CLI shows a warning right after the command output. For example:Instead of showing this warning in the CLI output, this PR forwards it to the server log. As a result, the server log contains 2 warnings for the not found endpoint - a generic one from the connect client as well as a specific entry from the
DescribeConnectorExecutor
:In my opinion, having 2 similar log entries is OK in this case. We do want the users to have a way to find out why they don't see the topics information. Removing the additional log in
DescribeConnectorExecutor
would make an implicit dependency between this class andDefaultConnectClient
. Given that we do not usually unit test for log entries, I'd say that little duplication is the lesser evil.Testing done
I tested the change manually. I started CP, PostgreSQL, ksqlDB, then created a JDBC connector:
Then ran
Applied the change and re-ran the last command:
Then checked that there is a new entry in the server logs:
Reviewer checklist