Skip to content

Commit 5a80c0e

Browse files
authored
perf: local ratelimit stats use strCat (#39674)
<!-- !!!ATTENTION!!! If you are fixing *any* crash or *any* potential security issue, *do not* open a pull request in this repo. Please report the issue via emailing envoy-security@googlegroups.com where the issue will be triaged appropriately. Thank you in advance for helping to keep Envoy secure. !!!ATTENTION!!! For an explanation of how to fill out the fields, please see the relevant section in [PULL_REQUESTS.md](https://github.com/envoyproxy/envoy/blob/main/PULL_REQUESTS.md) --> Commit Message: Additional Description: Risk Level: Testing: Docs Changes: Release Notes: Platform Specific Features: [Optional Runtime guard:] [Optional Fixes #Issue] [Optional Fixes commit #PR or SHA] [Optional Deprecated:] [Optional [API Considerations](https://github.com/envoyproxy/envoy/blob/main/api/review_checklist.md):] --------- Signed-off-by: Boteng Yao <boteng@google.com>
1 parent 6042675 commit 5a80c0e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

source/extensions/filters/listener/local_ratelimit/local_ratelimit.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ FilterConfig::FilterConfig(
2424
bool FilterConfig::canCreateConnection() { return rate_limiter_.requestAllowed({}).allowed; }
2525

2626
LocalRateLimitStats FilterConfig::generateStats(const std::string& prefix, Stats::Scope& scope) {
27-
const std::string final_prefix = "listener_local_ratelimit." + prefix;
28-
return {ALL_LOCAL_RATE_LIMIT_STATS(POOL_COUNTER_PREFIX(scope, final_prefix))};
27+
static constexpr absl::string_view kPrefix = "listener_local_ratelimit.";
28+
return {ALL_LOCAL_RATE_LIMIT_STATS(POOL_COUNTER_PREFIX(scope, absl::StrCat(kPrefix, prefix)))};
2929
}
3030

3131
Network::FilterStatus Filter::onAccept(Network::ListenerFilterCallbacks& cb) {

0 commit comments

Comments
 (0)