-
Notifications
You must be signed in to change notification settings - Fork 316
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
core: Add option to merge families #286
Conversation
88478e4
to
8a102e0
Compare
7d9b25d
to
42b93d1
Compare
core/src/registry.cc
Outdated
std::lock_guard<std::mutex> lock{mutex_}; | ||
|
||
if (insert_behavior_ == InsertBehavior::Merge) { | ||
for (auto &family : families) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use std::find_if
core/include/prometheus/registry.h
Outdated
@@ -36,6 +36,20 @@ namespace prometheus { | |||
/// a data race. | |||
class Registry : public Collectable { | |||
public: | |||
/// \brief How to deal with repeatedly added family names for a type | |||
enum class InsertBehavior { | |||
/// \brief Create new family object and append |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you describe more verbosely how the algorithm works? What happens when there is no existing family with that name, what happens when there is an existing family with that name, but a different type, etc?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ie in the doc comment for each behavior
42b93d1
to
07d8dfb
Compare
f4dddcd
to
1d91f0c
Compare
Just realized that the commit message needs to be updated. |
1d91f0c
to
520153a
Compare
Add three different insert strategies for the Registry. The `NonStandardAppend` is only there and selected for backward compatibility and most likely will go away in the future.
520153a
to
c57ae57
Compare
No description provided.