Skip to content
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

Merged
merged 8 commits into from
Aug 31, 2016
Merged

Conversation

overvenus
Copy link
Member

@@ -105,6 +105,23 @@ macro_rules! register_counter {
}

#[macro_export]
macro_rules! register_counter_vec {
( $ OPTS : expr , $ LABELS_NAMES : expr ) => {
Copy link
Contributor

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 ) => {
Copy link
Contributor

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.

Copy link
Member Author

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",})

Copy link
Contributor

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

@siddontang
Copy link
Contributor

Think we can merge #38 first and then re-update the comment for the new macros.

@siddontang
Copy link
Contributor

LGTM

@siddontang siddontang merged commit 8adc41d into tikv:master Aug 31, 2016
@overvenus overvenus deleted the more-macros branch September 24, 2016 08:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants