Include the query type and name in all c-ares DNS error messages#22865
Include the query type and name in all c-ares DNS error messages#22865apolcyn merged 1 commit intogrpc:masterfrom
Conversation
markdroth
left a comment
There was a problem hiding this comment.
Adding these fields to the logs is a good idea!
At some point, we really do need to convert all of the c-ares resolver code to idiomatic C++. This is basically the only code in the client_channel tree that is still C. :(
src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc
Outdated
Show resolved
Hide resolved
src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc
Outdated
Show resolved
Hide resolved
| static void grpc_ares_request_ref_locked(grpc_ares_request* r); | ||
| static void grpc_ares_request_unref_locked(grpc_ares_request* r); | ||
|
|
||
| class GrpcAresQuery { |
There was a problem hiding this comment.
I don't understand the purpose of this class. It seems to be a simple wrapper of grpc_ares_request, but it doesn't seem to provide any functionality that isn't already present in the latter. Why is this wrapper being added?
There was a problem hiding this comment.
My idea here was that a GrpcAresQuery tracks fields that are particular to a single c-ares query (or "search") - e.g. a single A, AAAA, SRV, or TXT resolution performed by the c-ares APIs. A grpc_ares_request, on the other hand, tracks fields that are necessary to drive a complete DNS resolution process - which consists of multiple "child" queries.
So, the main thing is that a grpc_ares_request and a GrpcAresQuery differ in scope and lifetime - the former is per-grpc-resolution and the latter is per-c-ares-query.
Alternatively we could just put the SRV target name and TXT target name as additional fields into the grpc_ares_request, but keeping them separate seemed cleaner (I think this will become more important after making grpc_ares_hostbyname_request a sub-type of GrpcAresQuery).
There was a problem hiding this comment.
Okay, I guess this is fine for now. I would like to find a cleaner way to do this that does not require allocating so many different data structures, but I guess we can optimize that as part of the larger C++ conversion. For now, please add a TODO about this.
Yes, sorry this has taken a while. C++-izing this will be a more broad change though because we'll need to change the |
| static void grpc_ares_request_ref_locked(grpc_ares_request* r); | ||
| static void grpc_ares_request_unref_locked(grpc_ares_request* r); | ||
|
|
||
| class GrpcAresQuery { |
There was a problem hiding this comment.
Okay, I guess this is fine for now. I would like to find a cleaner way to do this that does not require allocating so many different data structures, but I guess we can optimize that as part of the larger C++ conversion. For now, please add a TODO about this.
925fbfa to
bbdfde5
Compare
Done, added a TODO |
|
Thanks for the quick review, squashed down commmits |
|
tests are green |
Fixes #21308.
Includes query type (e.g. "A", "AAAA", "SRV", "TXT"), and target name in potentially-surfaced errors. This additional context should help debugging DNS related errors with and without trace logs enabled. I've found myself wondering what e.g. the particular query type a c-ares tracer log line corresponded to more than once.
Example log lines with these errors messages: