Commit e34cac05 authored by Dave Watson's avatar Dave Watson Committed by Andrew Cox

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
parent 32ab0252
......@@ -20,17 +20,8 @@
*/
#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;
}
......@@ -26,25 +26,8 @@
#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() {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment