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
clustermesh: silence misleading logs about service resolution #26614
clustermesh: silence misleading logs about service resolution #26614
Conversation
/test |
Is there any chance that this will hide useful error messages as well? Should we re-enable logging if debug mode is on? |
I'm a bit doubtful as well. That function currently emits four log messages depending on the conditions:
An alternative could be to add a flag to silence the first three types of messages and keep only the last, to know the actual target and spot possible issues. WDYT? |
It would be ideal to log - somewhere - the actual IP to which we're connecting, especially since there is some amount of magic going on. But I wouldn't consider that a blocker -- your call. |
9f5a82a ("clustermesh: use custom dialer for service resolution") configured a custom dialer to perform service resolution when the etcd address refers to a local service (mainly in the kvstoremesh case). Yet, the custom dialer function outputs quite verbose log messages, which can be misleading when the address does not point to a local service (as it is correct that the address cannot be parsed). One example being: level=error msg="Unable to parse etcd service URL" error="parse \"172.19.0.2:2379\": first path segment in URL cannot contain colon" Hence, let's silence them, as they do more harm than good in this specific situation. We still print (at debug level) the outcome of the translation, so that we know to whom we are actually connecting. Fixes: 9f5a82a ("clustermesh: use custom dialer for service resolution") Signed-off-by: Marco Iorio <marco.iorio@isovalent.com>
Currently, the custom dialer ignores the context it is passed to. Let's switch to using DialContext, so that we properly propagate it. This mimics also the default behavior when no custom dialer is configured [1]. [1] vendor/google.golang.org/grpc/internal/transport/http2_client.go:179 Signed-off-by: Marco Iorio <marco.iorio@isovalent.com>
0c56289
to
cf33a87
Compare
I updated that function to allow silencing the error messages, while preserving the one which shows the target address (at debug level). While being there, I also updated the custom dialer to propagate the given context. @squeed PTAL. |
/test |
I'd like to propose an alternative solution. We should be using valid URLs in any cases where this error message is popping up. Adding a scheme ( Go Playground example: https://go.dev/play/p/OJB_oM5PQGO |
Yeah, the dialer is passed the address without the scheme, although it was originally present. We could probably prepend a fake scheme while doing the translation to silence it (although it wouldn't change anything in terms of the final result). I'm still personally in favor of this change, as also the other log messages pointing out failures (although at debug level) might be misleading (as also possibly repeated multiple times). WDYT? |
@giorio94 considering the service IP lookup, it makes sense to me |
9f5a82a ("clustermesh: use custom dialer for service resolution") configured a custom dialer to perform service resolution when the etcd address refers to a local service (mainly in the kvstoremesh case).
Yet, the custom dialer function outputs quite verbose log messages, which can be misleading when the address does not point to a local service (as it is correct that the address cannot be parsed). One example being:
Hence, let's silence them, as they do more harm than good in this specific situation. We still print (at debug level) the outcome of the translation, so that we know to whom we are actually connecting.