@@ -383,7 +383,7 @@ void StatsHouseManager::add_confdata_binlog_reader_stats(const binlog_reader_sta
383383}
384384
385385void StatsHouseManager::add_slow_net_event_stats (const slow_net_event_stats::stats_t & stats) noexcept {
386- std::visit (overloaded{[this ](const slow_net_event_stats::slow_rpc_response_stats& rpc_query_stat) noexcept {
386+ std::visit (overloaded{[this ](const slow_net_event_stats::slow_rpc_response_stats& rpc_query_stat) noexcept -> void {
387387 // FIXME: it's enough to have it equal 10, but due to bug in GCC we are forced to use a length > 253
388388 constexpr auto MAX_INT_STRING_LENGTH = 254 ;
389389 std::array<char , MAX_INT_STRING_LENGTH> buf{};
@@ -410,13 +410,18 @@ void StatsHouseManager::add_slow_net_event_stats(const slow_net_event_stats::sta
410410 break ;
411411 }
412412
413- static constexpr size_t CURL_URL_MAX_LEN = 100 ;
414- std::string_view curl_url = curl_response_stat.opt_url .value_or (std::string_view{" unknown" });
413+ static constexpr size_t CURL_URL_MAX_LEN = 128 ;
414+ std::string_view slow_url = " unknown" ;
415+ if (curl_response_stat.opt_url .has_value ()) {
416+ slow_url = curl_response_stat.opt_url .value ();
417+ if (const size_t pos = slow_url.find_first_of (' ?' ); pos != std::string_view::npos) {
418+ slow_url.remove_suffix (slow_url.size () - pos);
419+ }
415420
416- client. metric ( " kphp_slow_curl_response " )
417- . tag (curl_kind)
418- . tag (std::string_view{curl_url. data (), std::min (curl_url. size (), CURL_URL_MAX_LEN)})
419- .write_value (curl_response_stat.response_time );
421+ slow_url = slow_url. substr ( 0 , std::min (slow_url. size (), CURL_URL_MAX_LEN));
422+ }
423+
424+ client. metric ( " kphp_slow_curl_response " ). tag (curl_kind). tag (slow_url) .write_value (curl_response_stat.response_time );
420425 }},
421426 stats);
422427}
0 commit comments