traeak commented on code in PR #12593:
URL: https://github.com/apache/trafficserver/pull/12593#discussion_r4509142695
##########
plugins/lua/ts_lua_http.cc:
##########
@@ -549,6 +552,31 @@ ts_lua_http_get_next_hop_strategy(lua_State *L)
return 1;
}
+namespace
+{
+// A script naming a missing strategy fails on every transaction, so emit at
most one error per interval.
+constexpr TSHRTime strategy_error_interval = TS_HRTIME_SECONDS(60);
+std::atomic<TSHRTime> next_strategy_error{0};
+std::atomic<uint64_t> suppressed_strategy_errors{0};
+
+void
+log_strategy_lookup_failure(char const *name)
+{
+ TSHRTime const now = TShrtime();
+ TSHRTime next = next_strategy_error.load(std::memory_order_relaxed);
+
+ if (now >= next && next_strategy_error.compare_exchange_strong(next, now +
strategy_error_interval, std::memory_order_relaxed)) {
+ uint64_t const suppressed = suppressed_strategy_errors.exchange(0,
std::memory_order_relaxed);
+ TSError("[ts_lua][ts_lua_http_set_next_hop_strategy] Failed get next hop
strategy name '%s' (%" PRIu64
+ " similar errors suppressed)",
+ name, suppressed);
+ } else {
+ suppressed_strategy_errors.fetch_add(1, std::memory_order_relaxed);
+ Dbg(dbg_ctl, "Failed get next hop strategy name '%s'", name);
Review Comment:
added
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]