From: Dave Watson Date: Tue, 27 Jan 2015 21:05:18 +0000 (-0800) Subject: Remove request context enable flag X-Git-Tag: v0.24.0~7 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=e34cac0505dc52c14675c1f07a8c37b0154530ec;p=folly.git Remove request context enable flag 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 --- diff --git a/folly/io/async/Request.cpp b/folly/io/async/Request.cpp index 0f7d2ec3..25686d63 100644 --- a/folly/io/async/Request.cpp +++ b/folly/io/async/Request.cpp @@ -20,17 +20,8 @@ */ #include -#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; } diff --git a/folly/io/async/Request.h b/folly/io/async/Request.h index c02ac518..ffce2ed7 100644 --- a/folly/io/async/Request.h +++ b/folly/io/async/Request.h @@ -26,25 +26,8 @@ #include #include -/** - * 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 - 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(); } @@ -88,10 +68,6 @@ class RequestContext { // profiling any use of these functions. void setContextData( const std::string& val, std::unique_ptr 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 setContext(std::shared_ptr ctx) { - if (FLAGS_enable_request_context) { - std::shared_ptr old_ctx; - if (getStaticContext()) { - old_ctx = getStaticContext(); - } - getStaticContext() = ctx; - return old_ctx; + std::shared_ptr old_ctx; + if (getStaticContext()) { + old_ctx = getStaticContext(); } - return nullptr; + getStaticContext() = ctx; + return old_ctx; } static std::shared_ptr saveContext() {