aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/census
diff options
context:
space:
mode:
authorGravatar Alistair Veitch <aveitch@google.com>2015-07-26 16:51:23 -0700
committerGravatar Alistair Veitch <aveitch@google.com>2015-07-26 16:51:23 -0700
commit925e4a634978ec0e8cd43fe2352a2c6240953f82 (patch)
treecdfc61deea867fb89d167a1206b76d57ab6607a2 /src/core/census
parent5c575dd6e4b01cd68cca5d1917b58023dcf4ca0f (diff)
Enrich census initialization and feature code
Diffstat (limited to 'src/core/census')
-rw-r--r--src/core/census/grpc_context.c2
-rw-r--r--src/core/census/initialize.c19
2 files changed, 13 insertions, 8 deletions
diff --git a/src/core/census/grpc_context.c b/src/core/census/grpc_context.c
index 0ed63469b6..d4243cb246 100644
--- a/src/core/census/grpc_context.c
+++ b/src/core/census/grpc_context.c
@@ -39,7 +39,7 @@ static void grpc_census_context_destroy(void *context) {
}
void grpc_census_call_set_context(grpc_call *call, census_context *context) {
- if (!census_available()) {
+ if (census_enabled() == CENSUS_FEATURE_NONE) {
return;
}
if (context == NULL) {
diff --git a/src/core/census/initialize.c b/src/core/census/initialize.c
index 8016520641..8d60f790eb 100644
--- a/src/core/census/initialize.c
+++ b/src/core/census/initialize.c
@@ -33,20 +33,25 @@
#include <grpc/census.h>
-static int census_fns_enabled = CENSUS_NONE;
+static int features_enabled = CENSUS_FEATURE_NONE;
-int census_initialize(int functions) {
- if (census_fns_enabled != CENSUS_NONE) {
+int census_initialize(int features) {
+ if (features_enabled != CENSUS_FEATURE_NONE) {
return 1;
}
- if (functions != CENSUS_NONE) {
+ if (features != CENSUS_FEATURE_NONE) {
return 1;
} else {
- census_fns_enabled = functions;
+ features_enabled = features;
return 0;
}
}
-void census_shutdown() { census_fns_enabled = CENSUS_NONE; }
+void census_shutdown(void) { features_enabled = CENSUS_FEATURE_NONE; }
-int census_available() { return (census_fns_enabled != CENSUS_NONE); }
+int census_supported(void) {
+ /* TODO(aveitch): improve this as we implement features... */
+ return CENSUS_FEATURE_NONE;
+}
+
+int census_enabled(void) { return features_enabled; }