Skip to content

Commit

Permalink
Debug prints
Browse files Browse the repository at this point in the history
  • Loading branch information
AlttiJokinen committed Feb 16, 2024
1 parent 7f7fda0 commit d2675fa
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion core/src/family.cc
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ template <typename T>
T& Family<T>::Add(const Labels& labels, std::unique_ptr<T> object) {
std::lock_guard<std::mutex> lock{mutex_};

printf("add function \r\n");
for( auto iter: labels){
printf("Label name %s \r\n", iter.first.c_str());
}

auto insert_result =
metrics_.insert(std::make_pair(labels, std::move(object)));

Expand All @@ -48,8 +53,17 @@ T& Family<T>::Add(const Labels& labels, std::unique_ptr<T> object) {
throw std::invalid_argument("Invalid label name");
}
if (constant_labels_.count(label_name)) {
printf("Label name %s count:%zu \r\n", label_name.c_str(),constant_labels_.count(label_name));

printf("Labels available ------ \r\n");

for( auto it = constant_labels_.begin(); it != constant_labels_.end(); ++it )
{
printf("Label name %s \r\n", it->first.c_str());
}

metrics_.erase(insert_result.first);
//throw std::invalid_argument("Duplicate label name");
throw std::invalid_argument("Duplicate label name");
}
}
}
Expand Down

0 comments on commit d2675fa

Please sign in to comment.