Remove request context enable flag
authorDave Watson <davejwatson@fb.com>
Tue, 27 Jan 2015 21:05:18 +0000 (13:05 -0800)
committerAndrew Cox <andrewcox@fb.com>
Wed, 4 Feb 2015 21:00:06 +0000 (13:00 -0800)
Summary:
Originally meant as a kill switch.  It's turned on in everything except adfinder, so we can probably remove this flag after running a couple adfinder canaries

I have no idea who should review this in ads team, guessed and added some people

Test Plan: https://our.intern.facebook.com/intern/tupperware/canary/view/?experiment_id=32937

Reviewed By: haijunz@fb.com

Subscribers: trunkagent, doug, ruibalp, nli, alandau, bmatheny, wormhole-diffs@, mshneer, folly-diffs@

FB internal diff: D1809255

Tasks: 5645329

Signature: t1:1809255:1422490068:5b4551e6c126d86cac8f8e7b06da6474e6b8a25a

folly/io/async/Request.cpp
folly/io/async/Request.h

index 0f7d2ec361e93000b3f0b9f8a263b93ceea55631..25686d6305598a158b487a35050b00a5317f665e 100644 (file)
  */
 #include <folly/io/async/Request.h>
 
-#ifndef NO_LIB_GFLAGS
-  DEFINE_bool(enable_request_context, true,
-              "Enable collection of per-request queueing stats for thrift");
-#endif
-
 namespace folly {
 
-#ifdef NO_LIB_GFLAGS
-  bool FLAGS_enable_request_context = true;
-#endif
-
 RequestContext* defaultContext;
 
 }
index c02ac5186d023226b97cb9afcfb1d691c58b2921..ffce2ed76c1fe9572639e205b422cdc6a37720c7 100644 (file)
 #include <folly/ThreadLocal.h>
 #include <folly/RWSpinLock.h>
 
-/**
- * In many cases this header is included as a
- * dependency to libraries which do not need
- * command line flags. GFLAGS is a large binary
- * and thus we do this so that a library which
- * is size sensitive doesn't have to pull in
- * GFLAGS if it doesn't want to.
- */
-#ifndef NO_LIB_GFLAGS
-  #include <gflags/gflags.h>
-  DECLARE_bool(enable_request_context);
-#endif
-
 namespace folly {
 
-#ifdef NO_LIB_GFLAGS
-  extern bool FLAGS_enable_request_context;
-#endif
-
 // Some request context that follows an async request through a process
 // Everything in the context must be thread safe
 
@@ -66,9 +49,6 @@ class RequestContext {
   // It will be passed between queues / threads (where implemented),
   // so it should be valid for the lifetime of the request.
   static void create() {
-    if(!FLAGS_enable_request_context) {
-      return;
-    }
     getStaticContext() = std::make_shared<RequestContext>();
   }
 
@@ -88,10 +68,6 @@ class RequestContext {
   // profiling any use of these functions.
   void setContextData(
     const std::string& val, std::unique_ptr<RequestData> data) {
-    if (!FLAGS_enable_request_context) {
-      return;
-    }
-
     folly::RWSpinLock::WriteHolder guard(lock);
     if (data_.find(val) != data_.end()) {
       LOG_FIRST_N(WARNING, 1) <<
@@ -132,15 +108,12 @@ class RequestContext {
 
   static std::shared_ptr<RequestContext>
   setContext(std::shared_ptr<RequestContext> ctx) {
-    if (FLAGS_enable_request_context) {
-      std::shared_ptr<RequestContext> old_ctx;
-      if (getStaticContext()) {
-        old_ctx = getStaticContext();
-      }
-      getStaticContext() = ctx;
-      return old_ctx;
+    std::shared_ptr<RequestContext> old_ctx;
+    if (getStaticContext()) {
+      old_ctx = getStaticContext();
     }
-    return nullptr;
+    getStaticContext() = ctx;
+    return old_ctx;
   }
 
   static std::shared_ptr<RequestContext> saveContext() {