aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/lib/channel
diff options
context:
space:
mode:
authorGravatar ncteisen <ncteisen@gmail.com>2018-03-05 22:23:23 -0800
committerGravatar ncteisen <ncteisen@gmail.com>2018-03-05 22:23:23 -0800
commitac945eba98a11795faaa41b5d93fe27a8b5a89df (patch)
treed79726fd1e6d90e9711484eb9d449695f81c5497 /src/core/lib/channel
parent6684230224843456e5db89f768382c5830d83a79 (diff)
Reviewer comments
Diffstat (limited to 'src/core/lib/channel')
-rw-r--r--src/core/lib/channel/channel_tracer.cc23
1 files changed, 18 insertions, 5 deletions
diff --git a/src/core/lib/channel/channel_tracer.cc b/src/core/lib/channel/channel_tracer.cc
index 86b7a6cce9..fdb96570cd 100644
--- a/src/core/lib/channel/channel_tracer.cc
+++ b/src/core/lib/channel/channel_tracer.cc
@@ -27,6 +27,7 @@
#include <stdlib.h>
#include <string.h>
+#include "src/core/ext/filters/client_channel/status_util.h"
#include "src/core/lib/channel/object_registry.h"
#include "src/core/lib/gpr/string.h"
#include "src/core/lib/gpr/useful.h"
@@ -35,12 +36,12 @@
#include "src/core/lib/slice/slice_internal.h"
#include "src/core/lib/surface/channel.h"
#include "src/core/lib/transport/connectivity_state.h"
+#include "src/core/lib/transport/error_utils.h"
namespace grpc_core {
ChannelTrace::TraceEvent::~TraceEvent() {
GRPC_ERROR_UNREF(error_);
- referenced_tracer_.reset();
grpc_slice_unref_internal(data_);
}
@@ -56,7 +57,8 @@ ChannelTrace::ChannelTrace(size_t max_events)
gpr_mu_init(&tracer_mu_);
channel_uuid_ = grpc_object_registry_register_object(
this, GRPC_OBJECT_REGISTRY_CHANNEL_TRACER);
- time_created_ = gpr_now(GPR_CLOCK_REALTIME);
+ time_created_ = grpc_millis_to_timespec(grpc_core::ExecCtx::Get()->Now(),
+ GPR_CLOCK_REALTIME);
}
ChannelTrace::~ChannelTrace() {
@@ -131,9 +133,20 @@ void ChannelTrace::TraceEvent::RenderTraceEvent(grpc_json* json) {
// TODO(ncteisen): Either format this as google.rpc.Status here, or ensure
// it is done in the layers above core.
if (error_ != GRPC_ERROR_NONE) {
- json_iterator = grpc_json_create_child(
- json_iterator, json, "status", gpr_strdup(grpc_error_string(error_)),
- GRPC_JSON_STRING, true);
+ grpc_status_code code;
+ grpc_slice message;
+ grpc_error_get_status(error_, GRPC_MILLIS_INF_FUTURE, &code, &message,
+ nullptr, nullptr);
+ grpc_json* status = grpc_json_create_child(
+ json_iterator, json, "status", nullptr, GRPC_JSON_OBJECT, false);
+ json_iterator = grpc_json_create_child(nullptr, status, "code",
+ grpc_status_code_to_string(code),
+ GRPC_JSON_STRING, false);
+ grpc_json_create_child(json_iterator, status, "message",
+ grpc_slice_to_c_string(message), GRPC_JSON_STRING,
+ true);
+ grpc_slice_unref_internal(message);
+ json_iterator = status;
}
json_iterator =
grpc_json_create_child(json_iterator, json, "timestamp",