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

*: add feature "push" #86

Merged
merged 7 commits into from
Nov 10, 2016
Merged

*: add feature "push" #86

merged 7 commits into from
Nov 10, 2016

Conversation

overvenus
Copy link
Member

@overvenus overvenus commented Nov 5, 2016

This PR introduces a new feature push. It allows building core instrumentation library without hyper and libc.

There are a few API changes:

  • mod push is published.
  • following functions are moved to mod push.
    push_metrics
    push_add_metrics
    push_collector
    push_add_collector
    hostname_grouping_key
    

Close #84

PTAL @siddontang @kamalmarhubi

Copy link
Contributor

@kamalmarhubi kamalmarhubi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple of minor comments, but otherwise LGTM

@@ -66,8 +69,6 @@ pub use self::histogram::{Histogram, HistogramVec, HistogramOpts, HistogramTimer
// Functions
pub use self::registry::{gather, register, unregister};
pub use self::histogram::{linear_buckets, exponential_buckets};
pub use self::push::{push_metrics, push_add_metrics, push_collector, push_add_collector,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure what the backwards compatibility desires are at this point in the library's life, but the reexport could be maintained.

use std::env;
use std::time;
use std::thread;
mod bridge {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of this module, it is probably easier to conditionally change main:

#[cfg(not(feature = "push"))]
fn main() {
    println!(r#"Please enable feature "push", try:
    cargo run --features=push --example example_push"#);
}

#[cfg(feature = "push")]
fn main() {
    // original main here
}

You could then also have #![cfg_attr(not(feature = "push"), allow(warnings))] at the top of the file to disable warnings on the unused imports and lazy_static and so on.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that is much easier.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wow it's even nicer than I thought it would be after that change! :-)

 * reexport push functions
 * suppress warnings on none-push build
Copy link
Contributor

@kamalmarhubi kamalmarhubi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@overvenus
Copy link
Member Author

PTAL @siddontang

@siddontang
Copy link
Contributor

Do we need to update TiKV?
Please update the cargo version too.

@siddontang
Copy link
Contributor

LGTM

@siddontang
Copy link
Contributor

PTAL @BusyJay

@@ -15,6 +15,7 @@ addons:
env:
global:
- RUSTFLAGS=--deny=warnings
- FEATURES=push
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should test whether everything works fine when the features is disabled.

  Tests with no features enabled
@siddontang
Copy link
Contributor

PTAL @BusyJay

@BusyJay
Copy link
Member

BusyJay commented Nov 10, 2016

LGTM

@siddontang siddontang merged commit eb4e8ea into tikv:master Nov 10, 2016
@overvenus overvenus deleted the push-feature branch January 18, 2017 08:46
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.

None yet

4 participants