Include the target name in c-ares and native DNS summary error messages

pull/23493/head
Alexander Polcyn 4 years ago
parent 8a84fb3654
commit 3ce93f3795
  1. 7
      src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc
  2. 8
      src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc

@ -25,6 +25,7 @@
#include <string.h>
#include "absl/container/inlined_vector.h"
#include "absl/strings/str_cat.h"
#include <grpc/support/alloc.h>
#include <grpc/support/string_util.h>
@ -370,9 +371,11 @@ void AresDnsResolver::OnResolvedLocked(grpc_error* error) {
} else {
GRPC_CARES_TRACE_LOG("resolver:%p dns resolution failed: %s", this,
grpc_error_string(error));
std::string error_message =
absl::StrCat("DNS resolution failed for service: ", name_to_resolve_);
result_handler()->ReturnError(grpc_error_set_int(
GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING(
"DNS resolution failed", &error, 1),
GRPC_ERROR_CREATE_REFERENCING_FROM_COPIED_STRING(error_message.c_str(),
&error, 1),
GRPC_ERROR_INT_GRPC_STATUS, GRPC_STATUS_UNAVAILABLE));
// Set retry timer.
grpc_millis next_try = backoff_.NextAttemptTime();

@ -22,6 +22,8 @@
#include <climits>
#include <cstring>
#include "absl/strings/str_cat.h"
#include <grpc/support/alloc.h>
#include <grpc/support/string_util.h>
#include <grpc/support/time.h>
@ -195,9 +197,11 @@ void NativeDnsResolver::OnResolvedLocked(grpc_error* error) {
gpr_log(GPR_INFO, "dns resolution failed (will retry): %s",
grpc_error_string(error));
// Return transient error.
std::string error_message =
absl::StrCat("DNS resolution failed for service: ", name_to_resolve_);
result_handler()->ReturnError(grpc_error_set_int(
GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING(
"DNS resolution failed", &error, 1),
GRPC_ERROR_CREATE_REFERENCING_FROM_COPIED_STRING(error_message.c_str(),
&error, 1),
GRPC_ERROR_INT_GRPC_STATUS, GRPC_STATUS_UNAVAILABLE));
// Set up for retry.
grpc_millis next_try = backoff_.NextAttemptTime();

Loading…
Cancel
Save