Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -798,6 +798,7 @@ target_link_libraries (seastar
lksctp-tools::lksctp-tools
rt::rt
yaml-cpp::yaml-cpp
unordered_dense::unordered_dense
"$<BUILD_INTERFACE:Valgrind::valgrind>"
Threads::Threads)

Expand Down
5 changes: 4 additions & 1 deletion cmake/SeastarDependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@ macro (seastar_find_dependencies)
lksctp-tools # No version information published.
numactl # No version information published.
rt
yaml-cpp)
yaml-cpp
unordered_dense)

# Arguments to `find_package` for each 3rd-party dependency.
# Note that the version specification is a "minimal" version requirement.
Expand Down Expand Up @@ -143,6 +144,8 @@ macro (seastar_find_dependencies)
OPTION ${Seastar_NUMA})
seastar_set_dep_args (yaml-cpp REQUIRED
VERSION 0.5.1)
seastar_set_dep_args (unordered_dense
VERSION 4.4.0 CONFIG REQUIRED)

foreach (third_party ${_seastar_all_dependencies})
if (NOT _seastar_dep_skip_${third_party})
Expand Down
8 changes: 5 additions & 3 deletions src/core/prometheus.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
#include <seastar/core/loop.hh>
#include <regex>

#include <ankerl/unordered_dense.h>

namespace seastar {

extern seastar::logger seastar_logger;
Expand Down Expand Up @@ -531,7 +533,7 @@ void write_summary(std::stringstream& s, const config& ctx, const sstring& name,
*/
class metric_aggregate_by_labels {
std::vector<std::string> _labels_to_aggregate_by;
std::unordered_map<std::map<sstring, sstring>, seastar::metrics::impl::metric_value> _values;
ankerl::unordered_dense::segmented_map<std::map<sstring, sstring>, seastar::metrics::impl::metric_value> _values;
public:
metric_aggregate_by_labels(std::vector<std::string> labels) : _labels_to_aggregate_by(std::move(labels)) {
}
Expand All @@ -548,14 +550,14 @@ class metric_aggregate_by_labels {
for (auto&& l : _labels_to_aggregate_by) {
labels.erase(l);
}
std::unordered_map<std::map<sstring, sstring>, seastar::metrics::impl::metric_value>::iterator i = _values.find(labels);
auto i = _values.find(labels);
if ( i == _values.end()) {
_values.emplace(std::move(labels), m);
} else {
i->second += m;
}
}
const std::unordered_map<std::map<sstring, sstring>, seastar::metrics::impl::metric_value>& get_values() const noexcept {
const auto& get_values() const noexcept {
return _values;
}
bool empty() const noexcept {
Expand Down