aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/lib/security
diff options
context:
space:
mode:
authorGravatar Craig Tiller <ctiller@google.com>2017-10-16 13:50:29 -0700
committerGravatar Craig Tiller <ctiller@google.com>2017-10-16 13:50:29 -0700
commit6014e8a945fa81fad7d0311a8a7cded0c2aaa827 (patch)
tree179de89f5b6bbaf861a6a9c0bcd2e4b5cfb83aca /src/core/lib/security
parent4979ce5f9341ff72c5974bd86e101016438660f0 (diff)
C++ize tracing
Diffstat (limited to 'src/core/lib/security')
-rw-r--r--src/core/lib/security/context/security_context.cc8
-rw-r--r--src/core/lib/security/context/security_context.h2
-rw-r--r--src/core/lib/security/credentials/jwt/jwt_credentials.cc2
-rw-r--r--src/core/lib/security/credentials/oauth2/oauth2_credentials.cc2
-rw-r--r--src/core/lib/security/credentials/plugin/plugin_credentials.cc18
-rw-r--r--src/core/lib/security/credentials/plugin/plugin_credentials.h2
-rw-r--r--src/core/lib/security/transport/secure_endpoint.cc12
-rw-r--r--src/core/lib/security/transport/secure_endpoint.h2
-rw-r--r--src/core/lib/security/transport/security_connector.cc8
-rw-r--r--src/core/lib/security/transport/security_connector.h2
10 files changed, 29 insertions, 29 deletions
diff --git a/src/core/lib/security/context/security_context.cc b/src/core/lib/security/context/security_context.cc
index 31d800b9b4..96bec5a4c7 100644
--- a/src/core/lib/security/context/security_context.cc
+++ b/src/core/lib/security/context/security_context.cc
@@ -30,8 +30,8 @@
#include <grpc/support/string_util.h>
#ifndef NDEBUG
-grpc_tracer_flag grpc_trace_auth_context_refcount =
- GRPC_TRACER_INITIALIZER(false, "auth_context_refcount");
+grpc_core::Tracer grpc_trace_auth_context_refcount
+ (false, "auth_context_refcount");
#endif
/* --- grpc_call --- */
@@ -135,7 +135,7 @@ grpc_auth_context *grpc_auth_context_ref(grpc_auth_context *ctx,
const char *file, int line,
const char *reason) {
if (ctx == NULL) return NULL;
- if (GRPC_TRACER_ON(grpc_trace_auth_context_refcount)) {
+ if (grpc_trace_auth_context_refcount.enabled()) {
gpr_atm val = gpr_atm_no_barrier_load(&ctx->refcount.count);
gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG,
"AUTH_CONTEXT:%p ref %" PRIdPTR " -> %" PRIdPTR " %s", ctx, val,
@@ -153,7 +153,7 @@ grpc_auth_context *grpc_auth_context_ref(grpc_auth_context *ctx) {
void grpc_auth_context_unref(grpc_auth_context *ctx, const char *file, int line,
const char *reason) {
if (ctx == NULL) return;
- if (GRPC_TRACER_ON(grpc_trace_auth_context_refcount)) {
+ if (grpc_trace_auth_context_refcount.enabled()) {
gpr_atm val = gpr_atm_no_barrier_load(&ctx->refcount.count);
gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG,
"AUTH_CONTEXT:%p unref %" PRIdPTR " -> %" PRIdPTR " %s", ctx, val,
diff --git a/src/core/lib/security/context/security_context.h b/src/core/lib/security/context/security_context.h
index 0df39257a7..f8ea0bad12 100644
--- a/src/core/lib/security/context/security_context.h
+++ b/src/core/lib/security/context/security_context.h
@@ -23,7 +23,7 @@
#include "src/core/lib/security/credentials/credentials.h"
#ifndef NDEBUG
-extern grpc_tracer_flag grpc_trace_auth_context_refcount;
+extern grpc_core::Tracer grpc_trace_auth_context_refcount;
#endif
#ifdef __cplusplus
diff --git a/src/core/lib/security/credentials/jwt/jwt_credentials.cc b/src/core/lib/security/credentials/jwt/jwt_credentials.cc
index 835dd677ed..82d7ad5d62 100644
--- a/src/core/lib/security/credentials/jwt/jwt_credentials.cc
+++ b/src/core/lib/security/credentials/jwt/jwt_credentials.cc
@@ -172,7 +172,7 @@ static char *redact_private_key(const char *json_key) {
grpc_call_credentials *grpc_service_account_jwt_access_credentials_create(
const char *json_key, gpr_timespec token_lifetime, void *reserved) {
- if (GRPC_TRACER_ON(grpc_api_trace)) {
+ if (grpc_api_trace.enabled()) {
char *clean_json = redact_private_key(json_key);
gpr_log(GPR_INFO,
"grpc_service_account_jwt_access_credentials_create("
diff --git a/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc b/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc
index f52a424e36..8258bd7cd1 100644
--- a/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc
+++ b/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc
@@ -467,7 +467,7 @@ grpc_call_credentials *grpc_google_refresh_token_credentials_create(
const char *json_refresh_token, void *reserved) {
grpc_auth_refresh_token token =
grpc_auth_refresh_token_create_from_string(json_refresh_token);
- if (GRPC_TRACER_ON(grpc_api_trace)) {
+ if (grpc_api_trace.enabled()) {
char *loggable_token = create_loggable_refresh_token(&token);
gpr_log(GPR_INFO,
"grpc_refresh_token_credentials_create(json_refresh_token=%s, "
diff --git a/src/core/lib/security/credentials/plugin/plugin_credentials.cc b/src/core/lib/security/credentials/plugin/plugin_credentials.cc
index 8106a730fe..acff5ae7d2 100644
--- a/src/core/lib/security/credentials/plugin/plugin_credentials.cc
+++ b/src/core/lib/security/credentials/plugin/plugin_credentials.cc
@@ -31,8 +31,8 @@
#include "src/core/lib/surface/api_trace.h"
#include "src/core/lib/surface/validate_metadata.h"
-grpc_tracer_flag grpc_plugin_credentials_trace =
- GRPC_TRACER_INITIALIZER(false, "plugin_credentials");
+grpc_core::Tracer grpc_plugin_credentials_trace
+ (false, "plugin_credentials");
static void plugin_destruct(grpc_exec_ctx *exec_ctx,
grpc_call_credentials *creds) {
@@ -123,7 +123,7 @@ static void plugin_md_request_metadata_ready(void *request,
NULL, NULL);
grpc_plugin_credentials_pending_request *r =
(grpc_plugin_credentials_pending_request *)request;
- if (GRPC_TRACER_ON(grpc_plugin_credentials_trace)) {
+ if (grpc_plugin_credentials_trace.enabled()) {
gpr_log(GPR_INFO,
"plugin_credentials[%p]: request %p: plugin returned "
"asynchronously",
@@ -136,7 +136,7 @@ static void plugin_md_request_metadata_ready(void *request,
grpc_error *error =
process_plugin_result(&exec_ctx, r, md, num_md, status, error_details);
GRPC_CLOSURE_SCHED(&exec_ctx, r->on_request_metadata, error);
- } else if (GRPC_TRACER_ON(grpc_plugin_credentials_trace)) {
+ } else if (grpc_plugin_credentials_trace.enabled()) {
gpr_log(GPR_INFO,
"plugin_credentials[%p]: request %p: plugin was previously "
"cancelled",
@@ -172,7 +172,7 @@ static bool plugin_get_request_metadata(grpc_exec_ctx *exec_ctx,
c->pending_requests = pending_request;
gpr_mu_unlock(&c->mu);
// Invoke the plugin. The callback holds a ref to us.
- if (GRPC_TRACER_ON(grpc_plugin_credentials_trace)) {
+ if (grpc_plugin_credentials_trace.enabled()) {
gpr_log(GPR_INFO, "plugin_credentials[%p]: request %p: invoking plugin",
c, pending_request);
}
@@ -185,7 +185,7 @@ static bool plugin_get_request_metadata(grpc_exec_ctx *exec_ctx,
plugin_md_request_metadata_ready,
pending_request, creds_md, &num_creds_md,
&status, &error_details)) {
- if (GRPC_TRACER_ON(grpc_plugin_credentials_trace)) {
+ if (grpc_plugin_credentials_trace.enabled()) {
gpr_log(GPR_INFO,
"plugin_credentials[%p]: request %p: plugin will return "
"asynchronously",
@@ -200,7 +200,7 @@ static bool plugin_get_request_metadata(grpc_exec_ctx *exec_ctx,
// asynchronously by plugin_cancel_get_request_metadata(), so return
// false. Otherwise, process the result.
if (pending_request->cancelled) {
- if (GRPC_TRACER_ON(grpc_plugin_credentials_trace)) {
+ if (grpc_plugin_credentials_trace.enabled()) {
gpr_log(GPR_INFO,
"plugin_credentials[%p]: request %p was cancelled, error "
"will be returned asynchronously",
@@ -208,7 +208,7 @@ static bool plugin_get_request_metadata(grpc_exec_ctx *exec_ctx,
}
retval = false;
} else {
- if (GRPC_TRACER_ON(grpc_plugin_credentials_trace)) {
+ if (grpc_plugin_credentials_trace.enabled()) {
gpr_log(GPR_INFO,
"plugin_credentials[%p]: request %p: plugin returned "
"synchronously",
@@ -237,7 +237,7 @@ static void plugin_cancel_get_request_metadata(
c->pending_requests;
pending_request != NULL; pending_request = pending_request->next) {
if (pending_request->md_array == md_array) {
- if (GRPC_TRACER_ON(grpc_plugin_credentials_trace)) {
+ if (grpc_plugin_credentials_trace.enabled()) {
gpr_log(GPR_INFO, "plugin_credentials[%p]: cancelling request %p", c,
pending_request);
}
diff --git a/src/core/lib/security/credentials/plugin/plugin_credentials.h b/src/core/lib/security/credentials/plugin/plugin_credentials.h
index f56df9eac5..9c8bc18e27 100644
--- a/src/core/lib/security/credentials/plugin/plugin_credentials.h
+++ b/src/core/lib/security/credentials/plugin/plugin_credentials.h
@@ -21,7 +21,7 @@
#include "src/core/lib/security/credentials/credentials.h"
-extern grpc_tracer_flag grpc_plugin_credentials_trace;
+extern grpc_core::Tracer grpc_plugin_credentials_trace;
struct grpc_plugin_credentials;
diff --git a/src/core/lib/security/transport/secure_endpoint.cc b/src/core/lib/security/transport/secure_endpoint.cc
index ae5633b82c..901675f7a0 100644
--- a/src/core/lib/security/transport/secure_endpoint.cc
+++ b/src/core/lib/security/transport/secure_endpoint.cc
@@ -61,8 +61,8 @@ typedef struct {
gpr_refcount ref;
} secure_endpoint;
-grpc_tracer_flag grpc_trace_secure_endpoint =
- GRPC_TRACER_INITIALIZER(false, "secure_endpoint");
+grpc_core::Tracer grpc_trace_secure_endpoint
+ (false, "secure_endpoint");
static void destroy(grpc_exec_ctx *exec_ctx, secure_endpoint *secure_ep) {
secure_endpoint *ep = secure_ep;
@@ -86,7 +86,7 @@ static void destroy(grpc_exec_ctx *exec_ctx, secure_endpoint *secure_ep) {
static void secure_endpoint_unref(grpc_exec_ctx *exec_ctx, secure_endpoint *ep,
const char *reason, const char *file,
int line) {
- if (GRPC_TRACER_ON(grpc_trace_secure_endpoint)) {
+ if (grpc_trace_secure_endpoint.enabled()) {
gpr_atm val = gpr_atm_no_barrier_load(&ep->ref.count);
gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG,
"SECENDP unref %p : %s %" PRIdPTR " -> %" PRIdPTR, ep, reason, val,
@@ -99,7 +99,7 @@ static void secure_endpoint_unref(grpc_exec_ctx *exec_ctx, secure_endpoint *ep,
static void secure_endpoint_ref(secure_endpoint *ep, const char *reason,
const char *file, int line) {
- if (GRPC_TRACER_ON(grpc_trace_secure_endpoint)) {
+ if (grpc_trace_secure_endpoint.enabled()) {
gpr_atm val = gpr_atm_no_barrier_load(&ep->ref.count);
gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG,
"SECENDP ref %p : %s %" PRIdPTR " -> %" PRIdPTR, ep, reason, val,
@@ -131,7 +131,7 @@ static void flush_read_staging_buffer(secure_endpoint *ep, uint8_t **cur,
static void call_read_cb(grpc_exec_ctx *exec_ctx, secure_endpoint *ep,
grpc_error *error) {
- if (GRPC_TRACER_ON(grpc_trace_secure_endpoint)) {
+ if (grpc_trace_secure_endpoint.enabled()) {
size_t i;
for (i = 0; i < ep->read_buffer->count; i++) {
char *data = grpc_dump_slice(ep->read_buffer->slices[i],
@@ -270,7 +270,7 @@ static void endpoint_write(grpc_exec_ctx *exec_ctx, grpc_endpoint *secure_ep,
grpc_slice_buffer_reset_and_unref_internal(exec_ctx, &ep->output_buffer);
- if (GRPC_TRACER_ON(grpc_trace_secure_endpoint)) {
+ if (grpc_trace_secure_endpoint.enabled()) {
for (i = 0; i < slices->count; i++) {
char *data =
grpc_dump_slice(slices->slices[i], GPR_DUMP_HEX | GPR_DUMP_ASCII);
diff --git a/src/core/lib/security/transport/secure_endpoint.h b/src/core/lib/security/transport/secure_endpoint.h
index 980449c03e..cfa1d49d8f 100644
--- a/src/core/lib/security/transport/secure_endpoint.h
+++ b/src/core/lib/security/transport/secure_endpoint.h
@@ -29,7 +29,7 @@ extern "C" {
struct tsi_frame_protector;
struct tsi_zero_copy_grpc_protector;
-extern grpc_tracer_flag grpc_trace_secure_endpoint;
+extern grpc_core::Tracer grpc_trace_secure_endpoint;
/* Takes ownership of protector, zero_copy_protector, and to_wrap, and refs
* leftover_slices. If zero_copy_protector is not NULL, protector will never be
diff --git a/src/core/lib/security/transport/security_connector.cc b/src/core/lib/security/transport/security_connector.cc
index 51844fb91f..3d205ddefe 100644
--- a/src/core/lib/security/transport/security_connector.cc
+++ b/src/core/lib/security/transport/security_connector.cc
@@ -44,8 +44,8 @@
#include "src/core/tsi/transport_security_adapter.h"
#ifndef NDEBUG
-grpc_tracer_flag grpc_trace_security_connector_refcount =
- GRPC_TRACER_INITIALIZER(false, "security_connector_refcount");
+grpc_core::Tracer grpc_trace_security_connector_refcount
+ (false, "security_connector_refcount");
#endif
/* -- Constants. -- */
@@ -164,7 +164,7 @@ grpc_security_connector *grpc_security_connector_ref(
grpc_security_connector *sc, const char *file, int line,
const char *reason) {
if (sc == NULL) return NULL;
- if (GRPC_TRACER_ON(grpc_trace_security_connector_refcount)) {
+ if (grpc_trace_security_connector_refcount.enabled()) {
gpr_atm val = gpr_atm_no_barrier_load(&sc->refcount.count);
gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG,
"SECURITY_CONNECTOR:%p ref %" PRIdPTR " -> %" PRIdPTR " %s", sc,
@@ -185,7 +185,7 @@ void grpc_security_connector_unref(grpc_exec_ctx *exec_ctx,
const char *file, int line,
const char *reason) {
if (sc == NULL) return;
- if (GRPC_TRACER_ON(grpc_trace_security_connector_refcount)) {
+ if (grpc_trace_security_connector_refcount.enabled()) {
gpr_atm val = gpr_atm_no_barrier_load(&sc->refcount.count);
gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG,
"SECURITY_CONNECTOR:%p unref %" PRIdPTR " -> %" PRIdPTR " %s", sc,
diff --git a/src/core/lib/security/transport/security_connector.h b/src/core/lib/security/transport/security_connector.h
index 4d87cd0c80..e4ee2110eb 100644
--- a/src/core/lib/security/transport/security_connector.h
+++ b/src/core/lib/security/transport/security_connector.h
@@ -34,7 +34,7 @@ extern "C" {
#endif
#ifndef NDEBUG
-extern grpc_tracer_flag grpc_trace_security_connector_refcount;
+extern grpc_core::Tracer grpc_trace_security_connector_refcount;
#endif
/* --- status enum. --- */