From 7307b1a706e40be9e497915d72e6009e8b16d358 Mon Sep 17 00:00:00 2001 From: Masood Malekghassemi Date: Thu, 20 Aug 2015 18:49:53 -0700 Subject: [PATCH] Coalesce GRPC_TRACE=surface with API tracing --- src/core/surface/call.h | 7 ++++--- src/core/surface/init.c | 1 - src/core/surface/surface_trace.c | 36 -------------------------------- src/core/surface/surface_trace.h | 5 ++--- 4 files changed, 6 insertions(+), 43 deletions(-) delete mode 100644 src/core/surface/surface_trace.c diff --git a/src/core/surface/call.h b/src/core/surface/call.h index b1a1045792b..acfedf40cd4 100644 --- a/src/core/surface/call.h +++ b/src/core/surface/call.h @@ -36,6 +36,7 @@ #include "src/core/channel/channel_stack.h" #include "src/core/channel/context.h" +#include "src/core/surface/api_trace.h" #include "src/core/surface/surface_trace.h" #include @@ -154,17 +155,17 @@ void grpc_call_context_set(grpc_call *call, grpc_context_index elem, void *grpc_call_context_get(grpc_call *call, grpc_context_index elem); #define GRPC_CALL_LOG_BATCH(sev, call, ops, nops, tag) \ - if (grpc_surface_trace) grpc_call_log_batch(sev, call, ops, nops, tag) + if (grpc_api_trace) grpc_call_log_batch(sev, call, ops, nops, tag) #define GRPC_SERVER_LOG_REQUEST_CALL(sev, server, call, details, \ initial_metadata, cq_bound_to_call, \ cq_for_notifications, tag) \ - if (grpc_surface_trace) \ + if (grpc_api_trace) \ grpc_server_log_request_call(sev, server, call, details, initial_metadata, \ cq_bound_to_call, cq_for_notifications, tag) #define GRPC_SERVER_LOG_SHUTDOWN(sev, server, cq, tag) \ - if (grpc_surface_trace) grpc_server_log_shutdown(sev, server, cq, tag) + if (grpc_api_trace) grpc_server_log_shutdown(sev, server, cq, tag) gpr_uint8 grpc_call_is_client(grpc_call *call); diff --git a/src/core/surface/init.c b/src/core/surface/init.c index 96ab5ecb60b..95011cab178 100644 --- a/src/core/surface/init.c +++ b/src/core/surface/init.c @@ -103,7 +103,6 @@ void grpc_init(void) { #endif grpc_register_tracer("api", &grpc_api_trace); grpc_register_tracer("channel", &grpc_trace_channel); - grpc_register_tracer("surface", &grpc_surface_trace); grpc_register_tracer("http", &grpc_http_trace); grpc_register_tracer("flowctl", &grpc_flowctl_trace); grpc_register_tracer("connectivity_state", &grpc_connectivity_state_trace); diff --git a/src/core/surface/surface_trace.c b/src/core/surface/surface_trace.c deleted file mode 100644 index 57a0053162a..00000000000 --- a/src/core/surface/surface_trace.c +++ /dev/null @@ -1,36 +0,0 @@ -/* - * - * Copyright 2015, Google Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#include "src/core/surface/surface_trace.h" - -int grpc_surface_trace = 0; diff --git a/src/core/surface/surface_trace.h b/src/core/surface/surface_trace.h index 2b4728e2b4b..51329a49842 100644 --- a/src/core/surface/surface_trace.h +++ b/src/core/surface/surface_trace.h @@ -35,12 +35,11 @@ #define GRPC_INTERNAL_CORE_SURFACE_SURFACE_TRACE_H #include "src/core/debug/trace.h" +#include "src/core/surface/api_trace.h" #include -extern int grpc_surface_trace; - #define GRPC_SURFACE_TRACE_RETURNED_EVENT(cq, event) \ - if (grpc_surface_trace) { \ + if (grpc_api_trace) { \ char *_ev = grpc_event_string(event); \ gpr_log(GPR_INFO, "RETURN_EVENT[%p]: %s", cq, _ev); \ gpr_free(_ev); \