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

Gather sort #39

Merged
merged 6 commits into from
Aug 31, 2016
Merged

Gather sort #39

merged 6 commits into from
Aug 31, 2016

Conversation

overvenus
Copy link
Member

Resolved #32

PTAL @siddontang @disksing

@@ -66,7 +67,7 @@ impl RegistryCore {
}

fn gather(&self) -> Vec<proto::MetricFamily> {
let mut mf_by_name = HashMap::new();
let mut mf_by_name = HashMap::with_capacity(self.colloctors_by_id.len());
Copy link
Contributor

Choose a reason for hiding this comment

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

you can use BtreeMap directly.

// here, even for inconsistent metrics. So sort equal metrics
// by their timestamp, with missing timestamps (implying "now")
// coming last.
m1.get_timestamp_ms().cmp(&m2.get_timestamp_ms())
Copy link
Contributor

Choose a reason for hiding this comment

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

need to check timesamp_ms is none?

Copy link
Member Author

Choose a reason for hiding this comment

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

Ported from client_golang, that is the way client_golang choose, rust should be the same, as it is ported from client_golang.

@siddontang
Copy link
Contributor

LGTM

@siddontang siddontang merged commit 7de9510 into tikv:master Aug 31, 2016
@overvenus overvenus deleted the gather-sort 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.

2 participants