Coalesce GRPC_TRACE=surface with API tracing

pull/3006/head
Masood Malekghassemi 9 years ago
parent fe1093c3a8
commit 7307b1a706
  1. 7
      src/core/surface/call.h
  2. 1
      src/core/surface/init.c
  3. 36
      src/core/surface/surface_trace.c
  4. 5
      src/core/surface/surface_trace.h

@ -36,6 +36,7 @@
#include "src/core/channel/channel_stack.h" #include "src/core/channel/channel_stack.h"
#include "src/core/channel/context.h" #include "src/core/channel/context.h"
#include "src/core/surface/api_trace.h"
#include "src/core/surface/surface_trace.h" #include "src/core/surface/surface_trace.h"
#include <grpc/grpc.h> #include <grpc/grpc.h>
@ -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); void *grpc_call_context_get(grpc_call *call, grpc_context_index elem);
#define GRPC_CALL_LOG_BATCH(sev, call, ops, nops, tag) \ #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, \ #define GRPC_SERVER_LOG_REQUEST_CALL(sev, server, call, details, \
initial_metadata, cq_bound_to_call, \ initial_metadata, cq_bound_to_call, \
cq_for_notifications, tag) \ cq_for_notifications, tag) \
if (grpc_surface_trace) \ if (grpc_api_trace) \
grpc_server_log_request_call(sev, server, call, details, initial_metadata, \ grpc_server_log_request_call(sev, server, call, details, initial_metadata, \
cq_bound_to_call, cq_for_notifications, tag) cq_bound_to_call, cq_for_notifications, tag)
#define GRPC_SERVER_LOG_SHUTDOWN(sev, server, cq, 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); gpr_uint8 grpc_call_is_client(grpc_call *call);

@ -103,7 +103,6 @@ void grpc_init(void) {
#endif #endif
grpc_register_tracer("api", &grpc_api_trace); grpc_register_tracer("api", &grpc_api_trace);
grpc_register_tracer("channel", &grpc_trace_channel); grpc_register_tracer("channel", &grpc_trace_channel);
grpc_register_tracer("surface", &grpc_surface_trace);
grpc_register_tracer("http", &grpc_http_trace); grpc_register_tracer("http", &grpc_http_trace);
grpc_register_tracer("flowctl", &grpc_flowctl_trace); grpc_register_tracer("flowctl", &grpc_flowctl_trace);
grpc_register_tracer("connectivity_state", &grpc_connectivity_state_trace); grpc_register_tracer("connectivity_state", &grpc_connectivity_state_trace);

@ -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;

@ -35,12 +35,11 @@
#define GRPC_INTERNAL_CORE_SURFACE_SURFACE_TRACE_H #define GRPC_INTERNAL_CORE_SURFACE_SURFACE_TRACE_H
#include "src/core/debug/trace.h" #include "src/core/debug/trace.h"
#include "src/core/surface/api_trace.h"
#include <grpc/support/log.h> #include <grpc/support/log.h>
extern int grpc_surface_trace;
#define GRPC_SURFACE_TRACE_RETURNED_EVENT(cq, event) \ #define GRPC_SURFACE_TRACE_RETURNED_EVENT(cq, event) \
if (grpc_surface_trace) { \ if (grpc_api_trace) { \
char *_ev = grpc_event_string(event); \ char *_ev = grpc_event_string(event); \
gpr_log(GPR_INFO, "RETURN_EVENT[%p]: %s", cq, _ev); \ gpr_log(GPR_INFO, "RETURN_EVENT[%p]: %s", cq, _ev); \
gpr_free(_ev); \ gpr_free(_ev); \

Loading…
Cancel
Save