Skip to content

Commit

Permalink
cut the option to skip the regex-match-cache
Browse files Browse the repository at this point in the history
Summary: The regex-match-cache (`folly::RegexMatchCache`), used in `ServiceData` and in associated classes, is stable. It is mandatory in the bookkeeping path and it is on-by-default in the query path for all services. But there is no longer any need to have the option to avoid it in the query path.

Reviewed By: dmm-fb

Differential Revision: D64484083

fbshipit-source-id: 67dd1886f1a6a0d015d3ac4a82590ba34fbe1650
  • Loading branch information
yfeldblum authored and facebook-github-bot committed Jan 8, 2025
1 parent 1318577 commit 85cdf32
Showing 1 changed file with 1 addition and 22 deletions.
23 changes: 1 addition & 22 deletions fb303/ServiceData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,6 @@ using std::string;
using std::string_view;
using std::vector;

DEFINE_bool(
fb303_service_data_skip_regex_match_cache,
false,
"If true, getRegexCounters() will not query the regex match cache.");

namespace facebook::fb303 {

template <typename T>
Expand Down Expand Up @@ -464,23 +459,7 @@ map<string, int64_t> ServiceData::getSelectedCounters(
void ServiceData::getRegexCounters(
map<string, int64_t>& _return,
const string& regex) const {
if (!FLAGS_fb303_service_data_skip_regex_match_cache) {
getRegexCountersOptimized(_return, regex);
return;
}

const boost::regex regexObject(regex);
auto keys = getCounterKeys();
keys.erase(
std::remove_if(
keys.begin(),
keys.end(),
[&](const std::string& key) {
return !regex_match(key, regexObject);
}),
keys.end());

getSelectedCounters(_return, keys);
getRegexCountersOptimized(_return, regex);
}

void ServiceData::getRegexCountersOptimized(
Expand Down

0 comments on commit 85cdf32

Please sign in to comment.