+ struct MetricKey {
+ MetricKey(const std::string &name, const std::vector<std::pair<std::string, std::string>> labels)
+ : name(name), labels(labels), serialized_labels(serialize_labels(labels))
+ {
+ }
+
+ bool operator< (const MetricKey &other) const
+ {
+ if (name != other.name)
+ return name < other.name;
+ return serialized_labels < other.serialized_labels;
+ }
+
+ const std::string name;
+ const std::vector<std::pair<std::string, std::string>> labels;
+ const std::string serialized_labels;
+ };