-
Notifications
You must be signed in to change notification settings - Fork 184
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
macros: add register vec macros #37
Conversation
@@ -105,6 +105,23 @@ macro_rules! register_counter { | |||
} | |||
|
|||
#[macro_export] | |||
macro_rules! register_counter_vec { | |||
( $ OPTS : expr , $ LABELS_NAMES : expr ) => { |
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.
should support simple (name, help, label_names)
} | ||
}; | ||
|
||
( $ NAME : expr , $ HELP : expr , $ LABELS : expr , $ LABELS_NAMES : expr ) => { |
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.
do we must pass const labels ? I think no need.
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.
Just pass labels!{}
for omitting const_labels.
I think it is pretty confusing if we support
( $ NAME : expr , $ HELP : expr , $ LABELS : expr , $ LABELS_NAMES : expr )
and
( $ NAME : expr , $ HELP : expr , $ LABELS_NAMES : expr )
as the same time.
It is too easy for someone to write something like register_counter_vec!("name", "help", labels!{"a" => "b",})
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.
why confusing? you can remove labels here, or rename LABELS to CONST_LABELS and LABELS_NAMES to VARIABLE_NAMES
Think we can merge #38 first and then re-update the comment for the new macros. |
LGTM |
Resolved #35
@siddontang @disksing