Merge pull request #11727 from ncteisen/the-tracers-become-self-aware

The Tracers Become Self Aware
pull/11798/merge
Noah Eisen 8 years ago committed by GitHub
commit 4ea19235d7
  1. 7
      doc/environment_variables.md
  2. 3
      src/core/ext/filters/client_channel/client_channel.c
  3. 4
      src/core/ext/filters/client_channel/client_channel_plugin.c
  4. 3
      src/core/ext/filters/client_channel/lb_policy.c
  5. 6
      src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.c
  6. 5
      src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.c
  7. 5
      src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.c
  8. 3
      src/core/ext/filters/client_channel/resolver.c
  9. 2
      src/core/ext/filters/http/http_filters_plugin.c
  10. 6
      src/core/ext/transport/chttp2/transport/chttp2_plugin.c
  11. 7
      src/core/ext/transport/chttp2/transport/chttp2_transport.c
  12. 2
      src/core/lib/channel/channel_stack.c
  13. 2
      src/core/lib/channel/channel_stack_builder.c
  14. 22
      src/core/lib/debug/trace.c
  15. 11
      src/core/lib/debug/trace.h
  16. 2
      src/core/lib/http/parser.c
  17. 2
      src/core/lib/iomgr/closure.c
  18. 3
      src/core/lib/iomgr/combiner.c
  19. 3
      src/core/lib/iomgr/error.c
  20. 7
      src/core/lib/iomgr/ev_posix.c
  21. 2
      src/core/lib/iomgr/ev_windows.c
  22. 2
      src/core/lib/iomgr/iomgr_posix.c
  23. 2
      src/core/lib/iomgr/iomgr_uv.c
  24. 3
      src/core/lib/iomgr/pollset_uv.c
  25. 3
      src/core/lib/iomgr/pollset_windows.c
  26. 3
      src/core/lib/iomgr/resource_quota.c
  27. 2
      src/core/lib/iomgr/tcp_posix.c
  28. 2
      src/core/lib/iomgr/tcp_uv.c
  29. 2
      src/core/lib/iomgr/tcp_windows.c
  30. 9
      src/core/lib/iomgr/timer_generic.c
  31. 5
      src/core/lib/iomgr/timer_uv.c
  32. 2
      src/core/lib/security/context/security_context.c
  33. 3
      src/core/lib/security/transport/secure_endpoint.c
  34. 2
      src/core/lib/security/transport/security_connector.c
  35. 2
      src/core/lib/surface/api_trace.c
  36. 6
      src/core/lib/surface/call.c
  37. 15
      src/core/lib/surface/completion_queue.c
  38. 42
      src/core/lib/surface/init.c
  39. 10
      src/core/lib/surface/init_secure.c
  40. 3
      src/core/lib/surface/server.c
  41. 3
      src/core/lib/transport/bdp_estimator.c
  42. 3
      src/core/lib/transport/connectivity_state.c
  43. 3
      src/core/lib/transport/metadata.c
  44. 3
      src/core/lib/transport/transport.c
  45. 2
      src/core/tsi/transport_security.c

@ -54,12 +54,14 @@ some configuration as environment variables that can be set.
- op_failure - traces error information when failure is pushed onto a
completion queue
- round_robin - traces the round_robin load balancing policy
- resource_quota - trace resource quota objects internals
- glb - traces the grpclb load balancer
- queue_pluck
- queue_timeout
- server_channel - lightweight trace of significant server channel events
- secure_endpoint - traces bytes flowing through encrypted channels
- timer - timers (alarms) in the grpc internals
- timer_check - more detailed trace of timer logic in grpc internals
- transport_security - traces metadata about secure channel establishment
- tcp - traces bytes in and out of a channel
@ -83,6 +85,11 @@ some configuration as environment variables that can be set.
'all' can additionally be used to turn all traces on.
Individual traces can be disabled by prefixing them with '-'.
'refcount' will turn on all of the tracers for refcount debugging.
if 'list_tracers' is present, then all of the available tracers will be
printed when the program starts up.
Example:
export GRPC_TRACE=all,-pending_tags

@ -52,7 +52,8 @@
/* Client channel implementation */
grpc_tracer_flag grpc_client_channel_trace = GRPC_TRACER_INITIALIZER(false);
grpc_tracer_flag grpc_client_channel_trace =
GRPC_TRACER_INITIALIZER(false, "client_channel");
/*************************************************************************
* METHOD-CONFIG TABLE

@ -78,9 +78,9 @@ void grpc_client_channel_init(void) {
GRPC_CLIENT_CHANNEL, GRPC_CHANNEL_INIT_BUILTIN_PRIORITY, append_filter,
(void *)&grpc_client_channel_filter);
grpc_http_connect_register_handshaker_factory();
grpc_register_tracer("client_channel", &grpc_client_channel_trace);
grpc_register_tracer(&grpc_client_channel_trace);
#ifndef NDEBUG
grpc_register_tracer("resolver_refcount", &grpc_trace_resolver_refcount);
grpc_register_tracer(&grpc_trace_resolver_refcount);
#endif
}

@ -22,7 +22,8 @@
#define WEAK_REF_BITS 16
#ifndef NDEBUG
grpc_tracer_flag grpc_trace_lb_policy_refcount = GRPC_TRACER_INITIALIZER(false);
grpc_tracer_flag grpc_trace_lb_policy_refcount =
GRPC_TRACER_INITIALIZER(false, "lb_policy_refcount");
#endif
void grpc_lb_policy_init(grpc_lb_policy *policy,

@ -123,7 +123,7 @@
#define GRPC_GRPCLB_RECONNECT_MAX_BACKOFF_SECONDS 120
#define GRPC_GRPCLB_RECONNECT_JITTER 0.2
grpc_tracer_flag grpc_lb_glb_trace = GRPC_TRACER_INITIALIZER(false);
grpc_tracer_flag grpc_lb_glb_trace = GRPC_TRACER_INITIALIZER(false, "glb");
/* add lb_token of selected subchannel (address) to the call's initial
* metadata */
@ -1879,9 +1879,9 @@ static bool maybe_add_client_load_reporting_filter(
void grpc_lb_policy_grpclb_init() {
grpc_register_lb_policy(grpc_glb_lb_factory_create());
grpc_register_tracer("glb", &grpc_lb_glb_trace);
grpc_register_tracer(&grpc_lb_glb_trace);
#ifndef NDEBUG
grpc_register_tracer("lb_policy_refcount", &grpc_trace_lb_policy_refcount);
grpc_register_tracer(&grpc_trace_lb_policy_refcount);
#endif
grpc_channel_init_register_stage(GRPC_CLIENT_SUBCHANNEL,
GRPC_CHANNEL_INIT_BUILTIN_PRIORITY,

@ -28,7 +28,8 @@
#include "src/core/lib/iomgr/sockaddr_utils.h"
#include "src/core/lib/transport/connectivity_state.h"
grpc_tracer_flag grpc_lb_pick_first_trace = GRPC_TRACER_INITIALIZER(false);
grpc_tracer_flag grpc_lb_pick_first_trace =
GRPC_TRACER_INITIALIZER(false, "pick_first");
typedef struct pending_pick {
struct pending_pick *next;
@ -707,7 +708,7 @@ static grpc_lb_policy_factory *pick_first_lb_factory_create() {
void grpc_lb_policy_pick_first_init() {
grpc_register_lb_policy(pick_first_lb_factory_create());
grpc_register_tracer("pick_first", &grpc_lb_pick_first_trace);
grpc_register_tracer(&grpc_lb_pick_first_trace);
}
void grpc_lb_policy_pick_first_shutdown() {}

@ -37,7 +37,8 @@
#include "src/core/lib/transport/connectivity_state.h"
#include "src/core/lib/transport/static_metadata.h"
grpc_tracer_flag grpc_lb_round_robin_trace = GRPC_TRACER_INITIALIZER(false);
grpc_tracer_flag grpc_lb_round_robin_trace =
GRPC_TRACER_INITIALIZER(false, "round_robin");
/** List of entities waiting for a pick.
*
@ -868,7 +869,7 @@ static grpc_lb_policy_factory *round_robin_lb_factory_create() {
void grpc_lb_policy_round_robin_init() {
grpc_register_lb_policy(round_robin_lb_factory_create());
grpc_register_tracer("round_robin", &grpc_lb_round_robin_trace);
grpc_register_tracer(&grpc_lb_round_robin_trace);
}
void grpc_lb_policy_round_robin_shutdown() {}

@ -20,7 +20,8 @@
#include "src/core/lib/iomgr/combiner.h"
#ifndef NDEBUG
grpc_tracer_flag grpc_trace_resolver_refcount = GRPC_TRACER_INITIALIZER(false);
grpc_tracer_flag grpc_trace_resolver_refcount =
GRPC_TRACER_INITIALIZER(false, "resolver_refcount");
#endif
void grpc_resolver_init(grpc_resolver *resolver,

@ -65,7 +65,7 @@ static bool maybe_add_required_filter(grpc_exec_ctx *exec_ctx,
}
void grpc_http_filters_init(void) {
grpc_register_tracer("compression", &grpc_compression_trace);
grpc_register_tracer(&grpc_compression_trace);
grpc_channel_init_register_stage(GRPC_CLIENT_SUBCHANNEL,
GRPC_CHANNEL_INIT_BUILTIN_PRIORITY,
maybe_add_optional_filter, &compress_filter);

@ -21,10 +21,10 @@
#include "src/core/lib/transport/metadata.h"
void grpc_chttp2_plugin_init(void) {
grpc_register_tracer("http", &grpc_http_trace);
grpc_register_tracer("flowctl", &grpc_flowctl_trace);
grpc_register_tracer(&grpc_http_trace);
grpc_register_tracer(&grpc_flowctl_trace);
#ifndef NDEBUG
grpc_register_tracer("chttp2_refcount", &grpc_trace_chttp2_refcount);
grpc_register_tracer(&grpc_trace_chttp2_refcount);
#endif
}

@ -74,11 +74,12 @@ static bool g_default_keepalive_permit_without_calls =
DEFAULT_KEEPALIVE_PERMIT_WITHOUT_CALLS;
#define MAX_CLIENT_STREAM_ID 0x7fffffffu
grpc_tracer_flag grpc_http_trace = GRPC_TRACER_INITIALIZER(false);
grpc_tracer_flag grpc_flowctl_trace = GRPC_TRACER_INITIALIZER(false);
grpc_tracer_flag grpc_http_trace = GRPC_TRACER_INITIALIZER(false, "http");
grpc_tracer_flag grpc_flowctl_trace = GRPC_TRACER_INITIALIZER(false, "flowctl");
#ifndef NDEBUG
grpc_tracer_flag grpc_trace_chttp2_refcount = GRPC_TRACER_INITIALIZER(false);
grpc_tracer_flag grpc_trace_chttp2_refcount =
GRPC_TRACER_INITIALIZER(false, "chttp2_refcount");
#endif
static const grpc_transport_vtable vtable;

@ -23,7 +23,7 @@
#include <stdlib.h>
#include <string.h>
grpc_tracer_flag grpc_trace_channel = GRPC_TRACER_INITIALIZER(false);
grpc_tracer_flag grpc_trace_channel = GRPC_TRACER_INITIALIZER(false, "channel");
/* Memory layouts.

@ -24,7 +24,7 @@
#include <grpc/support/string_util.h>
grpc_tracer_flag grpc_trace_channel_stack_builder =
GRPC_TRACER_INITIALIZER(false);
GRPC_TRACER_INITIALIZER(false, "channel_stack_builder");
typedef struct filter_node {
struct filter_node *next;

@ -27,7 +27,6 @@
int grpc_tracer_set_enabled(const char *name, int enabled);
typedef struct tracer {
const char *name;
grpc_tracer_flag *flag;
struct tracer *next;
} tracer;
@ -39,9 +38,8 @@ static tracer *tracers;
#define TRACER_SET(flag, on) (flag).value = (on)
#endif
void grpc_register_tracer(const char *name, grpc_tracer_flag *flag) {
void grpc_register_tracer(grpc_tracer_flag *flag) {
tracer *t = gpr_malloc(sizeof(*t));
t->name = name;
t->flag = flag;
t->next = tracers;
TRACER_SET(*flag, false);
@ -93,6 +91,14 @@ static void parse(const char *s) {
gpr_free(strings);
}
static void list_tracers() {
gpr_log(GPR_DEBUG, "available tracers:");
tracer *t;
for (t = tracers; t; t = t->next) {
gpr_log(GPR_DEBUG, "\t%s", t->flag->name);
}
}
void grpc_tracer_init(const char *env_var) {
char *e = gpr_getenv(env_var);
if (e != NULL) {
@ -115,10 +121,18 @@ int grpc_tracer_set_enabled(const char *name, int enabled) {
for (t = tracers; t; t = t->next) {
TRACER_SET(*t->flag, enabled);
}
} else if (0 == strcmp(name, "list_tracers")) {
list_tracers();
} else if (0 == strcmp(name, "refcount")) {
for (t = tracers; t; t = t->next) {
if (strstr(t->flag->name, "refcount") != NULL) {
TRACER_SET(*t->flag, enabled);
}
}
} else {
int found = 0;
for (t = tracers; t; t = t->next) {
if (0 == strcmp(name, t->name)) {
if (0 == strcmp(name, t->flag->name)) {
TRACER_SET(*t->flag, enabled);
found = 1;
}

@ -35,19 +35,20 @@ typedef struct {
#else
bool value;
#endif
char *name;
} grpc_tracer_flag;
#ifdef GRPC_THREADSAFE_TRACER
#define GRPC_TRACER_ON(flag) (gpr_atm_no_barrier_load(&(flag).value) != 0)
#define GRPC_TRACER_INITIALIZER(on) \
{ (gpr_atm)(on) }
#define GRPC_TRACER_INITIALIZER(on, name) \
{ (gpr_atm)(on), (name) }
#else
#define GRPC_TRACER_ON(flag) ((flag).value)
#define GRPC_TRACER_INITIALIZER(on) \
{ (on) }
#define GRPC_TRACER_INITIALIZER(on, name) \
{ (on), (name) }
#endif
void grpc_register_tracer(const char *name, grpc_tracer_flag *flag);
void grpc_register_tracer(grpc_tracer_flag *flag);
void grpc_tracer_init(const char *env_var_name);
void grpc_tracer_shutdown(void);

@ -25,7 +25,7 @@
#include <grpc/support/log.h>
#include <grpc/support/useful.h>
grpc_tracer_flag grpc_http1_trace = GRPC_TRACER_INITIALIZER(false);
grpc_tracer_flag grpc_http1_trace = GRPC_TRACER_INITIALIZER(false, "http1");
static char *buf2str(void *buffer, size_t length) {
char *out = gpr_malloc(length + 1);

@ -25,7 +25,7 @@
#include "src/core/lib/profiling/timers.h"
#ifndef NDEBUG
grpc_tracer_flag grpc_trace_closure = GRPC_TRACER_INITIALIZER(false);
grpc_tracer_flag grpc_trace_closure = GRPC_TRACER_INITIALIZER(false, "closure");
#endif
#ifndef NDEBUG

@ -27,7 +27,8 @@
#include "src/core/lib/iomgr/executor.h"
#include "src/core/lib/profiling/timers.h"
grpc_tracer_flag grpc_combiner_trace = GRPC_TRACER_INITIALIZER(false);
grpc_tracer_flag grpc_combiner_trace =
GRPC_TRACER_INITIALIZER(false, "combiner");
#define GRPC_COMBINER_TRACE(fn) \
do { \

@ -36,7 +36,8 @@
#include "src/core/lib/slice/slice_internal.h"
#ifndef NDEBUG
grpc_tracer_flag grpc_trace_error_refcount = GRPC_TRACER_INITIALIZER(false);
grpc_tracer_flag grpc_trace_error_refcount =
GRPC_TRACER_INITIALIZER(false, "error_refcount");
#endif
static const char *error_int_name(grpc_error_ints key) {

@ -39,10 +39,11 @@
#include "src/core/lib/support/env.h"
grpc_tracer_flag grpc_polling_trace =
GRPC_TRACER_INITIALIZER(false); /* Disabled by default */
GRPC_TRACER_INITIALIZER(false, "polling"); /* Disabled by default */
#ifndef NDEBUG
grpc_tracer_flag grpc_trace_fd_refcount = GRPC_TRACER_INITIALIZER(false);
grpc_tracer_flag grpc_trace_fd_refcount =
GRPC_TRACER_INITIALIZER(false, "fd_refcount");
#endif
/** Default poll() function - a pointer so that it can be overridden by some
@ -124,7 +125,7 @@ void grpc_set_event_engine_test_only(
const char *grpc_get_poll_strategy_name() { return g_poll_strategy_name; }
void grpc_event_engine_init(void) {
grpc_register_tracer("polling", &grpc_polling_trace);
grpc_register_tracer(&grpc_polling_trace);
char *s = gpr_getenv("GRPC_POLL_STRATEGY");
if (s == NULL) {

@ -23,6 +23,6 @@
#include "src/core/lib/debug/trace.h"
grpc_tracer_flag grpc_polling_trace =
GRPC_TRACER_INITIALIZER(false); /* Disabled by default */
GRPC_TRACER_INITIALIZER(false, "polling"); /* Disabled by default */
#endif // GRPC_WINSOCK_SOCKET

@ -28,7 +28,7 @@
void grpc_iomgr_platform_init(void) {
grpc_wakeup_fd_global_init();
grpc_event_engine_init();
grpc_register_tracer("tcp", &grpc_tcp_trace);
grpc_register_tracer(&grpc_tcp_trace);
}
void grpc_iomgr_platform_flush(void) {}

@ -26,7 +26,7 @@
void grpc_iomgr_platform_init(void) {
grpc_pollset_global_init();
grpc_register_tracer("tcp", &grpc_tcp_trace);
grpc_register_tracer(&grpc_tcp_trace);
}
void grpc_iomgr_platform_flush(void) {}
void grpc_iomgr_platform_shutdown(void) { grpc_pollset_global_shutdown(); }

@ -34,7 +34,8 @@
#include "src/core/lib/debug/trace.h"
#ifndef NDEBUG
grpc_tracer_flag grpc_trace_fd_refcount = GRPC_TRACER_INITIALIZER(false);
grpc_tracer_flag grpc_trace_fd_refcount =
GRPC_TRACER_INITIALIZER(false, "fd_refcount");
#endif
struct grpc_pollset {

@ -31,7 +31,8 @@
#define GRPC_POLLSET_KICK_BROADCAST ((grpc_pollset_worker *)1)
#ifndef NDEBUG
grpc_tracer_flag grpc_trace_fd_refcount = GRPC_TRACER_INITIALIZER(false);
grpc_tracer_flag grpc_trace_fd_refcount =
GRPC_TRACER_INITIALIZER(false, "fd_refcount");
#endif
gpr_mu grpc_polling_mu;

@ -29,7 +29,8 @@
#include "src/core/lib/iomgr/combiner.h"
grpc_tracer_flag grpc_resource_quota_trace = GRPC_TRACER_INITIALIZER(false);
grpc_tracer_flag grpc_resource_quota_trace =
GRPC_TRACER_INITIALIZER(false, "resource_quota");
#define MEMORY_USAGE_ESTIMATION_MAX 65536

@ -59,7 +59,7 @@ typedef GRPC_MSG_IOVLEN_TYPE msg_iovlen_type;
typedef size_t msg_iovlen_type;
#endif
grpc_tracer_flag grpc_tcp_trace = GRPC_TRACER_INITIALIZER(false);
grpc_tracer_flag grpc_tcp_trace = GRPC_TRACER_INITIALIZER(false, "tcp");
typedef struct {
grpc_endpoint base;

@ -37,7 +37,7 @@
#include "src/core/lib/slice/slice_string_helpers.h"
#include "src/core/lib/support/string.h"
grpc_tracer_flag grpc_tcp_trace = GRPC_TRACER_INITIALIZER(false);
grpc_tracer_flag grpc_tcp_trace = GRPC_TRACER_INITIALIZER(false, "tcp");
typedef struct {
grpc_endpoint base;

@ -48,7 +48,7 @@
#define GRPC_FIONBIO FIONBIO
#endif
grpc_tracer_flag grpc_tcp_trace = GRPC_TRACER_INITIALIZER(false);
grpc_tracer_flag grpc_tcp_trace = GRPC_TRACER_INITIALIZER(false, "tcp");
static grpc_error *set_non_block(SOCKET sock) {
int status;

@ -41,8 +41,9 @@
#define MIN_QUEUE_WINDOW_DURATION 0.01
#define MAX_QUEUE_WINDOW_DURATION 1
grpc_tracer_flag grpc_timer_trace = GRPC_TRACER_INITIALIZER(false);
grpc_tracer_flag grpc_timer_check_trace = GRPC_TRACER_INITIALIZER(false);
grpc_tracer_flag grpc_timer_trace = GRPC_TRACER_INITIALIZER(false, "timer");
grpc_tracer_flag grpc_timer_check_trace =
GRPC_TRACER_INITIALIZER(false, "timer_check");
/* A "timer shard". Contains a 'heap' and a 'list' of timers. All timers with
* deadlines earlier than 'queue_deadline" cap are maintained in the heap and
@ -160,8 +161,8 @@ void grpc_timer_list_init(gpr_timespec now) {
g_shared_mutables.min_timer = timespec_to_atm_round_down(now);
gpr_tls_init(&g_last_seen_min_timer);
gpr_tls_set(&g_last_seen_min_timer, 0);
grpc_register_tracer("timer", &grpc_timer_trace);
grpc_register_tracer("timer_check", &grpc_timer_check_trace);
grpc_register_tracer(&grpc_timer_trace);
grpc_register_tracer(&grpc_timer_check_trace);
for (i = 0; i < NUM_SHARDS; i++) {
timer_shard *shard = &g_shards[i];

@ -28,8 +28,9 @@
#include <uv.h>
grpc_tracer_flag grpc_timer_trace = GRPC_TRACER_INITIALIZER(false);
grpc_tracer_flag grpc_timer_check_trace = GRPC_TRACER_INITIALIZER(false);
grpc_tracer_flag grpc_timer_trace = GRPC_TRACER_INITIALIZER(false, "timer");
grpc_tracer_flag grpc_timer_check_trace =
GRPC_TRACER_INITIALIZER(false, "timer_check");
static void timer_close_callback(uv_handle_t *handle) { gpr_free(handle); }

@ -31,7 +31,7 @@
#ifndef NDEBUG
grpc_tracer_flag grpc_trace_auth_context_refcount =
GRPC_TRACER_INITIALIZER(false);
GRPC_TRACER_INITIALIZER(false, "auth_context_refcount");
#endif
/* --- grpc_call --- */

@ -60,7 +60,8 @@ typedef struct {
gpr_refcount ref;
} secure_endpoint;
grpc_tracer_flag grpc_trace_secure_endpoint = GRPC_TRACER_INITIALIZER(false);
grpc_tracer_flag grpc_trace_secure_endpoint =
GRPC_TRACER_INITIALIZER(false, "secure_endpoint");
static void destroy(grpc_exec_ctx *exec_ctx, secure_endpoint *secure_ep) {
secure_endpoint *ep = secure_ep;

@ -45,7 +45,7 @@
#ifndef NDEBUG
grpc_tracer_flag grpc_trace_security_connector_refcount =
GRPC_TRACER_INITIALIZER(false);
GRPC_TRACER_INITIALIZER(false, "security_connector_refcount");
#endif
/* -- Constants. -- */

@ -19,4 +19,4 @@
#include "src/core/lib/surface/api_trace.h"
#include "src/core/lib/debug/trace.h"
grpc_tracer_flag grpc_api_trace = GRPC_TRACER_INITIALIZER(false);
grpc_tracer_flag grpc_api_trace = GRPC_TRACER_INITIALIZER(false, "api");

@ -229,8 +229,10 @@ struct grpc_call {
void *saved_receiving_stream_ready_bctlp;
};
grpc_tracer_flag grpc_call_error_trace = GRPC_TRACER_INITIALIZER(false);
grpc_tracer_flag grpc_compression_trace = GRPC_TRACER_INITIALIZER(false);
grpc_tracer_flag grpc_call_error_trace =
GRPC_TRACER_INITIALIZER(false, "call_error");
grpc_tracer_flag grpc_compression_trace =
GRPC_TRACER_INITIALIZER(false, "compression");
#define CALL_STACK_FROM_CALL(call) ((grpc_call_stack *)((call) + 1))
#define CALL_FROM_CALL_STACK(call_stack) (((grpc_call *)(call_stack)) - 1)

@ -35,10 +35,13 @@
#include "src/core/lib/surface/call.h"
#include "src/core/lib/surface/event_string.h"
grpc_tracer_flag grpc_trace_operation_failures = GRPC_TRACER_INITIALIZER(false);
grpc_tracer_flag grpc_trace_operation_failures =
GRPC_TRACER_INITIALIZER(false, "op_failure");
#ifndef NDEBUG
grpc_tracer_flag grpc_trace_pending_tags = GRPC_TRACER_INITIALIZER(false);
grpc_tracer_flag grpc_trace_cq_refcount = GRPC_TRACER_INITIALIZER(false);
grpc_tracer_flag grpc_trace_pending_tags =
GRPC_TRACER_INITIALIZER(false, "pending_tags");
grpc_tracer_flag grpc_trace_cq_refcount =
GRPC_TRACER_INITIALIZER(false, "cq_refcount");
#endif
typedef struct {
@ -343,8 +346,10 @@ static const cq_vtable g_cq_vtable[] = {
#define POLLSET_FROM_CQ(cq) \
((grpc_pollset *)(cq->vtable->data_size + (char *)DATA_FROM_CQ(cq)))
grpc_tracer_flag grpc_cq_pluck_trace = GRPC_TRACER_INITIALIZER(true);
grpc_tracer_flag grpc_cq_event_timeout_trace = GRPC_TRACER_INITIALIZER(true);
grpc_tracer_flag grpc_cq_pluck_trace =
GRPC_TRACER_INITIALIZER(true, "queue_pluck");
grpc_tracer_flag grpc_cq_event_timeout_trace =
GRPC_TRACER_INITIALIZER(true, "queue_timeout");
#define GRPC_SURFACE_TRACE_RETURNED_EVENT(cq, event) \
if (GRPC_TRACER_ON(grpc_api_trace) && \

@ -120,29 +120,27 @@ void grpc_init(void) {
grpc_slice_intern_init();
grpc_mdctx_global_init();
grpc_channel_init_init();
grpc_register_tracer("api", &grpc_api_trace);
grpc_register_tracer("channel", &grpc_trace_channel);
grpc_register_tracer("connectivity_state", &grpc_connectivity_state_trace);
grpc_register_tracer("channel_stack_builder",
&grpc_trace_channel_stack_builder);
grpc_register_tracer("http1", &grpc_http1_trace);
grpc_register_tracer("queue_pluck", &grpc_cq_pluck_trace); // default on
grpc_register_tracer("combiner", &grpc_combiner_trace);
grpc_register_tracer("server_channel", &grpc_server_channel_trace);
grpc_register_tracer("bdp_estimator", &grpc_bdp_estimator_trace);
grpc_register_tracer("queue_timeout",
&grpc_cq_event_timeout_trace); // default on
grpc_register_tracer("op_failure", &grpc_trace_operation_failures);
grpc_register_tracer("resource_quota", &grpc_resource_quota_trace);
grpc_register_tracer("call_error", &grpc_call_error_trace);
grpc_register_tracer(&grpc_api_trace);
grpc_register_tracer(&grpc_trace_channel);
grpc_register_tracer(&grpc_connectivity_state_trace);
grpc_register_tracer(&grpc_trace_channel_stack_builder);
grpc_register_tracer(&grpc_http1_trace);
grpc_register_tracer(&grpc_cq_pluck_trace); // default on
grpc_register_tracer(&grpc_combiner_trace);
grpc_register_tracer(&grpc_server_channel_trace);
grpc_register_tracer(&grpc_bdp_estimator_trace);
grpc_register_tracer(&grpc_cq_event_timeout_trace); // default on
grpc_register_tracer(&grpc_trace_operation_failures);
grpc_register_tracer(&grpc_resource_quota_trace);
grpc_register_tracer(&grpc_call_error_trace);
#ifndef NDEBUG
grpc_register_tracer("pending_tags", &grpc_trace_pending_tags);
grpc_register_tracer("queue_refcount", &grpc_trace_cq_refcount);
grpc_register_tracer("closure", &grpc_trace_closure);
grpc_register_tracer("error_refcount", &grpc_trace_error_refcount);
grpc_register_tracer("stream_refcount", &grpc_trace_stream_refcount);
grpc_register_tracer("fd_refcount", &grpc_trace_fd_refcount);
grpc_register_tracer("metadata", &grpc_trace_metadata);
grpc_register_tracer(&grpc_trace_pending_tags);
grpc_register_tracer(&grpc_trace_cq_refcount);
grpc_register_tracer(&grpc_trace_closure);
grpc_register_tracer(&grpc_trace_error_refcount);
grpc_register_tracer(&grpc_trace_stream_refcount);
grpc_register_tracer(&grpc_trace_fd_refcount);
grpc_register_tracer(&grpc_trace_metadata);
#endif
grpc_security_pre_init();
grpc_iomgr_init(&exec_ctx);

@ -37,13 +37,11 @@
#endif
void grpc_security_pre_init(void) {
grpc_register_tracer("secure_endpoint", &grpc_trace_secure_endpoint);
grpc_register_tracer("transport_security", &tsi_tracing_enabled);
grpc_register_tracer(&grpc_trace_secure_endpoint);
grpc_register_tracer(&tsi_tracing_enabled);
#ifndef NDEBUG
grpc_register_tracer("auth_context_refcount",
&grpc_trace_auth_context_refcount);
grpc_register_tracer("security_connector_refcount",
&grpc_trace_security_connector_refcount);
grpc_register_tracer(&grpc_trace_auth_context_refcount);
grpc_register_tracer(&grpc_trace_security_connector_refcount);
#endif
}

@ -58,7 +58,8 @@ typedef struct registered_method registered_method;
typedef enum { BATCH_CALL, REGISTERED_CALL } requested_call_type;
grpc_tracer_flag grpc_server_channel_trace = GRPC_TRACER_INITIALIZER(false);
grpc_tracer_flag grpc_server_channel_trace =
GRPC_TRACER_INITIALIZER(false, "server_channel");
typedef struct requested_call {
requested_call_type type;

@ -23,7 +23,8 @@
#include <grpc/support/log.h>
#include <grpc/support/useful.h>
grpc_tracer_flag grpc_bdp_estimator_trace = GRPC_TRACER_INITIALIZER(false);
grpc_tracer_flag grpc_bdp_estimator_trace =
GRPC_TRACER_INITIALIZER(false, "bdp_estimator");
void grpc_bdp_estimator_init(grpc_bdp_estimator *estimator, const char *name) {
estimator->estimate = 65536;

@ -24,7 +24,8 @@
#include <grpc/support/log.h>
#include <grpc/support/string_util.h>
grpc_tracer_flag grpc_connectivity_state_trace = GRPC_TRACER_INITIALIZER(false);
grpc_tracer_flag grpc_connectivity_state_trace =
GRPC_TRACER_INITIALIZER(false, "connectivity_state");
const char *grpc_connectivity_state_name(grpc_connectivity_state state) {
switch (state) {

@ -48,7 +48,8 @@
*/
#ifndef NDEBUG
grpc_tracer_flag grpc_trace_metadata = GRPC_TRACER_INITIALIZER(false);
grpc_tracer_flag grpc_trace_metadata =
GRPC_TRACER_INITIALIZER(false, "metadata");
#define DEBUG_ARGS , const char *file, int line
#define FWD_DEBUG_ARGS , file, line
#define REF_MD_LOCKED(shard, s) ref_md_locked((shard), (s), __FILE__, __LINE__)

@ -32,7 +32,8 @@
#include "src/core/lib/transport/transport_impl.h"
#ifndef NDEBUG
grpc_tracer_flag grpc_trace_stream_refcount = GRPC_TRACER_INITIALIZER(false);
grpc_tracer_flag grpc_trace_stream_refcount =
GRPC_TRACER_INITIALIZER(false, "stream_refcount");
#endif
#ifndef NDEBUG

@ -26,7 +26,7 @@
/* --- Tracing. --- */
grpc_tracer_flag tsi_tracing_enabled = GRPC_TRACER_INITIALIZER(false);
grpc_tracer_flag tsi_tracing_enabled = GRPC_TRACER_INITIALIZER(false, "tsi");
/* --- tsi_result common implementation. --- */

Loading…
Cancel
Save