Skip to content

Commit 4c157bd

Browse files
committed
Implement minor code review comments
1 parent 55d74c9 commit 4c157bd

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

cpp/arcticdb/entity/metrics.hpp

+4-6
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ class MetricsConfig {
7474

7575
class PrometheusInstance {
7676
public:
77-
using Labels = std::map<std::string, std::string>;
77+
using Labels = prometheus::Labels;
7878

7979
static std::shared_ptr<PrometheusInstance> instance();
8080

@@ -182,11 +182,9 @@ class PrometheusInstance {
182182

183183
struct MetricKeyHash {
184184
std::size_t operator()(const MetricKey& key) const noexcept {
185-
auto hash = std::hash<std::string>()(key.name);
186-
for (const auto& [name, value] : key.labels) {
187-
hash = folly::hash::commutative_hash_combine(hash, name, value);
188-
}
189-
return hash;
185+
auto labels_hash = folly::hash::commutative_hash_combine_range(
186+
key.labels.begin(), key.labels.end());
187+
return folly::hash::commutative_hash_combine(labels_hash, key.name);
190188
}
191189
};
192190

0 commit comments

Comments
 (0)